1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2024-04-28 22:18:47 +02:00
parent 80e22a7e38
commit 157a63a023
13 changed files with 120 additions and 90 deletions

View File

@ -142,41 +142,24 @@ jobs:
make build/extra/gcc/release+test make build/extra/gcc/release+test
make build/extra/clang/debug+test make build/extra/clang/debug+test
make build/extra/clang/release+test make build/extra/clang/release+test
- name: 'Run ctest tests 32-bit' if test "${{ matrix.use_m32 }}" = "true"; then
if: ${{ matrix.use_m32 }}
run: |
make build/extra/gcc-m32/debug+test make build/extra/gcc-m32/debug+test
make build/extra/gcc-m32/release+test make build/extra/gcc-m32/release+test
fi
- name: 'Mimic ctest tests' - name: 'Mimic ctest tests'
run: | run: |
env -C build/extra/gcc/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh targets="gcc/debug gcc/release clang/debug clang/release"
env -C build/extra/gcc/release bash "$PWD"/misc/testsuite/mimic_ctest.sh test "${{ matrix.use_m32 }}" = "true" && targets="$targets gcc-m32/debug gcc-m32/release"
env -C build/extra/clang/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh parallel -k 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $targets
env -C build/extra/clang/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
- name: 'Mimic ctest tests 32-bit'
if: ${{ matrix.use_m32 }}
run: |
env -C build/extra/gcc-m32/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/extra/gcc-m32/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
- name: 'Mimic ctest tests with Valgrind' - name: 'Mimic ctest tests with Valgrind'
run: | run: |
if command -v valgrind >/dev/null; then if command -v valgrind >/dev/null; then
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all" export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST=ON # valgrind is SLOW export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
env -C build/extra/gcc/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/extra/gcc/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
# clang/debug does not work before valgrind-3.20, see https://bugs.kde.org/show_bug.cgi?id=452758 # clang/debug does not work before valgrind-3.20, see https://bugs.kde.org/show_bug.cgi?id=452758
##env -C build/extra/clang/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh targets="gcc/debug gcc/release clang/release"
env -C build/extra/clang/release bash "$PWD"/misc/testsuite/mimic_ctest.sh test "${{ matrix.use_m32 }}" = "true" && targets="$targets gcc-m32/debug gcc-m32/release"
fi parallel -k 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $targets
- name: 'Mimic ctest tests 32-bit with Valgrind'
if: ${{ matrix.use_m32 }}
run: |
if command -v valgrind >/dev/null; then
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST=ON # valgrind is SLOW
env -C build/extra/gcc-m32/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/extra/gcc-m32/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
fi fi
- name: 'Run file system test suite' - name: 'Run file system test suite'
run: | run: |
@ -510,7 +493,8 @@ jobs:
if: ${{ job.container }} if: ${{ job.container }}
shell: sh shell: sh
run: | run: |
apk update && apk upgrade && apk add bash cmake file git make tar xz apk update && apk upgrade && apk add bash cmake file git make parallel tar xz
mkdir -p ~/.parallel && touch ~/.parallel/will-cite
# set PATH like in Ubuntu # set PATH like in Ubuntu
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
# this seems to be needed when running in a container (beause of UID mismatch??) # this seems to be needed when running in a container (beause of UID mismatch??)
@ -583,22 +567,22 @@ jobs:
if: ${{ matrix.zig_target == 'i386-linux-musl' || matrix.zig_target == 'x86_64-linux-musl' }} if: ${{ matrix.zig_target == 'i386-linux-musl' || matrix.zig_target == 'x86_64-linux-musl' }}
run: | run: |
apk add coreutils apk add coreutils
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh parallel -k 'cd build/zig/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' \
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/release bash "$PWD"/misc/testsuite/mimic_ctest.sh ::: ${ZIG_TARGET}${ZIG_PIC}/debug ${ZIG_TARGET}${ZIG_PIC}/release
- name: ${{ format('Mimic ctest tests with QEMU {0}', matrix.qemu) }} - name: ${{ format('Mimic ctest tests with QEMU {0}', matrix.qemu) }}
if: ${{ matrix.qemu }} if: ${{ matrix.qemu }}
run: | run: |
qemu="${{ matrix.qemu }}" qemu="${{ matrix.qemu }}"
apk add coreutils "${qemu%% *}" apk add coreutils "${qemu%% *}"
export upx_exe_runner="$qemu" export upx_exe_runner="$qemu"
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh parallel -k 'cd build/zig/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' \
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/release bash "$PWD"/misc/testsuite/mimic_ctest.sh ::: ${ZIG_TARGET}${ZIG_PIC}/debug ${ZIG_TARGET}${ZIG_PIC}/release
- name: 'Mimic ctest tests with Valgrind' - name: 'Mimic ctest tests with Valgrind'
if: ${{ matrix.zig_target == 'x86_64-linux-musl' }} if: ${{ matrix.zig_target == 'x86_64-linux-musl' }}
run: | run: |
apk add coreutils valgrind apk add coreutils valgrind
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all" export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
upx_exe_runner="$upx_exe_runner --suppressions=$PWD/misc/valgrind/musl.supp" upx_exe_runner="$upx_exe_runner --suppressions=$PWD/misc/valgrind/musl.supp"
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST=ON # valgrind is SLOW export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh parallel -k 'cd build/zig/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' \
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/release bash "$PWD"/misc/testsuite/mimic_ctest.sh ::: ${ZIG_TARGET}${ZIG_PIC}/debug ${ZIG_TARGET}${ZIG_PIC}/release

