mirror of
https://github.com/upx/upx.git
synced 2024-11-23 04:39:59 +00:00
all: enhance tests
This commit is contained in:
parent
265c100845
commit
a7592b2ca2
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -162,6 +162,7 @@ jobs:
|
||||
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/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
|
||||
@ -173,6 +174,7 @@ jobs:
|
||||
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
|
||||
@ -597,5 +599,6 @@ jobs:
|
||||
apk add coreutils valgrind
|
||||
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"
|
||||
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST=ON # valgrind is SLOW
|
||||
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/debug bash "$PWD"/misc/testsuite/mimic_ctest.sh
|
||||
env -C build/zig/${ZIG_TARGET}${ZIG_PIC}/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
|
||||
|
@ -52,7 +52,8 @@ endif()
|
||||
|
||||
# test config options (see below)
|
||||
# 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)
|
||||
|
||||
#***********************************************************************
|
||||
# init
|
||||
@ -501,6 +502,24 @@ if(NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
||||
upx_add_serial_test(upx-run-packed-nrv2e ${emu} ./upx-packed-nrv2e${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-lzma ${emu} ./upx-packed-lzma${exe} --version-short)
|
||||
endif()
|
||||
|
||||
# TODO later: check if we can somehow run these tests in parallel groups
|
||||
if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST)
|
||||
foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma)
|
||||
foreach(level IN ITEMS 1 2 3 4 5 6 7 )
|
||||
set(s "${method}-${level}")
|
||||
upx_add_serial_test(upx-self-pack-${s} upx --${method} -${level} --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe})
|
||||
upx_add_serial_test(upx-list-${s} upx -l upx-packed-${s}${exe})
|
||||
upx_add_serial_test(upx-fileinfo-${s} upx --fileinfo upx-packed-${s}${exe})
|
||||
upx_add_serial_test(upx-test-${s} upx -t upx-packed-${s}${exe})
|
||||
upx_add_serial_test(upx-unpack-pack-${s} upx -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe})
|
||||
upx_add_serial_test(upx-compare-${s} "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-${s}${exe})
|
||||
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
|
||||
upx_add_serial_test(upx-run-packed-${s} ${emu} ./upx-packed-${s}${exe} --version-short)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif () # UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST
|
||||
endif() # UPX_CONFIG_DISABLE_SELF_PACK_TEST
|
||||
endif() # CMAKE_CROSSCOMPILING
|
||||
|
||||
|
@ -310,6 +310,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_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_EXHAUSTIVE_TEST)
|
||||
# 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_UCL)
|
||||
|
@ -61,10 +61,13 @@ set_on_off() {
|
||||
|
||||
set -x
|
||||
set_on_off UPX_CONFIG_DISABLE_SELF_PACK_TEST
|
||||
set_on_off UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST
|
||||
set_on_off UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST
|
||||
set_on_off UPX_CONFIG_DISABLE_RUN_PACKED_TEST
|
||||
|
||||
export UPX="--no-color --no-progress"
|
||||
export UPX="--prefer-ucl --no-color --no-progress"
|
||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||
|
||||
"${run_upx[@]}" --version
|
||||
"${run_upx[@]}" --version-short
|
||||
@ -116,18 +119,37 @@ cmp -s upx-unpacked${exe} upx-unpacked-nrv2e${exe}
|
||||
cmp -s upx-unpacked${exe} upx-unpacked-lzma${exe}
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST == OFF ]]; then
|
||||
"${emu[@]}" ./upx-unpacked${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked${exe} --version-short
|
||||
fi
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then
|
||||
"${emu[@]}" ./upx-packed${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fa${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fn${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fr${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2b${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2d${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2e${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-lzma${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fa${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fn${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-fr${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2b${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2d${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-nrv2e${exe} --version-short
|
||||
"${emu[@]}" ./upx-packed-lzma${exe} --version-short
|
||||
fi
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TEST == OFF ]]; then
|
||||
set +x
|
||||
for method in nrv2b nrv2d nrv2e lzma; do
|
||||
for level in 1 2 3 4 5 6 7; do
|
||||
s="${method}-${level}"
|
||||
echo "========== $s =========="
|
||||
"${run_upx[@]}" -qq --${method} -${level} --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe}
|
||||
"${run_upx[@]}" -qq -l upx-packed-${s}${exe}
|
||||
"${run_upx[@]}" -qq --fileinfo 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}
|
||||
cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe}
|
||||
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then
|
||||
"${emu[@]}" ./upx-packed-${s}${exe} --version-short
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
echo "All done."
|
||||
|
@ -170,8 +170,7 @@ create_files() {
|
||||
|
||||
export UPX="--prefer-ucl --no-color --no-progress"
|
||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||
export UPX_DEBUG_DOCTEST_VERBOSE=0
|
||||
export NO_COLOR=1
|
||||
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||
|
||||
testsuite_header() {
|
||||
local x='==========='; x="$x$x$x$x$x$x$x"
|
||||
|
@ -99,7 +99,7 @@ all_errors=
|
||||
|
||||
export UPX="--prefer-ucl --no-color --no-progress"
|
||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||
export UPX_DEBUG_DOCTEST_VERBOSE=0
|
||||
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||
|
||||
case $UPX_TESTSUITE_LEVEL in
|
||||
[0-8]) ;;
|
||||
|
@ -60,8 +60,6 @@ void Packer::assertPacker() const {
|
||||
// info: 36 is the limit for show_all_packers() in help.cpp, but 32 should be enough for now
|
||||
assert(strlen(getFullName(nullptr)) <= 32);
|
||||
assert(strlen(getFullName(opt)) <= 32);
|
||||
assert(getCompressionMethods(M_ALL, 10) != nullptr);
|
||||
(void) getFilters();
|
||||
if (bele == nullptr)
|
||||
fprintf(stderr, "%s\n", getName());
|
||||
assert(bele != nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user