all: improve tests
This commit is contained in:
parent
35c6a200ad
commit
1d2b276425
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -17,8 +17,8 @@ env:
|
||||
UPX_CMAKE_CONFIG_FLAGS: -Wdev --warn-uninitialized
|
||||
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1
|
||||
UPX_DEBUG_TEST_LIBC_QSORT: 1
|
||||
# 2024-04-13
|
||||
ZIG_DIST_VERSION: 0.12.0-dev.3644+05d975576
|
||||
# 2024-04-14
|
||||
ZIG_DIST_VERSION: 0.12.0-dev.3653+e45bdc6bd
|
||||
|
||||
jobs:
|
||||
job-rebuild-and-verify-stubs:
|
||||
|
||||
@ -451,36 +451,44 @@ if(NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
||||
# use fast compression levels because
|
||||
# - we want to test UPX and not the compression libraries
|
||||
# - higher compression levels are somewhat slow in our automated QEMU/Valgrind CI tests
|
||||
upx_add_serial_test(upx-self-pack upx -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed${exe})
|
||||
upx_add_serial_test(upx-self-pack-n2b upx -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-n2b${exe})
|
||||
upx_add_serial_test(upx-self-pack-n2d upx -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-n2d${exe})
|
||||
upx_add_serial_test(upx-self-pack-n2e upx -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-n2e${exe})
|
||||
upx_add_serial_test(upx-self-pack-lzma upx -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-self-pack upx -3 "${upx_self_exe}" ${fo} -o upx-packed${exe})
|
||||
upx_add_serial_test(upx-self-pack-fa upx -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe})
|
||||
upx_add_serial_test(upx-self-pack-fn upx -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe})
|
||||
upx_add_serial_test(upx-self-pack-nrv2b upx -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-nrv2b${exe})
|
||||
upx_add_serial_test(upx-self-pack-nrv2d upx -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-nrv2d${exe})
|
||||
upx_add_serial_test(upx-self-pack-nrv2e upx -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-nrv2e${exe})
|
||||
upx_add_serial_test(upx-self-pack-lzma upx -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe})
|
||||
|
||||
upx_add_serial_test(upx-list upx -l upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-fileinfo upx --fileinfo upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-test upx -t upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-list upx -l upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-fileinfo upx --fileinfo upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||
upx_add_serial_test(upx-test upx -t upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||
|
||||
upx_add_serial_test(upx-unpack upx -d upx-packed${exe} ${fo} -o upx-unpacked${exe})
|
||||
upx_add_serial_test(upx-unpack-n2b upx -d upx-packed-n2b${exe} ${fo} -o upx-unpacked-n2b${exe})
|
||||
upx_add_serial_test(upx-unpack-n2d upx -d upx-packed-n2d${exe} ${fo} -o upx-unpacked-n2d${exe})
|
||||
upx_add_serial_test(upx-unpack-n2e upx -d upx-packed-n2e${exe} ${fo} -o upx-unpacked-n2e${exe})
|
||||
upx_add_serial_test(upx-unpack-lzma upx -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe})
|
||||
upx_add_serial_test(upx-unpack upx -d upx-packed${exe} ${fo} -o upx-unpacked${exe})
|
||||
upx_add_serial_test(upx-unpack-fa upx -d upx-packed-fa${exe} ${fo} -o upx-unpacked-fa${exe})
|
||||
upx_add_serial_test(upx-unpack-fn upx -d upx-packed-fn${exe} ${fo} -o upx-unpacked-fn${exe})
|
||||
upx_add_serial_test(upx-unpack-nrv2b upx -d upx-packed-nrv2b${exe} ${fo} -o upx-unpacked-nrv2b${exe})
|
||||
upx_add_serial_test(upx-unpack-nrv2d upx -d upx-packed-nrv2d${exe} ${fo} -o upx-unpacked-nrv2d${exe})
|
||||
upx_add_serial_test(upx-unpack-nrv2e upx -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe})
|
||||
upx_add_serial_test(upx-unpack-lzma upx -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe})
|
||||
|
||||
if(NOT UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST)
|
||||
upx_add_serial_test(upx-run-unpacked ${emu} ./upx-unpacked${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-n2b ${emu} ./upx-unpacked-n2b${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-n2d ${emu} ./upx-unpacked-n2d${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-n2e ${emu} ./upx-unpacked-n2e${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-lzma ${emu} ./upx-unpacked-lzma${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked ${emu} ./upx-unpacked${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-fa ${emu} ./upx-unpacked-fa${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-fn ${emu} ./upx-unpacked-fn${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-nrv2b ${emu} ./upx-unpacked-nrv2b${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-nrv2d ${emu} ./upx-unpacked-nrv2d${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-nrv2e ${emu} ./upx-unpacked-nrv2e${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-unpacked-lzma ${emu} ./upx-unpacked-lzma${exe} --version-short)
|
||||
endif()
|
||||
|
||||
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
|
||||
upx_add_serial_test(upx-run-packed ${emu} ./upx-packed${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-n2b ${emu} ./upx-packed-n2b${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-n2d ${emu} ./upx-packed-n2d${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-n2e ${emu} ./upx-packed-n2e${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-lzma ${emu} ./upx-packed-lzma${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed ${emu} ./upx-packed${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-fa ${emu} ./upx-packed-fa${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-fn ${emu} ./upx-packed-fn${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-nrv2b ${emu} ./upx-packed-nrv2b${exe} --version-short)
|
||||
upx_add_serial_test(upx-run-packed-nrv2d ${emu} ./upx-packed-nrv2d${exe} --version-short)
|
||||
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()
|
||||
endif() # UPX_CONFIG_DISABLE_SELF_PACK_TEST
|
||||
endif() # CMAKE_CROSSCOMPILING
|
||||
|
||||
@ -25,24 +25,24 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||
[[ -f $upx_exe ]] || exit 1
|
||||
upx_run=()
|
||||
# set emu and run_upx
|
||||
emu=()
|
||||
if [[ -n $upx_exe_runner ]]; then
|
||||
# usage examples:
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||
# export upx_exe_runner="wine"
|
||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
||||
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
fi
|
||||
upx_runner=( "${upx_run[@]}" )
|
||||
upx_run+=( "$upx_exe" )
|
||||
echo "upx_run='${upx_run[*]}'"
|
||||
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||
echo "run_upx='${run_upx[*]}'"
|
||||
|
||||
# upx_run sanity check
|
||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
# run_upx sanity check
|
||||
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
|
||||
#***********************************************************************
|
||||
# see CMakeLists.txt
|
||||
@ -65,11 +65,11 @@ set_on_off UPX_CONFIG_DISABLE_RUN_PACKED_TEST
|
||||
|
||||
export UPX="--no-color --no-progress"
|
||||
|
||||
"${upx_run[@]}" --version
|
||||
"${upx_run[@]}" --version-short
|
||||
"${upx_run[@]}" --help
|
||||
"${upx_run[@]}" --license
|
||||
"${upx_run[@]}" --sysinfo -v
|
||||
"${run_upx[@]}" --version
|
||||
"${run_upx[@]}" --version-short
|
||||
"${run_upx[@]}" --help
|
||||
"${run_upx[@]}" --license
|
||||
"${run_upx[@]}" --sysinfo -v
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_SELF_PACK_TEST == ON ]]; then
|
||||
echo "Self-pack test disabled. All done."; exit 0
|
||||
@ -79,36 +79,44 @@ exe=".out"
|
||||
upx_self_exe=$upx_exe
|
||||
fo="--force-overwrite"
|
||||
|
||||
"${upx_run[@]}" -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed${exe}
|
||||
"${upx_run[@]}" -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-n2b${exe}
|
||||
"${upx_run[@]}" -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-n2d${exe}
|
||||
"${upx_run[@]}" -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-n2e${exe}
|
||||
"${upx_run[@]}" -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe}
|
||||
"${run_upx[@]}" -3 "${upx_self_exe}" ${fo} -o upx-packed${exe}
|
||||
"${run_upx[@]}" -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe}
|
||||
"${run_upx[@]}" -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe}
|
||||
"${run_upx[@]}" -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-nrv2b${exe}
|
||||
"${run_upx[@]}" -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-nrv2d${exe}
|
||||
"${run_upx[@]}" -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-nrv2e${exe}
|
||||
"${run_upx[@]}" -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe}
|
||||
|
||||
"${upx_run[@]}" -l upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
||||
"${upx_run[@]}" --fileinfo upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
||||
"${upx_run[@]}" -t upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
||||
"${run_upx[@]}" -l upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||
"${run_upx[@]}" --fileinfo upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||
"${run_upx[@]}" -t upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||
|
||||
"${upx_run[@]}" -d upx-packed${exe} ${fo} -o upx-unpacked${exe}
|
||||
"${upx_run[@]}" -d upx-packed-n2b${exe} ${fo} -o upx-unpacked-n2b${exe}
|
||||
"${upx_run[@]}" -d upx-packed-n2d${exe} ${fo} -o upx-unpacked-n2d${exe}
|
||||
"${upx_run[@]}" -d upx-packed-n2e${exe} ${fo} -o upx-unpacked-n2e${exe}
|
||||
"${upx_run[@]}" -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe}
|
||||
"${run_upx[@]}" -d upx-packed${exe} ${fo} -o upx-unpacked${exe}
|
||||
"${run_upx[@]}" -d upx-packed-fa${exe} ${fo} -o upx-unpacked-fa${exe}
|
||||
"${run_upx[@]}" -d upx-packed-fn${exe} ${fo} -o upx-unpacked-fn${exe}
|
||||
"${run_upx[@]}" -d upx-packed-nrv2b${exe} ${fo} -o upx-unpacked-nrv2b${exe}
|
||||
"${run_upx[@]}" -d upx-packed-nrv2d${exe} ${fo} -o upx-unpacked-nrv2d${exe}
|
||||
"${run_upx[@]}" -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe}
|
||||
"${run_upx[@]}" -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe}
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST == OFF ]]; then
|
||||
"${upx_runner[@]}" ./upx-unpacked${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-unpacked-n2b${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-unpacked-n2d${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-unpacked-n2e${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-unpacked-lzma${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-fa${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-fn${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-nrv2b${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-nrv2d${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-nrv2e${exe} --version-short
|
||||
"${emu[@]}" ./upx-unpacked-lzma${exe} --version-short
|
||||
fi
|
||||
|
||||
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST == OFF ]]; then
|
||||
"${upx_runner[@]}" ./upx-packed${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-packed-n2b${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-packed-n2d${exe} --version-short
|
||||
"${upx_runner[@]}" ./upx-packed-n2e${exe} --version-short
|
||||
"${upx_runner[@]}" ./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-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
|
||||
|
||||
echo "All done."
|
||||
|
||||
@ -40,23 +40,24 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||
[[ -f $upx_exe ]] || exit 1
|
||||
upx_run=()
|
||||
# set emu and run_upx
|
||||
emu=()
|
||||
if [[ -n $upx_exe_runner ]]; then
|
||||
# usage examples:
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||
# export upx_exe_runner="wine"
|
||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
||||
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
fi
|
||||
upx_run+=( "$upx_exe" )
|
||||
echo "upx_run='${upx_run[*]}'"
|
||||
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||
echo "run_upx='${run_upx[*]}'"
|
||||
|
||||
# upx_run sanity check
|
||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
# run_upx sanity check
|
||||
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
|
||||
#***********************************************************************
|
||||
# util
|
||||
@ -203,57 +204,57 @@ mkdir default
|
||||
cd default
|
||||
create_files
|
||||
enter_dir z_dir_1
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_2
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_3
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_4
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
@ -266,57 +267,57 @@ mkdir force-overwrite
|
||||
cd force-overwrite
|
||||
create_files
|
||||
enter_dir z_dir_1
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
assert_file z_symlink_file z_symlink_file_link
|
||||
assert_file z_symlink_dir
|
||||
assert_file z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_2
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
assert_file z_symlink_file z_symlink_file_link
|
||||
assert_file z_symlink_dir
|
||||
assert_file z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_3
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_4
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
@ -330,57 +331,57 @@ mkdir link
|
||||
cd link
|
||||
create_files
|
||||
enter_dir z_dir_1
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
assert_file z_symlink_file z_symlink_file_link
|
||||
assert_file z_symlink_dir
|
||||
assert_file z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_2
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||
assert_file z_symlink_file z_symlink_file_link
|
||||
assert_file z_symlink_dir
|
||||
assert_file z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_3
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
leave_dir
|
||||
enter_dir z_dir_4
|
||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||
assert_symlink_to_dir z_symlink_dir
|
||||
assert_symlink_dangling z_symlink_dangling
|
||||
|
||||
@ -29,23 +29,24 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||
[[ -f $upx_exe ]] || exit 1
|
||||
upx_run=()
|
||||
# set emu and run_upx
|
||||
emu=()
|
||||
if [[ -n $upx_exe_runner ]]; then
|
||||
# usage examples:
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||
# export upx_exe_runner="wine"
|
||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
||||
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||
fi
|
||||
upx_run+=( "$upx_exe" )
|
||||
echo "upx_run='${upx_run[*]}'"
|
||||
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||
echo "run_upx='${run_upx[*]}'"
|
||||
|
||||
# upx_run sanity check, part1
|
||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
# run_upx sanity check, part1
|
||||
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
|
||||
# upx_testsuite_SRCDIR
|
||||
if [[ -z $upx_testsuite_SRCDIR ]]; then
|
||||
@ -78,15 +79,15 @@ upx_testsuite_BUILDDIR=$(readlink -fn "$upx_testsuite_BUILDDIR") # make absolute
|
||||
cd / && cd "$upx_testsuite_BUILDDIR" || exit 1
|
||||
: > ./.mfxnobackup
|
||||
|
||||
# upx_run sanity check, part2
|
||||
if ! "${upx_run[@]}" --version-short >/dev/null; then
|
||||
# run_upx sanity check, part2
|
||||
if ! "${run_upx[@]}" --version-short >/dev/null; then
|
||||
echo "UPX-ERROR: FATAL: upx --version-short FAILED"
|
||||
echo "please make sure that \$upx_exe contains ABSOLUTE file paths and can be run from any directory"
|
||||
echo "INFO: upx_run='${upx_run[*]}'"
|
||||
echo "INFO: run_upx='${run_upx[*]}'"
|
||||
exit 1
|
||||
fi
|
||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||
|
||||
case $UPX_TESTSUITE_LEVEL in
|
||||
[0-8]) ;;
|
||||
@ -121,11 +122,11 @@ cd testsuite_1 || exit 1
|
||||
run_upx() {
|
||||
local ec=0
|
||||
if [[ $UPX_TESTSUITE_VERBOSE == 1 ]]; then
|
||||
echo "LOG: '${upx_run[*]}' $*"
|
||||
echo "LOG: '${run_upx[*]}' $*"
|
||||
fi
|
||||
"${upx_run[@]}" "$@" || ec=$?
|
||||
"${run_upx[@]}" "$@" || ec=$?
|
||||
if [[ $ec != 0 ]]; then
|
||||
echo "FATAL: '${upx_run[*]}' $*"
|
||||
echo "FATAL: '${run_upx[*]}' $*"
|
||||
echo " (exit code was $ec)"
|
||||
exit 42
|
||||
fi
|
||||
@ -319,7 +320,7 @@ ls -l "$upx_exe"
|
||||
if command -v file >/dev/null; then
|
||||
file "$upx_exe" || true
|
||||
fi
|
||||
echo "upx_run='${upx_run[*]}'"
|
||||
echo "run_upx='${run_upx[*]}'"
|
||||
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
|
||||
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
|
||||
echo ".sha256sums.{expected,current} counts:"
|
||||
|
||||
@ -248,10 +248,21 @@ TEST_CASE("upx::ObjectDeleter 1") {
|
||||
LE16 *o = nullptr; // object
|
||||
LE32 *a = nullptr; // array
|
||||
{
|
||||
const upx::ObjectDeleter<LE16 **> o_deleter{&o, 1};
|
||||
upx::ObjectDeleter<LE16 **> o_deleter{&o, 1};
|
||||
o = new LE16;
|
||||
assert(o != nullptr);
|
||||
const upx::ArrayDeleter<LE32 **> a_deleter{&a, 1};
|
||||
upx::ArrayDeleter<LE32 **> a_deleter{&a, 1};
|
||||
a = New(LE32, 1);
|
||||
assert(a != nullptr);
|
||||
}
|
||||
assert(o == nullptr);
|
||||
assert(a == nullptr);
|
||||
// test "const" versions
|
||||
{
|
||||
const upx::ObjectDeleter<LE16 **const> o_deleter{&o, 1};
|
||||
o = new LE16;
|
||||
assert(o != nullptr);
|
||||
const upx::ArrayDeleter<LE32 **const> a_deleter{&a, 1};
|
||||
a = New(LE32, 1);
|
||||
assert(a != nullptr);
|
||||
}
|
||||
@ -355,6 +366,10 @@ struct TestTriBool {
|
||||
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
|
||||
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
||||
// broken compiler or broken ABI
|
||||
#elif __GNUC__ == 7 && defined(__i386__) && !defined(__clang__)
|
||||
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
|
||||
// gcc-7 "long long" enum align bug/ABI problem on i386
|
||||
static_assert(alignof(T) <= alignof(typename T::underlying_type));
|
||||
#else
|
||||
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
|
||||
static_assert(alignof(T) == alignof(typename T::underlying_type));
|
||||
|
||||
@ -195,7 +195,7 @@ void throwAssertFailed(const char *expr, const char *file, int line, const char
|
||||
}
|
||||
}
|
||||
|
||||
const char *prettyName(const char *n) noexcept {
|
||||
const char *prettyExceptionName(const char *n) noexcept {
|
||||
if (n == nullptr)
|
||||
return "(null)";
|
||||
while (*n) {
|
||||
|
||||
@ -178,7 +178,7 @@ public:
|
||||
// util
|
||||
**************************************************************************/
|
||||
|
||||
const char *prettyName(const char *n) noexcept;
|
||||
const char *prettyExceptionName(const char *n) noexcept;
|
||||
|
||||
noreturn void throwCantPack(const char *msg) may_throw;
|
||||
noreturn void throwCantPackExact() may_throw;
|
||||
|
||||
@ -102,7 +102,7 @@ void printErr(const char *iname, const Throwable &e) noexcept {
|
||||
char buf[1024];
|
||||
size_t l;
|
||||
|
||||
upx_safe_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(e).name()));
|
||||
upx_safe_snprintf(buf, sizeof(buf), "%s", prettyExceptionName(typeid(e).name()));
|
||||
l = strlen(buf);
|
||||
if (l < sizeof(buf) && e.getMsg())
|
||||
upx_safe_snprintf(buf + l, sizeof(buf) - l, ": %s", e.getMsg());
|
||||
@ -144,7 +144,7 @@ void printWarn(const char *iname, const char *format, ...) noexcept {
|
||||
|
||||
void printUnhandledException(const char *iname, const std::exception *e) noexcept {
|
||||
if (e != nullptr)
|
||||
printErr(iname, "unhandled exception: %s\n", prettyName(e->what()));
|
||||
printErr(iname, "unhandled exception: %s\n", prettyExceptionName(e->what()));
|
||||
else
|
||||
printErr(iname, "internal error: unhandled exception!\n");
|
||||
if (opt->cmd != CMD_COMPRESS) {
|
||||
|
||||
@ -512,10 +512,10 @@ void PeFile32::processRelocs() // pass1
|
||||
infoWarning("skipping unsupported relocation type %d (%d)", ic, counts[ic]);
|
||||
|
||||
LE32 *fix[4];
|
||||
upx::ArrayDeleter<LE32 **> fixdel{fix, 0}; // don't leak memory
|
||||
upx::ArrayDeleter<LE32 **const> fix_deleter{fix, 0}; // don't leak memory
|
||||
for (unsigned ic = 0; ic <= IMAGE_REL_BASED_HIGHLOW; ic++) {
|
||||
fix[ic] = New(LE32, counts[ic]);
|
||||
fixdel.count += 1;
|
||||
fix_deleter.count += 1;
|
||||
}
|
||||
|
||||
unsigned xcounts[4];
|
||||
@ -614,10 +614,10 @@ void PeFile64::processRelocs() // pass1
|
||||
infoWarning("skipping unsupported relocation type %d (%d)", ic, counts[ic]);
|
||||
|
||||
LE32 *fix[16];
|
||||
upx::ArrayDeleter<LE32 **> fixdel{fix, 0}; // don't leak memory
|
||||
upx::ArrayDeleter<LE32 **const> fix_deleter{fix, 0}; // don't leak memory
|
||||
for (unsigned ic = 0; ic < 16; ic++) {
|
||||
fix[ic] = New(LE32, counts[ic]);
|
||||
fixdel.count += 1;
|
||||
fix_deleter.count += 1;
|
||||
}
|
||||
|
||||
unsigned xcounts[16];
|
||||
@ -1924,7 +1924,7 @@ void PeFile::processResources(Resource *res) {
|
||||
SPAN_S_VAR(byte, ores, oresources + res->dirsize());
|
||||
|
||||
char *keep_icons = nullptr; // icon ids in the first icon group
|
||||
upx::ArrayDeleter<char **> keep_icons_deleter{&keep_icons, 1}; // don't leak memory
|
||||
upx::ArrayDeleter<char **const> keep_icons_deleter{&keep_icons, 1}; // don't leak memory
|
||||
unsigned iconsin1stdir = 0;
|
||||
if (opt->win32_pe.compress_icons == 2)
|
||||
while (res->next()) // there is no rewind() in Resource
|
||||
|
||||
@ -919,15 +919,15 @@ bool makebakname(char *ofilename, size_t size, const char *ifilename, bool force
|
||||
**************************************************************************/
|
||||
|
||||
unsigned get_ratio(upx_uint64_t u_len, upx_uint64_t c_len) {
|
||||
constexpr unsigned n = 1000 * 1000;
|
||||
constexpr unsigned N = 1000 * 1000;
|
||||
if (u_len == 0)
|
||||
return c_len == 0 ? 0 : n;
|
||||
upx_uint64_t x = c_len * n;
|
||||
assert(x / n == c_len);
|
||||
return c_len == 0 ? 0 : N;
|
||||
upx_uint64_t x = c_len * N;
|
||||
assert(x / N == c_len); // sanity check
|
||||
x /= u_len;
|
||||
x += 50; // rounding
|
||||
if (x >= 10 * n) // >= "1000%"
|
||||
x = 10 * n - 1;
|
||||
x += 50; // rounding; cannot overflow
|
||||
if (x >= 10 * N) // >= "1000%"
|
||||
x = 10 * N - 1;
|
||||
return ACC_ICONV(unsigned, x);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user