View File

@ -53,7 +53,7 @@ endif()
# test config options (see below) # test config options (see below)
# IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX! # IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX!
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself" OFF) option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself" OFF)
option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST "Do not run exhaustive test" OFF) option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests" OFF)
#*********************************************************************** #***********************************************************************
# init # init
@ -241,7 +241,7 @@ endif()
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO) if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
upx_print_common_symbols() upx_print_common_symbols()
upx_print_mingw_symbols() upx_print_mingw_symbols()
endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO endif()
#*********************************************************************** #***********************************************************************
# targets # targets
@ -493,25 +493,15 @@ upx_cmake_include_hook(8_summary)
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR) upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO) if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},") include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/print_info.cmake")
upx_print_var(CMAKE_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_SOURCE_DIR)
endif() endif()
upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_APPLE_SILICON_PROCESSOR)
upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR)
upx_print_var(CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
upx_print_var(CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_AR CMAKE_RANLIB)
upx_print_var(CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_C_COMPILER_ARCHITECTURE_ID CMAKE_C_PLATFORM_ID CMAKE_C_COMPILER_ABI)
upx_print_var(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_ARCHITECTURE_ID CMAKE_CXX_PLATFORM_ID CMAKE_CXX_COMPILER_ABI)
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE CMAKE_TRY_COMPILE_CONFIGURATION)
upx_print_var(APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64)
endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO
upx_print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE) upx_print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
if(Threads_FOUND) if(Threads_FOUND)
message(STATUS "WITH_THREADS = 1") message(STATUS "WITH_THREADS = 1")
elseif(UPX_CONFIG_REQUIRE_THREADS) elseif(UPX_CONFIG_REQUIRE_THREADS)
message(FATAL_ERROR "ERROR: WITH_THREADS required") message(FATAL_ERROR "ERROR: WITH_THREADS required")
elseif(UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS) elseif(UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS)
message(FATAL_ERROR "ERROR: WITH_THREADS expected; set UPX_CONFIG_EXPECT_THREADS=OFF to disable") message(FATAL_ERROR "ERROR: WITH_THREADS expected; set UPX_CONFIG_EXPECT_THREADS=OFF")
endif() endif()
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|None|Release)$") if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|None|Release)$")
message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"") message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"")
@ -522,7 +512,7 @@ if(NOT UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK)
upx_platform_check_mismatch(CMAKE_C_PLATFORM_ID CMAKE_CXX_PLATFORM_ID) upx_platform_check_mismatch(CMAKE_C_PLATFORM_ID CMAKE_CXX_PLATFORM_ID)
upx_platform_check_mismatch(CMAKE_C_COMPILER_ABI CMAKE_CXX_COMPILER_ABI) upx_platform_check_mismatch(CMAKE_C_COMPILER_ABI CMAKE_CXX_COMPILER_ABI)
upx_platform_check_mismatch(CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_FRONTEND_VARIANT) upx_platform_check_mismatch(CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
endif() # UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK endif()
upx_cmake_include_hook(9_finish) upx_cmake_include_hook(9_finish)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt" "") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt" "")

