diff --git a/.github/travis_build.sh b/.github/travis_build.sh index 9ccdc10b..9d207fa6 100644 --- a/.github/travis_build.sh +++ b/.github/travis_build.sh @@ -6,9 +6,9 @@ set -e; set -o pipefail # Copyright (C) Markus Franz Xaver Johannes Oberhumer if [[ $TRAVIS_OS_NAME == osx ]]; then -argv0="$0"; argv0dir=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") else -argv0="$0"; argv0dir=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") fi source "$argv0dir/travis_init.sh" || exit 1 diff --git a/.github/travis_init.sh b/.github/travis_init.sh index 8b99cb82..d5038892 100644 --- a/.github/travis_init.sh +++ b/.github/travis_init.sh @@ -16,7 +16,7 @@ unset CROSS C B T [[ -z $BM_B ]] && BM_B=release # just in case, unset variable for passing extra UPX options -UPX= +export UPX= # compatibility wrappers if [[ $TRAVIS_OS_NAME == osx ]]; then @@ -35,7 +35,7 @@ sort() { } fi -# set CC and CXX from BM_C +# set CC and CXX from BM_C and BM_CROSS if [[ -z $CC_OVERRIDE ]]; then CC=false CXX=false SCAN_BUILD=false AR=ar SIZE=size @@ -102,6 +102,7 @@ esac if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then CC="$CC -std=gnu89" fi +unset v x export AR CC CXX fi # CC_OVERRIDE @@ -119,25 +120,25 @@ mkbuilddirs() { [[ -f "$d/.mfxnobackup" ]] || touch "$d/.mfxnobackup" done } -# search for an existing toptop builddir -for d in . ..; do - for subdir in "local" appveyor circle gitlab travis .; do - dd=$d/build/$subdir - if [[ -z $toptop_builddir && -d $dd ]]; then - toptop_builddir=$(readlink -en -- "$dd") - break 2 - fi +# search for an existing $toptop_builddir +if [[ -z $toptop_builddir ]]; then + for d in . ..; do + for subdir in "local" appveyor circle gitlab travis .; do + dd=$d/build/$subdir + if [[ -d $dd ]]; then + toptop_builddir=$(readlink -en -- "$dd") + break 2 + fi + done done -done -unset d subdir dd + unset d subdir dd +fi [[ -z $toptop_builddir ]] && toptop_builddir=$(readlink -mn -- ./build) [[ -z $toptop_bdir ]] && toptop_bdir=$(readlink -mn -- "$toptop_builddir/$BM_C/$BM_B") - [[ -z $upx_BUILDDIR ]] && upx_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx") [[ -z $ucl_BUILDDIR ]] && ucl_BUILDDIR=$(readlink -mn -- "$toptop_bdir/ucl-1.03") [[ -z $upx_testsuite_BUILDDIR ]] && upx_testsuite_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx-testsuite") [[ -z $zlib_BUILDDIR ]] && zlib_BUILDDIR=$(readlink -mn -- "$toptop_bdir/zlib-1.2.8") - [[ -z $lcov_OUTPUTDIR ]] && lcov_OUTPUTDIR=$(readlink -mn -- "$toptop_bdir/.lcov-results") unset toptop_builddir toptop_bdir diff --git a/.github/travis_testsuite_1.sh b/.github/travis_testsuite_1.sh index 81c0966b..df9cb9e1 100644 --- a/.github/travis_testsuite_1.sh +++ b/.github/travis_testsuite_1.sh @@ -10,9 +10,9 @@ set -e; set -o pipefail # if [[ $TRAVIS_OS_NAME == osx ]]; then -argv0="$0"; argv0dir=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") else -argv0="$0"; argv0dir=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") fi source "$argv0dir/travis_init.sh" || exit 1 @@ -53,10 +53,11 @@ testsuite_check_sha() { echo cat $1/.sha256sums.current if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then - echo "UPX-ERROR: checksum mismatch" + echo "UPX-ERROR: $1 FAILED: checksum mismatch" diff -u $1/.sha256sums.expected $1/.sha256sums.current || true exit_code=1 let num_errors+=1 || true + all_errors="${all_errors} $1" #exit 1 fi echo @@ -66,18 +67,25 @@ testsuite_check_sha_decompressed() { (cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then cat $1/.sha256sums.current - echo "UPX-ERROR: decompressed checksum mismatch" + echo "UPX-ERROR: FATAL: $1 FAILED: decompressed checksum mismatch" diff -u $1/.sha256sums.expected $1/.sha256sums.current || true exit 1 fi } +testsuite_use_canonicalized=0 testsuite_run_compress() { testsuite_header $testdir - local f - for f in t01_canonicalized/*/*; do + local files f + if [[ $testsuite_use_canonicalized == 1 ]]; then + files=t01_canonicalized/*/* + else + files=t01_decompressed/*/* + fi + for f in $files; do testsuite_split_f $f [[ -z $fb ]] && continue + echo "# $f" mkdir -p $testdir/$fsubdir $testdir/.decompressed/$fsubdir $upx_run --prefer-ucl "$@" $f -o $testdir/$fsubdir/$fb $upx_run -qq -d $testdir/$fsubdir/$fb -o $testdir/.decompressed/$fsubdir/$fb @@ -86,10 +94,12 @@ testsuite_run_compress() { $upx_run -l $testdir/*/* $upx_run --file-info $testdir/*/* $upx_run -t $testdir/*/* - # check that after decompression the file matches the canonicalized version - cp t01_canonicalized/.sha256sums.expected $testdir/.decompressed/ - testsuite_check_sha_decompressed $testdir/.decompressed - rm -rf ./$testdir/.decompressed + if [[ $testsuite_use_canonicalized == 1 ]]; then + # check that after decompression the file matches the canonicalized version + cp t01_canonicalized/.sha256sums.expected $testdir/.decompressed/ + testsuite_check_sha_decompressed $testdir/.decompressed + rm -rf ./$testdir/.decompressed + fi } # /*********************************************************************** @@ -99,6 +109,7 @@ testsuite_run_compress() { #set -x # debug exit_code=0 num_errors=0 +all_errors= if [[ $BM_T =~ (^|\+)ALLOW_FAIL($|\+) ]]; then echo "ALLOW_FAIL" @@ -134,7 +145,10 @@ fi export UPX="--prefer-ucl --no-color --no-progress" # let's go -if ! $upx_run --version >/dev/null; then exit 1; fi +if ! $upx_run --version; then + echo "UPX-ERROR: FATAL: upx --version FAILED" + exit 1; +fi rm -rf ./testsuite_1 mkbuilddirs testsuite_1 cd testsuite_1 || exit 1 @@ -298,6 +312,8 @@ time testsuite_run_compress --all-methods --no-lzma -5 --no-filter testsuite_header "UPX testsuite summary" +$upx_run --version || echo "UPX-ERROR: upx --version FAILED" +echo echo "upx_exe='$upx_exe'" if [[ $upx_run != $upx_exe ]]; then echo "upx_run='$upx_run'" @@ -315,6 +331,7 @@ echo if [[ $exit_code == 0 ]]; then echo "UPX testsuite passed. All done." else + echo "UPX-ERROR: UPX testsuite FAILED:${all_errors}" echo "UPX-ERROR: UPX testsuite FAILED with $num_errors error(s). See log file." fi exit $exit_code