From ba969fb9f2bb0183527803876dbd25a3de14ca58 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 31 Jul 2024 09:24:33 +0200 Subject: [PATCH] CI updates --- .github/workflows/ci.yml | 42 ++++++++++++++++----------------- src/check/dt_cxxlib.cpp | 50 ++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 5 +++- src/util/cxxlib.h | 18 ++++++++++++++- 4 files changed, 92 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a28183e..c63be46a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,10 +137,10 @@ jobs: dirs="$dirs cross-windows-mingw32/debug cross-windows-mingw32/release" dirs="$dirs cross-windows-mingw64/debug cross-windows-mingw64/release" fi - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdir/$d" cmake --install build/extra/$d; done - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdirAndStrip/$d" cmake --install build/extra/$d --strip; done - for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefix/$d"; done - for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefixAndStrip/$d" --strip; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/$d" cmake --install build/extra/$d; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdirAndStrip/$d" cmake --install build/extra/$d --strip; done + for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefix/$d"; done + for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/$d" --strip; done (cd build && shopt -s nullglob && cp -ai --parents */upx{,.exe} */*/*/upx{,.exe} "../tmp/artifact/$N") if command -v hardlink >/dev/null; then (cd "tmp/artifact/$N" && hardlink .) fi (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la) @@ -275,13 +275,13 @@ jobs: mkdir -p "tmp/artifact/$N" dirs="clang/debug clang/release" test -n "${{ matrix.gcc }}" && dirs="$dirs gcc/debug gcc/release" - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdir/$d" cmake --install build/extra/$d; done - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdirAndStrip/$d" cmake --install build/extra/$d --strip; done - for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefix/$d"; done - for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefixAndStrip/$d" --strip; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/$d" cmake --install build/extra/$d; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdirAndStrip/$d" cmake --install build/extra/$d --strip; done + for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefix/$d"; done + for d in $dirs; do cmake --install build/extra/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/$d" --strip; done (cd build && rsync -R -a */*/*/upx "../tmp/artifact/$N/") hardlink="$HOMEBREW_PREFIX/opt/util-linux/bin/hardlink" - if test -f "$hardlink"; then (cd "tmp/artifact/$N" && $hardlink .) fi + if test -f "$hardlink"; then (cd "tmp/artifact/$N" && "$hardlink" .) fi (cd tmp/artifact && gtar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la) echo "artifact_name=$N" >> $GITHUB_ENV - name: ${{ format('Upload artifact {0}', env.artifact_name) }} @@ -350,14 +350,14 @@ jobs: run: | N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N" - DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdir/debug" cmake --install build/debug --config Debug - DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdir/release" cmake --install build/release --config Release - DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdirAndStrip/debug" cmake --install build/debug --config Debug --strip - DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdirAndStrip/release" cmake --install build/release --config Release --strip - cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithPrefix/debug" - cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithPrefix/release" - cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithPrefixAndStrip/debug" --strip - cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithPrefixAndStrip/release" --strip + DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/debug" cmake --install build/debug --config Debug + DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/release" cmake --install build/release --config Release + DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdirAndStrip/debug" cmake --install build/debug --config Debug --strip + DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdirAndStrip/release" cmake --install build/release --config Release --strip + cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefix/debug" + cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefix/release" + cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/debug" --strip + cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/release" --strip (cd build && cp -ai --parents */*/upx.exe "../tmp/artifact/$N") (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la) echo "artifact_name=$N" >> $GITHUB_ENV @@ -602,10 +602,10 @@ jobs: mkdir -p "tmp/artifact/$N" if [[ "${{ matrix.zig_target }}" == *-linux* ]]; then dirs="${ZIG_TARGET}${ZIG_PIC}/debug ${ZIG_TARGET}${ZIG_PIC}/release" - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdir/$d" cmake --install build/zig/$d; done - for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithDestdirAndStrip/$d" cmake --install build/zig/$d --strip; done - for d in $dirs; do cmake --install build/zig/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefix/$d"; done - for d in $dirs; do cmake --install build/zig/$d --prefix "$PWD/tmp/artifact/$N/InstallWithPrefixAndStrip/$d" --strip; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/$d" cmake --install build/zig/$d; done + for d in $dirs; do DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdirAndStrip/$d" cmake --install build/zig/$d --strip; done + for d in $dirs; do cmake --install build/zig/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefix/$d"; done + for d in $dirs; do cmake --install build/zig/$d --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/$d" --strip; done fi (cd build && shopt -s nullglob && cp -ai --parents */upx{,.exe} */*/*/upx{,.exe} "../tmp/artifact/$N") if command -v hardlink >/dev/null; then (cd "tmp/artifact/$N" && hardlink .) fi diff --git a/src/check/dt_cxxlib.cpp b/src/check/dt_cxxlib.cpp index 4546b313..f1c70778 100644 --- a/src/check/dt_cxxlib.cpp +++ b/src/check/dt_cxxlib.cpp @@ -187,6 +187,26 @@ TEST_CASE("upx::noncopyable") { // **************************************************************************/ +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(!upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); +static_assert(upx::is_bounded_array_v); + static_assert(upx::is_same_all_v); static_assert(upx::is_same_all_v); static_assert(upx::is_same_all_v); @@ -211,6 +231,36 @@ static_assert(!upx::is_same_any_v); #endif +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); + +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); +static_assert(std::is_same_v >); + /************************************************************************* // **************************************************************************/ diff --git a/src/main.cpp b/src/main.cpp index ab67e456..2d181687 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1211,6 +1211,7 @@ int upx_main(int argc, char *argv[]) may_throw { } // Allow serial re-use of upx_main() as a subroutine + exit_code = EXIT_OK; opt->reset(); #if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_TOS || ACC_OS_WIN16 || \ @@ -1313,8 +1314,10 @@ int upx_main(int argc, char *argv[]) may_throw { /* start work */ set_term(stdout); - if (do_files(i, argc, argv) != 0) + if (do_files(i, argc, argv) != 0) { + assert(exit_code != 0); return exit_code; + } if (gitrev[0]) { // also see UPX_CONFIG_DISABLE_GITREV in CMakeLists.txt diff --git a/src/util/cxxlib.h b/src/util/cxxlib.h index 9d91d7a7..a855efca 100644 --- a/src/util/cxxlib.h +++ b/src/util/cxxlib.h @@ -156,7 +156,7 @@ protected: // **************************************************************************/ -// is_bounded_array: identical to C++20 std::is_bounded_array +// is_bounded_array from C++20 template struct is_bounded_array : public std::false_type {}; template @@ -174,6 +174,22 @@ struct is_same_any : public std::disjunction...> {}; template inline constexpr bool is_same_any_v = is_same_any::value; +// remove_cvref from C++20 +template +struct remove_cvref { + typedef typename std::remove_cv::type>::type type; +}; +template +using remove_cvref_t = typename remove_cvref::type; + +// type_identity from C++20 +template +struct type_identity { + typedef T type; +}; +template +using type_identity_t = typename type_identity::type; + /************************************************************************* // C++20 **************************************************************************/