View File

@ -55,13 +55,14 @@ build/%/all: $$(dir $$@)debug $$(dir $$@)release PHONY ;
# test # test
#*********************************************************************** #***********************************************************************
CTEST = ctest
CTEST_JOBS ?= 8 CTEST_JOBS ?= 8
CTEST = ctest --parallel $(CTEST_JOBS) CTEST_FLAGS = --output-on-failure --parallel $(CTEST_JOBS)
build/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) build/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) -C Debug $(CTEST_FLAGS)
build/%/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) build/%/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) -C Debug $(CTEST_FLAGS)
build/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) build/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) -C Release $(CTEST_FLAGS)
build/%/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) build/%/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) -C Release $(CTEST_FLAGS)
build/%/all+test: $$(dir $$@)debug+test $$(dir $$@)release+test PHONY ; build/%/all+test: $$(dir $$@)debug+test $$(dir $$@)release+test PHONY ;
# shortcuts # shortcuts
@ -69,8 +70,7 @@ debug+test: build/debug+test PHONY
release+test: build/release+test PHONY release+test: build/release+test PHONY
all+test build/all+test: build/debug+test build/release+test PHONY all+test build/all+test: build/debug+test build/release+test PHONY
# by default do test debug and release builds test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
test:: build/all+test PHONY
# #
# END of Makefile # END of Makefile

View File

@ -201,7 +201,7 @@ function(upx_cache_bool_vars) # ARGV
elseif(DEFINED ${var_name}) # defined via "cmake -DXXX=YYY" elseif(DEFINED ${var_name}) # defined via "cmake -DXXX=YYY"
set(value "${${var_name}}") set(value "${${var_name}}")
elseif(DEFINED ENV{${var_name}}) # check environment elseif(DEFINED ENV{${var_name}}) # check environment
if("$ENV{${var_name}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE)$") if("$ENV{${var_name}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE|off|on|false|true)$")
set(value "$ENV{${var_name}}") set(value "$ENV{${var_name}}")
set(UPX_CACHE_ORIGIN_FROM_ENV_${var_name} TRUE CACHE INTERNAL "" FORCE) # for status message below set(UPX_CACHE_ORIGIN_FROM_ENV_${var_name} TRUE CACHE INTERNAL "" FORCE) # for status message below
endif() endif()

View File

@ -0,0 +1,28 @@
#
# UPX "CMake" build file; see https://cmake.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
#***********************************************************************
# summary section
# print some info about the build configuration
#***********************************************************************
if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},")
upx_print_var(CMAKE_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_SOURCE_DIR)
endif()
upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_APPLE_SILICON_PROCESSOR)
upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR)
upx_print_var(CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
upx_print_var(CMAKE_C_COMPILER_LAUNCHER CMAKE_CXX_COMPILER_LAUNCHER)
upx_print_var(CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_AR CMAKE_RANLIB)
upx_print_var(CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_C_COMPILER_ARCHITECTURE_ID CMAKE_C_PLATFORM_ID CMAKE_C_COMPILER_ABI)
upx_print_var(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_ARCHITECTURE_ID CMAKE_CXX_PLATFORM_ID CMAKE_CXX_COMPILER_ABI)
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE CMAKE_TRY_COMPILE_CONFIGURATION)
upx_print_var(APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64)
# vim:set ft=cmake ts=4 sw=4 tw=0 et:

View File

