1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2024-04-02 08:05:43 +02:00
parent 24f3824524
commit 3538d796a7
4 changed files with 53 additions and 27 deletions

View File

@ -293,8 +293,8 @@ jobs:
fail-fast: false
matrix:
include:
- { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, arch: amd64 }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, arch: amd64 }
- { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 }
steps:
- run: git config --global core.autocrlf false
- name: 'Check out code'
@ -306,7 +306,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: ${{ matrix.vsversion }}
arch: ${{ matrix.arch }}
arch: ${{ matrix.vsarch }}
- name: 'Build debug'
run: 'make build/debug'
- name: 'Build release'
@ -325,12 +325,12 @@ jobs:
name: ${{ env.artifact_name }}
path: tmp/artifact
- name: 'Run ctest tests'
if: ${{ matrix.arch != 'amd64_arm64' }}
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
ctest --test-dir build/debug -C Debug
ctest --test-dir build/release -C Release
- name: 'Run test suite build/release'
if: ${{ matrix.arch != 'amd64_arm64' }}
if: ${{ matrix.vsarch != 'amd64_arm64' }}
shell: bash
run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
@ -348,14 +348,14 @@ jobs:
fail-fast: false
matrix:
include:
- { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, arch: amd64 }
- { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, arch: amd64 }
- { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, arch: amd64_arm64 }
- { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, arch: amd64_arm64 }
- { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, arch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
# { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, arch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
- { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, arch: amd64_x86 }
- { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, arch: amd64_x86 }
- { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_arm64 }
- { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 }
- { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
# { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
- { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_x86 }
- { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
steps:
- run: git config --global core.autocrlf false
- name: 'Check out code'
@ -372,7 +372,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: ${{ matrix.vsversion }}
arch: ${{ matrix.arch }}
arch: ${{ matrix.vsarch }}
- name: 'Build by hand'
shell: cmd
run: |
@ -426,7 +426,7 @@ jobs:
name: ${{ env.artifact_name }}
path: tmp/artifact
- name: 'Run basic tests'
if: ${{ matrix.arch != 'amd64_arm64' }}
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
$ErrorActionPreference = 'stop'
$ErrorView = 'NormalView'
@ -440,7 +440,7 @@ jobs:
.\upx.exe -t upx_packed.exe
.\upx_packed.exe --version
- name: 'Run test suite'
if: ${{ matrix.arch != 'amd64_arm64' }}
if: ${{ matrix.vsarch != 'amd64_arm64' }}
shell: bash
run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"

View File

@ -110,7 +110,11 @@ endfunction()
function(upx_add_glob_files) # ARGV
set(var_name ${ARGV0})
list(REMOVE_AT ARGV 0)
file(GLOB files ${ARGV})
if(${CMAKE_VERSION} VERSION_LESS "3.3")
file(GLOB files ${ARGV})
else()
file(GLOB files LIST_DIRECTORIES false ${ARGV})
endif()
set(result "")
if(DEFINED ${var_name})
set(result "${${var_name}}")

View File

@ -370,6 +370,36 @@ static noinline double u64_f64_sub_div(upx_uint64_t a, upx_uint64_t b) {
return (a - b) / 1000000.0;
}
// extra debugging; floating point edge cases cause portability problems in practice
static noinline bool shall_test_float_division_by_zero(void) {
static bool result = false; // default is false
static upx_std_once_flag init_done;
upx_std_call_once(init_done, []() noexcept {
const char envvar[] = "UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO";
const char *e = getenv(envvar);
bool force = (e && e[0] && strcmp(e, "2") == 0);
if (force)
result = true;
else if (is_envvar_true(envvar)) {
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring %s: __FAST_MATH__\n", envvar);
#elif defined(__clang__) && (__clang_major__ < 9) && defined(__SANITIZE_UNDEFINED_BEHAVIOR__)
// UBSAN problem with clang < 9
// @COMPILER_BUG @CLANG_BUG @UBSAN_BUG
fprintf(stderr, "upx: WARNING: ignoring %s: UBSAN\n", envvar);
#elif defined(__clang__) && (__clang_major__ < 8)
// NOTE: cannot reliably detect __SANITIZE_UNDEFINED_BEHAVIOR__ on older clang versions
// @COMPILER_BUG @CLANG_BUG @UBSAN_BUG
fprintf(stderr, "upx: WARNING: ignoring %s: clang %d\n", envvar, __clang_major__);
#else
result = true;
#endif
}
});
return result;
}
template <class Int, class Float>
struct TestFloat {
static constexpr Int X = 1000000;
@ -385,18 +415,10 @@ struct TestFloat {
assert_noexcept(sub_div(3 * X, X, Float(X)) == Float(2));
assert_noexcept(sub_div_x(3 * X, X) == Float(2));
// extra debugging; floating point edge cases cause portability problems in practice
if (is_envvar_true("UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO")) {
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO\n");
#elif defined(__clang__) && (__clang_major__ < 9) && defined(__SANITIZE_UNDEFINED_BEHAVIOR__)
// @COMPILER_BUG @CLANG_BUG
fprintf(stderr, "upx: WARNING: ignoring UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO\n");
#else
if (shall_test_float_division_by_zero()) {
assert_noexcept(std::isnan(div(0, Float(0))));
assert_noexcept(std::isinf(div(1, Float(0))));
assert_noexcept(std::isinf(div(Int(-1), Float(0))));
#endif
}
}
};

View File

@ -38,7 +38,7 @@
// Automatic conversion to underlying pointer; do NOT enable this config as this
// defeats the main purpose of a checked pointer => use raw_bytes() as needed;
// and see xspan_fwd.h how to make this more convenient.
// and see "xspan_fwd.h" how to make this more convenient.
#ifndef XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION
#define XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION 0
#endif