@ -18,6 +18,10 @@ set(exe "${CMAKE_EXECUTABLE_SUFFIX}")
set(upx_self_exe "$<TARGET_FILE:upx>") set(upx_self_exe "$<TARGET_FILE:upx>")
set(fo "--force-overwrite") set(fo "--force-overwrite")
#
# basic tests
#
upx_add_test(upx-self-pack upx -3 "${upx_self_exe}" ${fo} -o upx-packed${exe}) upx_add_test(upx-self-pack upx -3 "${upx_self_exe}" ${fo} -o upx-packed${exe})
upx_add_test(upx-self-pack-fa upx -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe}) upx_add_test(upx-self-pack-fa upx -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe})
upx_add_test(upx-self-pack-fn upx -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe}) upx_add_test(upx-self-pack-fn upx -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe})
@ -93,7 +97,11 @@ if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
upx_test_depends(upx-run-packed-lzma upx-self-pack-lzma) upx_test_depends(upx-run-packed-lzma upx-self-pack-lzma)
endif() endif()
if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST) #
# exhaustive tests
#
if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS)
foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma) foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma)
foreach(level IN ITEMS 1 2 3 4 5 6 7) foreach(level IN ITEMS 1 2 3 4 5 6 7)
set(s "${method}-${level}") set(s "${method}-${level}")
@ -114,7 +122,7 @@ if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST)
endif() endif()
endforeach() endforeach()
endforeach() endforeach()
endif () # UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST endif () # UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
# clean up # clean up
set(emu "") set(emu "")

View File

@ -293,7 +293,7 @@ UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SANITIZE)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS)
# pass UPX extra compile options; see CMakeLists.txt # pass UPX extra compile options; see CMakeLists.txt
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)

View File

@ -4,6 +4,7 @@ set -e; set -o pipefail
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")" argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# rebuild stubs from source code # rebuild stubs from source code
# (also see 20-image-run-shell.sh for more container usage examples)
# using a rootless Podman container # using a rootless Podman container
# Copyright (C) Markus Franz Xaver Johannes Oberhumer # Copyright (C) Markus Franz Xaver Johannes Oberhumer

View File

@ -18,7 +18,7 @@ RUN dpkg --add-architecture i386 \
elfutils execstack fd-find file fish fzf g++ gawk gdb gojq ht htop hyperfine jq ksh \ elfutils execstack fd-find file fish fzf g++ gawk gdb gojq ht htop hyperfine jq ksh \
libzstd-dev lsb-release lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \ libzstd-dev lsb-release lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
p7zip parallel patch patchelf patchutils pax-utils proot \ p7zip parallel patch patchelf patchutils pax-utils proot \
python3 python3-pyasn1 python3-pycryptodome python3-zstd \ python3 python3-pyasn1 python3-pycryptodome python3-yaml python3-zstd \
re2c ripgrep rsync screen universal-ctags unzip yash yq \ re2c ripgrep rsync screen universal-ctags unzip yash yq \
zip zlib1g-dev zoxide zsh zstd \ zip zlib1g-dev zoxide zsh zstd \
# extra packages for compiling with "gcc -m32" and "gcc -mx32": # extra packages for compiling with "gcc -m32" and "gcc -mx32":
@ -72,7 +72,7 @@ RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
&& cd /home/upx && chmod 00700 . \ && cd /home/upx && chmod 00700 . \
# prepare ~/.cache, ~/.config and ~/.local for possible tmpfs mounts # prepare ~/.cache, ~/.config and ~/.local for possible tmpfs mounts
&& mkdir -p .cache/tmp .local/bin src/upx \ && mkdir -p .cache/tmp .local/bin src/upx \
&& for d in ccache fontconfig go-build mesa_shader_cache tmp wine zig; do mkdir -p .cache/$d; done \ && for d in ccache fontconfig go-build mesa_shader_cache parallel tmp wine zig; do mkdir -p .cache/$d; done \
&& for d in fish git helix kak nvim; do mkdir -p .config/$d; done \ && for d in fish git helix kak nvim; do mkdir -p .config/$d; done \
&& for d in bin include lib share state; do mkdir -p .local/$d; done \ && for d in bin include lib share state; do mkdir -p .local/$d; done \
&& ln -s .cache/wine .wine && ln -s .cache/tmp tmp \ && ln -s .cache/wine .wine && ln -s .cache/tmp tmp \

View File

@ -2,7 +2,7 @@ Packages:
+++-=============================-=================================-============-================================================================================ +++-=============================-=================================-============-================================================================================
Desired=Unknown/Install/Remove/Purge/Hold Desired=Unknown/Install/Remove/Purge/Hold
ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio
ii apt 2.7.12 amd64 commandline package manager ii apt 2.7.14build2 amd64 commandline package manager
ii aria2 1.37.0+debian-1build3 amd64 High speed download utility ii aria2 1.37.0+debian-1build3 amd64 High speed download utility
ii base-files 13ubuntu10 amd64 Debian base system miscellaneous files ii base-files 13ubuntu10 amd64 Debian base system miscellaneous files
ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files
@ -24,7 +24,7 @@ ii ccache 4.9.1-1 amd64
ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries
ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system
ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation) ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation)
ii coreutils 9.4-2ubuntu4 amd64 GNU core utilities ii coreutils 9.4-3ubuntu6 amd64 GNU core utilities
ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files
ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp)
ii cpp-13 13.2.0-23ubuntu4 amd64 GNU C preprocessor ii cpp-13 13.2.0-23ubuntu4 amd64 GNU C preprocessor
@ -66,7 +66,7 @@ ii gdb 15.0.50.20240403-0ubuntu1 amd64
ii git 1:2.43.0-1ubuntu7 amd64 fast, scalable, distributed revision control system ii git 1:2.43.0-1ubuntu7 amd64 fast, scalable, distributed revision control system
ii git-man 1:2.43.0-1ubuntu7 all fast, scalable, distributed revision control system (manual pages) ii git-man 1:2.43.0-1ubuntu7 all fast, scalable, distributed revision control system (manual pages)
ii gojq 0.12.13-1 amd64 pure Go implementation of jq (program) ii gojq 0.12.13-1 amd64 pure Go implementation of jq (program)
ii gpgv 2.4.4-2ubuntu7 amd64 GNU privacy guard - signature verification tool ii gpgv 2.4.4-2ubuntu17 amd64 GNU privacy guard - signature verification tool
ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep
ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components) ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components)
ii gzip 1.12-1ubuntu3 amd64 GNU compression utilities ii gzip 1.12-1ubuntu3 amd64 GNU compression utilities
@ -90,7 +90,7 @@ ii lib32stdc++-13-dev 13.2.0-23ubuntu4 amd64
ii lib32stdc++6 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3 (32 bit Version) ii lib32stdc++6 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3 (32 bit Version)
ii lib32ubsan1 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (32bit) ii lib32ubsan1 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (32bit)
ii libacl1:amd64 2.3.2-1build1 amd64 access control list - shared library ii libacl1:amd64 2.3.2-1build1 amd64 access control list - shared library
ii libapt-pkg6.0:amd64 2.7.12 amd64 package management runtime library ii libapt-pkg6.0t64:amd64 2.7.14build2 amd64 package management runtime library
ii libarchive13t64:amd64 3.7.2-2 amd64 Multi-format archive and compression library (shared library) ii libarchive13t64:amd64 3.7.2-2 amd64 Multi-format archive and compression library (shared library)
ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2 ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2
ii libasan8:amd64 14-20240412-0ubuntu1 amd64 AddressSanitizer -- a fast memory error detector ii libasan8:amd64 14-20240412-0ubuntu1 amd64 AddressSanitizer -- a fast memory error detector
@ -188,7 +188,7 @@ ii libnettle8t64:amd64 3.9.1-2.2build1 amd64
ii libnghttp2-14:amd64 1.59.0-1build4 amd64 library implementing HTTP/2 protocol (shared library) ii libnghttp2-14:amd64 1.59.0-1build4 amd64 library implementing HTTP/2 protocol (shared library)
ii libnl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets ii libnl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets
ii libnl-genl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets - generic netlink ii libnl-genl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets - generic netlink
ii libnpth0:amd64 1.6-3build2 amd64 replacement for GNU Pth using system threads ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library
ii libp11-kit0:amd64 0.25.3-4ubuntu2 amd64 library for loading and coordinating access to PKCS#11 modules - runtime ii libp11-kit0:amd64 0.25.3-4ubuntu2 amd64 library for loading and coordinating access to PKCS#11 modules - runtime
ii libpam-modules-bin 1.5.3-5ubuntu5 amd64 Pluggable Authentication Modules for PAM - helper binaries ii libpam-modules-bin 1.5.3-5ubuntu5 amd64 Pluggable Authentication Modules for PAM - helper binaries
@ -351,13 +351,12 @@ ii zoxide 0.9.3-1 amd64
ii zsh 5.9-6ubuntu2 amd64 shell with lots of features ii zsh 5.9-6ubuntu2 amd64 shell with lots of features
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh
ii zstd 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- CLI tool ii zstd 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- CLI tool
rc libgnutls30:amd64 3.8.3-1ubuntu1 amd64 GNU TLS library - main runtime library
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description ||/ Name Version Architecture Description
Packages sorted by Installed-Size: Packages sorted by Installed-Size:
876372 ===== TOTAL (351 packages) 874046 ===== TOTAL (350 packages)
72249 gcc-13-x86-64-linux-gnu amd64 72249 gcc-13-x86-64-linux-gnu amd64
37841 g++-13-x86-64-linux-gnu amd64 37841 g++-13-x86-64-linux-gnu amd64
36493 cmake amd64 36493 cmake amd64
@ -405,7 +404,7 @@ Packages sorted by Installed-Size:
4879 libhwasan0 amd64 4879 libhwasan0 amd64
4341 ncurses-term all 4341 ncurses-term all
4244 minify amd64 4244 minify amd64
4104 apt amd64 4103 apt amd64
3983 gojq amd64 3983 gojq amd64
3956 python3-pycryptodome amd64 3956 python3-pycryptodome amd64
3949 libglib2.0-0t64 amd64 3949 libglib2.0-0t64 amd64
@ -420,7 +419,7 @@ Packages sorted by Installed-Size:
3403 libaria2-0 amd64 3403 libaria2-0 amd64
3382 fd-find amd64 3382 fd-find amd64
3349 libubsan1 amd64 3349 libubsan1 amd64
3240 libapt-pkg6.0 amd64 3244 libapt-pkg6.0t64 amd64
3157 libx32ubsan1 amd64 3157 libx32ubsan1 amd64
3111 ksh93u+m amd64 3111 ksh93u+m amd64
3110 libstdc++6 amd64 3110 libstdc++6 amd64
@ -435,7 +434,6 @@ Packages sorted by Installed-Size:
2419 passwd amd64 2419 passwd amd64
2348 libgnutls30t64 amd64 2348 libgnutls30t64 amd64
2346 libbinutils amd64 2346 libbinutils amd64
2336 libgnutls30 amd64
2191 ht amd64 2191 ht amd64
2182 libc-bin amd64 2182 libc-bin amd64
2161 git-man all 2161 git-man all
@ -536,8 +534,8 @@ Packages sorted by Installed-Size:
344 grep amd64 344 grep amd64
340 sed amd64 340 sed amd64
337 libhogweed6t64 amd64 337 libhogweed6t64 amd64
337 gpgv amd64
336 libncurses6 amd64 336 libncurses6 amd64
332 gpgv amd64
328 cpio amd64 328 cpio amd64
314 libudev1 amd64 314 libudev1 amd64
310 libctf-nobfd0 amd64 310 libctf-nobfd0 amd64
@ -680,9 +678,9 @@ Packages sorted by Installed-Size:
45 libatomic1 amd64 45 libatomic1 amd64
44 python3-zstd amd64 44 python3-zstd amd64
43 libx32atomic1 amd64 43 libx32atomic1 amd64
42 libnpth0t64 amd64
41 libxdmcp6 amd64 41 libxdmcp6 amd64
41 libkeyutils1 amd64 41 libkeyutils1 amd64
40 libnpth0 amd64
39 lib32atomic1 amd64 39 lib32atomic1 amd64
38 libdebconfclient0 amd64 38 libdebconfclient0 amd64
37 gcc amd64 37 gcc amd64

14
misc/scripts/readlink-fn.py Executable file
View File

@ -0,0 +1,14 @@
#! /usr/bin/env python3
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
# simulate "readlink -fn FILE" for systems that lack it (e.g. macOS-11)
# - result may differ from actual readlink(1) for edge cases
# - works with Python2 and Python3
#
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
import os, sys
if len(sys.argv) != 2:
sys.exit(1)
sys.stdout.write(os.path.realpath(sys.argv[1]))
sys.stdout.flush()

View File

@ -47,26 +47,32 @@ if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help
#*********************************************************************** #***********************************************************************
# see CMakeLists.txt # see CMakeLists.txt
#
# IDEA: create a Makefile and use "make -j" so that these tests can
# run in parallel much like "ctest --parallel 8"
#*********************************************************************** #***********************************************************************
set_on_off() { # similar to cmake function upx_cache_bool_vars()
set_cmake_bool_vars() {
local default_value="$1"; shift
local var_name local var_name
for var_name do for var_name do
case "${!var_name}" in case "${!var_name}" in
"" | "0" | "FALSE" | "OFF") eval $var_name=OFF ;; 0 | FALSE | OFF | false | off) eval "export $var_name=OFF" ;;
*) eval $var_name=ON ;; 1 | TRUE | ON | true | on) eval "export $var_name=ON" ;;
*) eval "export $var_name=$default_value" ;;
esac esac
done done
} }
set -x set -x
if [[ "${emu[0]}" == *valgrind* ]]; then true; # valgrind is SLOW if [[ "${emu[0]}" == *valgrind* ]]; then true; # valgrind is SLOW
[[ -n $UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST ]] || UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST=ON [[ -n $UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS ]] || UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON
fi fi
set_on_off UPX_CONFIG_DISABLE_SELF_PACK_TEST set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_SELF_PACK_TEST
set_on_off UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
set_on_off UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST
set_on_off UPX_CONFIG_DISABLE_RUN_PACKED_TEST set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_RUN_PACKED_TEST
export UPX="--prefer-ucl --no-color --no-progress" export UPX="--prefer-ucl --no-color --no-progress"
export UPX_DEBUG_DISABLE_GITREV_WARNING=1 export UPX_DEBUG_DISABLE_GITREV_WARNING=1
@ -121,11 +127,11 @@ cmp -s upx-unpacked${exe} upx-unpacked-nrv2d${exe}
cmp -s upx-unpacked${exe} upx-unpacked-nrv2e${exe} cmp -s upx-unpacked${exe} upx-unpacked-nrv2e${exe}
cmp -s upx-unpacked${exe} upx-unpacked-lzma${exe} cmp -s upx-unpacked${exe} upx-unpacked-lzma${exe}
if [[ $UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST == OFF ]]; then if [[ $UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST != ON ]]; then
"${emu[@]}" ./upx-unpacked${exe} --version-short "${emu[@]}" ./upx-unpacked${exe} --version-short
fi fi
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then
"${emu[@]}" ./upx-packed${exe} --version-short "${emu[@]}" ./upx-packed${exe} --version-short
"${emu[@]}" ./upx-packed-fa${exe} --version-short "${emu[@]}" ./upx-packed-fa${exe} --version-short
"${emu[@]}" ./upx-packed-fn${exe} --version-short "${emu[@]}" ./upx-packed-fn${exe} --version-short
@ -136,7 +142,7 @@ if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then
"${emu[@]}" ./upx-packed-lzma${exe} --version-short "${emu[@]}" ./upx-packed-lzma${exe} --version-short
fi fi
if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST == OFF ]]; then if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS != ON ]]; then
set +x set +x
for method in nrv2b nrv2d nrv2e lzma; do for method in nrv2b nrv2d nrv2e lzma; do
for level in 1 2 3 4 5 6 7; do for level in 1 2 3 4 5 6 7; do
@ -148,11 +154,12 @@ if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST == OFF ]]; then
"${run_upx[@]}" -qq -t upx-packed-${s}${exe} "${run_upx[@]}" -qq -t upx-packed-${s}${exe}
"${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe} "${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe}
cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe} cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe}
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then
"${emu[@]}" ./upx-packed-${s}${exe} --version-short "${emu[@]}" ./upx-packed-${s}${exe} --version-short
fi fi
done done
done done
fi fi
echo "run_upx='${run_upx[*]}'"
echo "All done." echo "All done."

View File

@ -31,7 +31,7 @@ build/debug+test build/release+test build/all+test: PHONY; $(MAKE) -C $(top_srcd
debug release all: PHONY; $(MAKE) -C $(top_srcdir) $@ debug release all: PHONY; $(MAKE) -C $(top_srcdir) $@
debug+test release+test all+test: PHONY; $(MAKE) -C $(top_srcdir) $@ debug+test release+test all+test: PHONY; $(MAKE) -C $(top_srcdir) $@
test:: build/all+test PHONY test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
#*********************************************************************** #***********************************************************************
# make run-testsuite # make run-testsuite