From 3534ed21d7d8e87789f9b888cb2306eafad5fa78 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sat, 1 Oct 2016 00:58:03 +0200 Subject: [PATCH] Update Travis and AppVeyor. --- .appveyor.yml | 33 +++-- .circle.yml | 9 +- .github/travis_build.sh | 88 ++++++++----- .github/travis_init.sh | 227 +++++++++++++++++++++++++--------- .github/travis_testsuite_1.sh | 106 +++++++++------- .travis.yml | 24 +++- 6 files changed, 338 insertions(+), 149 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e2ac9a35..441a7238 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,7 +4,7 @@ os: Visual Studio 2015 environment: - global: { C: "", B: release, ALLOW_FAIL: "", TRAVIS_OS_NAME: windows } + global: { TRAVIS_OS_NAME: windows, C: "", B: release, CROSS: "", T: "" } matrix: - { C: msvc-10.0-x86, CL_VERSION: 16.00, VS_VERSION: 2010 } ### - { C: msvc-10.0-x64, CL_VERSION: 16.00, VS_VERSION: 2010 } # AppVeyor: x64 compiler is not installed @@ -14,9 +14,16 @@ environment: - { C: msvc-12.0-x64, CL_VERSION: 18.00, VS_VERSION: 2013 } - { C: msvc-14.0-x86, CL_VERSION: 19.00, VS_VERSION: 2015 } - { C: msvc-14.0-x64, CL_VERSION: 19.00, VS_VERSION: 2015 } +# - { C: gcc-4.9-m32, T: SKIP } +# - { C: gcc-4.9-m64, T: SKIP } init: - git config --global core.autocrlf input + - where bash & where cat & where curl & where git & where sed & where tar +# - dir "c:\Program Files\Git\usr\bin" +# - dir "c:\cygwin\bin" +# - dir "c:\mingw\bin" +# - dir "c:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin" install: - cd c:\projects @@ -24,13 +31,17 @@ install: - cd c:\projects\upx - git submodule update --init --recursive - cd c:\projects\deps - - appveyor DownloadFile "https://github.com/upx/upx/files/499379/ucl-1.03.tar.gz" - - appveyor DownloadFile "https://github.com/upx/upx/files/499381/zlib-1.2.8.tar.gz" + - curl -q -L --retry 5 -o ucl-1.03.tar.gz "https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.gz" + - curl -q -L --retry 5 -o zlib-1.2.8.tar.gz "https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.gz" + - git clone https://github.com/upx/upx-testsuite - tar -xzf ucl-1.03.tar.gz + - tar -xzf zlib-1.2.8.tar.gz # patch UCL for msvc-14.0 (vsnprintf issue) - sed -i '/# *define.*snprintf *_v*snprintf$/d' ucl-1.03/acc/acc_auto.h - - tar -xzf zlib-1.2.8.tar.gz - - git clone https://github.com/upx/upx-testsuite +##- curl -q -L --retry 5 -o config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" +##- curl -q -L --retry 5 -o config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" +##- cp config.guess config.sub ucl-1.03/acconfig/ + # setup compiler - if "%C%"=="msvc-10.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 ) - if "%C%"=="msvc-10.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 ) - if "%C%"=="msvc-11.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 ) @@ -41,9 +52,15 @@ install: - if "%C%"=="msvc-14.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 ) build_script: - # setup directories following the VPATH build in travis_build.sh - cd c:\projects\upx -##- if "%C%"=="gcc-m64" ( bash -x ./.github/travis_build.sh && exit 0 ) # TODO + - if "%C%"=="gcc-4.9-m32" set PATH=c:\cygwin\bin;%PATH% + - if "%C%"=="gcc-4.9-m32" bash -x ./.github/travis_build.sh + - if "%C%"=="gcc-4.9-m32" exit + - if "%C%"=="gcc-4.9-m64" set PATH=c:\cygwin\bin;%PATH% + - if "%C%"=="gcc-4.9-m64" bash -x ./.github/travis_build.sh + - if "%C%"=="gcc-4.9-m64" exit + # setup directories following the VPATH build in travis_build.sh + - where cl & where link - set BDIR=c:\projects\build\%C%\%B% - md %BDIR% %BDIR%\ucl-1.03 %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib-1.2.8 - set DEFS=-D_CRT_SECURE_NO_WARNINGS @@ -74,7 +91,7 @@ test_script: - .\upx.exe -l upx_packed.exe - .\upx.exe -t upx_packed.exe - .\upx_packed.exe --version - # now run the UPX testsuite using Cygwin bash - this really works! + # now run the UPX testsuite using bash - cd c:\projects\upx - bash ./.github/travis_testsuite_1.sh diff --git a/.circle.yml b/.circle.yml index 86d66d29..f955457d 100644 --- a/.circle.yml +++ b/.circle.yml @@ -3,15 +3,16 @@ branches: only: - - circle - devel + - travis machine: environment: TRAVIS_OS_NAME: linux C: gcc-4.8-m64 B: release - ALLOW_FAIL: + CROSS: + T: checkout: post: @@ -20,9 +21,11 @@ checkout: dependencies: pre: - mkdir -p ../deps - - cd ../deps && wget -q -O - https://github.com/upx/upx/files/499379/ucl-1.03.tar.gz | tar -xz + - cd ../deps && wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -xJ + - cd ../deps && wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -xJ - cd ../deps && git clone https://github.com/upx/upx-testsuite override: + - mkdir -p ../build/travis - bash ./.github/travis_build.sh test: diff --git a/.github/travis_build.sh b/.github/travis_build.sh index b608e255..0a591284 100644 --- a/.github/travis_build.sh +++ b/.github/travis_build.sh @@ -5,26 +5,28 @@ set -e; set -o pipefail # Support for Travis CI -- https://travis-ci.org/upx/upx/builds # Copyright (C) Markus Franz Xaver Johannes Oberhumer -source ./.github/travis_init.sh || exit 1 +if [[ $TRAVIS_OS_NAME == osx ]]; then +argv0="$0"; argv0dir=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +else +argv0="$0"; argv0dir=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +fi +source "$argv0dir/travis_init.sh" || exit 1 -echo "B='$B'" -echo "UPX_UCLDIR='$UPX_UCLDIR'" -echo "CC='$CC'" -echo "CXX='$CXX'" -echo "CPPFLAGS='$CPPFLAGS'" -echo "CFLAGS='$CFLAGS'" -echo "CXXFLAGS='$CXXFLAGS'" -echo "LDFLAGS='$LDFLAGS'" -echo "LIBS='$LIBS'" -echo "SCAN_BUILD='$SCAN_BUILD'" -##env | LC_ALL=C sort +# create dirs +cd / || exit 1 +mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR +cd / && cd $upx_SRCDIR || exit 1 +echo +print_settings +echo echo "$CC --version"; $CC --version echo "$CXX --version"; $CXX --version +echo # whitespace if [[ $TRAVIS_OS_NAME == linux ]]; then -cd $upx_SRCDIR || exit 1 +cd / && cd $upx_SRCDIR || exit 1 echo "Checking source code for whitespace violations..." find . \ -type d -name '.git' -prune -o \ @@ -45,13 +47,13 @@ xargs -0r perl -n -e ' } if (m,\t,) { if ($ARGV =~ m,(^|/)\.gitmodules$,) { } - elsif ($ARGV =~ m,(^|/)m?make(file|vars),i) { } + elsif ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { } elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { } elsif ($ARGV =~ m,/src/stub/src/arch/.*\.S$,) { } else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); } } ' || exit 1 -echo " Done." +echo " Passed." fi # linux set -x @@ -60,47 +62,73 @@ set -x # build UCL # -cd $ucl_BUILDDIR || exit 1 -if [[ ! -f config.status ]]; then -$ucl_SRCDIR/configure --enable-static --disable-shared --disable-asm +cd / && cd $ucl_BUILDDIR || exit 1 +if [[ -n $BM_CROSS || $TRAVIS_OS_NAME == windows ]]; then + # configure is too old + rm -f ./*.o libucl.a + $CC -O2 -I$ucl_SRCDIR/include -I$ucl_SRCDIR -c $ucl_SRCDIR/src/*.c + $AR rcs libucl.a *.o + mkdir -p src/.libs + cp libucl.a src/.libs +else + if [[ ! -f config.status ]]; then + $ucl_SRCDIR/configure --enable-static --disable-shared --disable-asm + fi + make fi -make + +# +# build zlib +# + +if [[ $BUILD_LOCAL_ZLIB ]]; then + cd / && cd $zlib_BUILDDIR || exit 1 + rm -f ./*.o libz.a + $CC -O2 -c $zlib_SRCDIR/*.c + $AR rcs libz.a *.o +fi # BUILD_LOCAL_ZLIB # # build UPX # -cd $upx_BUILDDIR || exit 1 +export UPX_UCLDIR="$ucl_SRCDIR" +cd / && cd $upx_BUILDDIR || exit 1 make="make -f $upx_SRCDIR/src/Makefile" EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DUCL_NO_ASM" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs" -if [[ $B =~ (^|\+)coverage($|\+) ]]; then +if [[ $BUILD_LOCAL_ZLIB ]]; then + EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -I$zlib_SRCDIR" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$zlib_BUILDDIR" +fi +if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fprofile-arcs -ftest-coverage" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage" fi -if [[ $B =~ (^|\+)debug($|\+) ]]; then +if [[ $BM_B =~ (^|\+)debug($|\+) ]]; then make="$make BUILD_TYPE_DEBUG=1" fi -if [[ $B =~ (^|\+)sanitize($|\+) ]]; then +if [[ $BM_B =~ (^|\+)sanitize($|\+) ]]; then case $TRAVIS_OS_NAME-$CC in linux-gcc*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fuse-ld=gold" ;; esac make="$make BUILD_TYPE_SANITIZE=1" fi -if [[ $B =~ (^|\+)scan-build($|\+) ]]; then +if [[ $BM_B =~ (^|\+)scan-build($|\+) ]]; then make="$SCAN_BUILD $make" fi -if [[ $B =~ (^|\+)valgrind($|\+) ]]; then +if [[ $BM_B =~ (^|\+)valgrind($|\+) ]]; then EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DWITH_VALGRIND" fi -if [[ $ALLOW_FAIL == 1 ]]; then - echo "ALLOW_FAIL=$ALLOW_FAIL" +if [[ $BM_B =~ (^|\+)ALLOW_FAIL($|\+) ]]; then + echo "ALLOW_FAIL" set +e fi export EXTRA_CPPFLAGS EXTRA_CXXFLAGS EXTRA_LDFLAGS $make -ls -l upx.out -size upx.out -file upx.out +[[ -z $exeext ]] && exeext=.out +ls -l upx${exeext} +$SIZE upx${exeext} || true +file upx${exeext} exit 0 diff --git a/.github/travis_init.sh b/.github/travis_init.sh index 3c27f71d..00bd4d16 100644 --- a/.github/travis_init.sh +++ b/.github/travis_init.sh @@ -6,71 +6,178 @@ #set -x # debug umask 022 -# just in case +# rename short Build-Matrix variables to more readable names +# C is COMPILER +# B is BUILD_TYPE +# T is TESTSUITE_FLAGS +BM_C=$C; BM_B=$B; BM_CROSS=$CROSS; BM_T=$T +unset C B CROSS T +[[ -z $BM_C ]] && BM_C=gcc +[[ -z $BM_B ]] && BM_B=release + +# just in case, unset variable for passing extra UPX options UPX= -# set CC and CXX from C -[[ -z $C ]] && C=gcc -if [[ -z $CC_OVERRIDE ]]; then -CC=false CXX=false SCAN_BUILD=false -case $C in - clang | clang-m?? | clang-3.4-m?? | clang-[678][0-9][0-9]-m??) - CC="clang"; CXX="clang++" ;; # standard system compiler - clang-[34].[0-9]-m??) - v=${C:6:3}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;; - gcc | gcc-m??) - CC="gcc"; CXX="g++" ;; # standard system compiler - gcc-[34].[0-9]-m??) - v=${C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;; - gcc-[56]-m?? | gcc-[56].[0-9]-m??) - v=${C:4:1}; CC="gcc-$v"; CXX="g++-$v" ;; - msvc | msvc-*) - CC="cl"; CXX="cl" ;; # standard system compiler -esac -case $C in - msvc*) ;; - clang*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;; - gcc*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;; -esac -case $C in - clang* | gcc*) CC="$CC -std=gnu89" ;; -esac -export CC CXX -fi # CC_OVERRIDE - -# B is BUILD_TYPE -[[ -z $B ]] && B=release - -# dirs -[[ -z $upx_SRCDIR ]] && upx_SRCDIR="$PWD" -[[ -z $ucl_SRCDIR ]] && ucl_SRCDIR="$PWD/../deps/ucl-1.03" -[[ -z $upx_testsuite_SRCDIR ]] && upx_testsuite_SRCDIR="$PWD/../deps/upx-testsuite" - -[[ -z $tmake_top_builddir ]] && tmake_top_builddir="$PWD/../build" -[[ -z $tmake_top_bdir ]] && tmake_top_bdir="$tmake_top_builddir/$C/$B" -upx_BUILDDIR="$tmake_top_bdir/upx" -ucl_BUILDDIR="$tmake_top_bdir/ucl-1.03" -upx_testsuite_BUILDDIR="$tmake_top_bdir/upx-testsuite" -# tools -lcov_OUTPUTDIR="$tmake_top_bdir/.lcov-results" - -mkdir -p -v $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR -[[ -d $tmake_top_bdir/.mfxnobackup ]] && echo "timestamp" > $tmake_top_bdir/.mfxnobackup - -export UPX_UCLDIR="$ucl_SRCDIR" - -# check dirs -cd / && cd $ucl_BUILDDIR || exit 1 -cd / && cd $ucl_SRCDIR || exit 1 -cd / && cd $upx_testsuite_BUILDDIR || exit 1 -cd / && cd $upx_testsuite_SRCDIR || exit 1 -cd / && cd $upx_BUILDDIR || exit 1 -# enter srcdir -cd / && cd $upx_SRCDIR || exit 1 - +# compatibility wrappers +if [[ $TRAVIS_OS_NAME == osx ]]; then +# use GNU coreutils ("brew install coreutils") +readlink() { + greadlink "$@" +} +sha256sum() { + gsha256sum "$@" +} +fi if [[ -n $APPVEYOR_JOB_ID ]]; then # for some reason this is needed for bash on AppVeyor sort() { /usr/bin/sort "$@" } fi + +# set CC and CXX from BM_C +if [[ -z $CC_OVERRIDE ]]; then +CC=false CXX=false SCAN_BUILD=false +AR=ar SIZE=size +if [[ -n $APPVEYOR_JOB_ID ]]; then + BUILD_LOCAL_ZLIB=1 + export exeext=.exe + # dir c:\cygwin + case $BM_C in + gcc-m32 | gcc-4.9-m32) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;; + gcc-m64 | gcc-4.9-m64) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;; + msvc | msvc-*) + AR="link -lib"; CC="cl"; CXX="cl" ;; # standard system compiler + esac +fi # APPVEYOR_JOB_ID +if [[ -n $CIRCLE_BUILD_NUM ]]; then + case $BM_C in + gcc | gcc-m??) + CC="gcc"; CXX="g++" ;; # standard system compiler + gcc-[34].[0-9]-m??) + v=${BM_C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;; + esac +fi # $CIRCLE_BUILD_NUM +if [[ -n $TRAVIS_JOB_ID ]]; then +if [[ -n $BM_CROSS ]]; then + BUILD_LOCAL_ZLIB=1 + case $BM_CROSS-$BM_C in + arm-linux-gnueabi-gcc | arm-linux-gnueabi-gcc-4.6) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + [[ -z $upx_qemu ]] && upx_qemu="qemu-arm-static -L/usr/arm-linux-gnueabi" + x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;; + arm-linux-gnueabihf-gcc | arm-linux-gnueabihf-gcc-4.6) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + [[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L/usr/arm-linux-gnueabihf" + x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;; + i[36]86-w64-mingw32-gcc | i[36]86-w64-mingw32-gcc-4.6) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + [[ -z $upx_wine ]] && upx_wine="wine" + x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;; + x86_64-w64-mingw32-gcc | x86_64-w64-mingw32-gcc-4.6) + export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++" + [[ -z $upx_wine ]] && upx_wine="wine" + x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;; + esac +fi +fi # TRAVIS_JOB_ID +if [[ "$CC" == "false" ]]; then # generic +if [[ -z $BM_CROSS ]]; then + case $BM_C in + clang | clang-m?? | clang-3.4-m?? | clang-[678][0-9][0-9]-m??) + CC="clang"; CXX="clang++" ;; # standard system compiler + clang-[34].[0-9]-m??) + v=${BM_C:6:3}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;; + gcc | gcc-m??) + CC="gcc"; CXX="g++" ;; # standard system compiler + gcc-[34].[0-9]-m??) + v=${BM_C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;; + gcc-[56]-m?? | gcc-[56].[0-9]-m??) + v=${BM_C:4:1}; CC="gcc-$v"; CXX="g++-$v" ;; + esac +fi +fi # generic +case $BM_C in + clang*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;; + clang*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;; + gcc*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;; + gcc*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;; +esac +case $BM_C in + clang* | gcc*) CC="$CC -std=gnu89" ;; +esac +export AR CC CXX +fi # CC_OVERRIDE + +# source dirs +[[ -z $upx_SRCDIR ]] && upx_SRCDIR=$(readlink -mn -- $argv0dir/..) +[[ -z $ucl_SRCDIR ]] && ucl_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/ucl-1.03) +[[ -z $upx_testsuite_SRCDIR ]] && upx_testsuite_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/upx-testsuite) +[[ -z $zlib_SRCDIR ]] && zlib_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/zlib-1.2.8) + +# build dirs +mkbuilddirs() { + local d + for d in "$@"; do + mkdir -p -v "$d" || exit 1 + [[ -f "$d/.mfxnobackup" ]] || touch "$d/.mfxnobackup" + done +} +# search for an existing toptop builddir +for d in ./build/travis ./build ../build/travis ../build; do + [[ -z $toptop_builddir && -d $d ]] && toptop_builddir=$(readlink -mn -- "$d") +done +[[ -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 + +# ensure absolute dirs +for var_prefix in ucl upx upx_testsuite zlib; do +for var_suffix in _BUILDDIR _SRCDIR; do + var_name=${var_prefix}${var_suffix} + if [[ -n ${!var_name} ]]; then + d=$(readlink -mn -- "${!var_name}") + eval $var_name="$d" + fi +done +done +unset var_name var_prefix var_suffix + +print_settings() { + local v var_prefix var_suffix + # Build Matrix + for v in TRAVIS_OS_NAME BM_C BM_B BM_CROSS BM_T; do + [[ -n ${!v} ]] && echo "${v}='${!v}'" + done + # BM_C related + for v in AR CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LIBS SCAN_BUILD; do + [[ -n ${!v} ]] && echo "${v}='${!v}'" + v=EXTRA_${v} + [[ -n ${!v} ]] && echo "${v}='${!v}'" + done + # dirs and other info + for v in TRAVIS_XCODE_SDK UPX_UCLDIR; do + [[ -n ${!v} ]] && echo "${v}='${!v}'" + done + for var_prefix in ucl upx upx_testsuite zlib; do + for var_suffix in _BUILDDIR _SRCDIR; do + v=${var_prefix}${var_suffix} + [[ -n ${!v} ]] && echo "${v}='${!v}'" + done + done + ##env | LC_ALL=C sort +} + + +true diff --git a/.github/travis_testsuite_1.sh b/.github/travis_testsuite_1.sh index c064c8b6..3695f8bb 100644 --- a/.github/travis_testsuite_1.sh +++ b/.github/travis_testsuite_1.sh @@ -5,13 +5,30 @@ set -e; set -o pipefail # Support for Travis CI -- https://travis-ci.org/upx/upx/builds # Copyright (C) Markus Franz Xaver Johannes Oberhumer -source ./.github/travis_init.sh || exit 1 - - # # very first version of the upx-testsuite # +if [[ $TRAVIS_OS_NAME == osx ]]; then +argv0="$0"; argv0dir=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +else +argv0="$0"; argv0dir=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0dir") +fi +source "$argv0dir/travis_init.sh" || exit 1 + +# BM_T is TESTSUITE_FLAGS +if [[ $BM_T =~ (^|\+)SKIP($|\+) ]]; then + echo "UPX testsuite SKIPPED." + exit 0 +fi +[[ -f $upx_exe ]] && upx_exe=$(readlink -en -- "$upx_exe") + +# create dirs +cd / || exit 1 +mkbuilddirs $upx_testsuite_BUILDDIR +cd / && cd $upx_testsuite_BUILDDIR || exit 1 +if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi + # /*********************************************************************** # // support functions @@ -33,7 +50,7 @@ testsuite_split_f() { } testsuite_check_sha() { - (cd "$1" && $sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current + (cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current echo cat $1/.sha256sums.current if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then @@ -46,19 +63,19 @@ testsuite_check_sha() { } testsuite_run_compress() { - testsuite_header $t + testsuite_header $testdir local f ff for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do testsuite_split_f $f [[ -z $fb ]] && continue - mkdir -p $t/$fsubdir + mkdir -p $testdir/$fsubdir ff=t01_decompressed/$fsubdir/$fb - $upx_exe --prefer-ucl "$@" $ff -o $t/$fsubdir/$fb + $upx_exe --prefer-ucl "$@" $ff -o $testdir/$fsubdir/$fb done - testsuite_check_sha $t - $upx_exe -l $t/*/* - $upx_exe --file-info $t/*/* - $upx_exe -t $t/*/* + testsuite_check_sha $testdir + $upx_exe -l $testdir/*/* + $upx_exe --file-info $testdir/*/* + $upx_exe -t $testdir/*/* } # /*********************************************************************** @@ -68,34 +85,33 @@ testsuite_run_compress() { #set -x exit_code=0 -if [[ $ALLOW_FAIL == 1 ]]; then - echo "ALLOW_FAIL=$ALLOW_FAIL" +if [[ $BM_T =~ (^|\+)ALLOW_FAIL($|\+) ]]; then + echo "ALLOW_FAIL" set +e fi -if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi - [[ -z $upx_exe && -f $upx_BUILDDIR/upx.out ]] && upx_exe=$upx_BUILDDIR/upx.out [[ -z $upx_exe && -f $upx_BUILDDIR/upx.exe ]] && upx_exe=$upx_BUILDDIR/upx.exe if [[ -z $upx_exe ]]; then exit 1; fi +if [[ $BM_T =~ (^|\+)qemu($|\+) && -n $upx_qemu ]]; then + upx_exe="$upx_qemu $upx_qemu_flags -- $upx_exe" +fi +if [[ $BM_T =~ (^|\+)wine($|\+) && -n $upx_wine ]]; then + upx_exe="$upx_wine $upx_wine_flags $upx_exe" +fi if ! $upx_exe --version >/dev/null; then exit 1; fi -sha256sum=sha256sum -if [[ $TRAVIS_OS_NAME == osx ]]; then - sha256sum=gsha256sum # brew install coreutils -fi -if [[ $B =~ (^|\+)valgrind($|\+) ]]; then +if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then valgrind_flags="--leak-check=full --show-reachable=yes" valgrind_flags="-q --leak-check=no --error-exitcode=1" valgrind_flags="--leak-check=no --error-exitcode=1" upx_exe="valgrind $valgrind_flags $upx_exe" fi -if [[ $B =~ (^|\+)coverage($|\+) ]]; then - lcov -d $upx_BUILDDIR --zerocounters +if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then + (cd / && cd $upx_BUILDDIR && lcov -d . --zerocounters) fi -cd $upx_testsuite_BUILDDIR || exit 1 rm -rf ./testsuite_1 mkdir testsuite_1 cd testsuite_1 @@ -108,8 +124,8 @@ export UPX="--no-color --no-progress" # // decompression tests # ************************************************************************/ -t=t01_decompressed -mkdir $t; echo -n "\ +testdir=t01_decompressed +mkdir $testdir; echo -n "\ 24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91 28d7ca8f0dfca8159e637eaf2057230b6e6719e07751aca1d19a45b5efed817c *arm-wince.pe/upx-3.91.exe b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91 @@ -119,24 +135,24 @@ bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djg 8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91 b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected -testsuite_header $t +testsuite_header $testdir for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do testsuite_split_f $f [[ -z $fb ]] && continue - mkdir -p $t/$fsubdir - $upx_exe -d $f -o $t/$fsubdir/$fb + mkdir -p $testdir/$fsubdir + $upx_exe -d $f -o $testdir/$fsubdir/$fb done -testsuite_check_sha $t +testsuite_check_sha $testdir # /*********************************************************************** # // compression tests # ************************************************************************/ -t=t02_compress_ucl_3_no_filter -mkdir $t; echo -n "\ +testdir=t02_compress_ucl_3_no_filter +mkdir $testdir; echo -n "\ 3dd2564078aa15d35fbf70928cdb094697c4ef8909bd711c7a3bd79eb18ab400 *amd64-linux.elf/upx-3.91 16c0493d4d89e6c581748826afd26d2b4caeeae6074b0bdcf55747a4bc9777a5 *arm-wince.pe/upx-3.91.exe ea42d52676d2698f29587e98a9e1536b96ebf523a7d8bc926f6c241a159b4116 *armeb-linux.elf/upx-3.91 @@ -146,11 +162,11 @@ a94d5ff62c061d60d64e838ea4bb7610a75cf26a0761b26f9da0efbd38e87ebe *i386-win32.pe/ 510e2cd126bb8129b9076eb61e1ad3308d9af109cd42dff7252bf43e1e3552ea *m68k-atari.tos/upx-3.91.ttp b61aa58e493b3961646e5c0bcb7f19f74b439fe8f5c934db25b00f97f51a05d0 *mipsel-linux.elf/upx-3.91 21071b7dfa542a7e3d6c6a3586b4b844d28270a2beccdc5d03f608a2e71b787d *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected time testsuite_run_compress -3 --no-filter -t=t03_compress_lzma_1_no_filter -mkdir $t; echo -n "\ +testdir=t03_compress_lzma_1_no_filter +mkdir $testdir; echo -n "\ 542124e236f4dc3ba92de02a07f29df3d8a015bb9f3a5a9681c978746b16e0df *amd64-linux.elf/upx-3.91 99ad77f2280a5b4791ead800c7d4d5b29aa49ce40319616f682c1b29ddf20702 *arm-wince.pe/upx-3.91.exe 07ca9736f1cd478bde2c8da95a6ecb95bd865dcf8ea48a396b13050ac40d196e *armeb-linux.elf/upx-3.91 @@ -160,11 +176,11 @@ e249633d550abe84953a15668e3d74660fd63e9e935bec8564d9df08116b015d *i386-win32.pe/ dd561ff9c530711be0934db352cf40f606066c280e27b26e7f8fd6dd1a087e6a *m68k-atari.tos/upx-3.91.ttp 813536a8f1b8b8852ed52c560afce8b51612876ac5a3a9e51434d8677932ef7b *mipsel-linux.elf/upx-3.91 5a3607a37534bab2a22c2e1dc3f1aa26144c2b75c261f092a3d9116d884edc1a *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected time testsuite_run_compress -1 --lzma --no-filter -t=t04_compress_ucl_2_all_filters -mkdir $t; echo -n "\ +testdir=t04_compress_ucl_2_all_filters +mkdir $testdir; echo -n "\ bde869b9b0e29c7930591b3582ef3e864db7757d774082d772df8f6b874e6fd6 *amd64-linux.elf/upx-3.91 247e385b1bf2559982cfedde0dc6dafc3fe99ad09100afc8b6ec3e59722afd4f *arm-wince.pe/upx-3.91.exe db894f24777334abb9bf8e34661d057e25c2889b46290cf83db7310c4cdd86fa *armeb-linux.elf/upx-3.91 @@ -174,11 +190,11 @@ db894f24777334abb9bf8e34661d057e25c2889b46290cf83db7310c4cdd86fa *armeb-linux.el 7b09fa5b2f8d85673f3a52c3b478a8dd129ed23681de4028625b33f5f6890942 *m68k-atari.tos/upx-3.91.ttp 707b7f32b8b0c1a4e5c26e370b93ae6eb60ab78f7d6163b4e853eb94e69f5d14 *mipsel-linux.elf/upx-3.91 3951a8dbe60f41f7ae1d71ca8d0f022675a04542786351c09281dfce41fd49e0 *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected time testsuite_run_compress -2 --all-filters -t=t05_compress_all_methods_1_no_filter -mkdir $t; echo -n "\ +testdir=t05_compress_all_methods_1_no_filter +mkdir $testdir; echo -n "\ 542124e236f4dc3ba92de02a07f29df3d8a015bb9f3a5a9681c978746b16e0df *amd64-linux.elf/upx-3.91 99ad77f2280a5b4791ead800c7d4d5b29aa49ce40319616f682c1b29ddf20702 *arm-wince.pe/upx-3.91.exe 07ca9736f1cd478bde2c8da95a6ecb95bd865dcf8ea48a396b13050ac40d196e *armeb-linux.elf/upx-3.91 @@ -188,11 +204,11 @@ e249633d550abe84953a15668e3d74660fd63e9e935bec8564d9df08116b015d *i386-win32.pe/ dd561ff9c530711be0934db352cf40f606066c280e27b26e7f8fd6dd1a087e6a *m68k-atari.tos/upx-3.91.ttp 813536a8f1b8b8852ed52c560afce8b51612876ac5a3a9e51434d8677932ef7b *mipsel-linux.elf/upx-3.91 5a3607a37534bab2a22c2e1dc3f1aa26144c2b75c261f092a3d9116d884edc1a *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected time testsuite_run_compress -1 --all-methods --no-filter -t=t06_compress_all_methods_no_lzma_no_filter -mkdir $t; echo -n "\ +testdir=t06_compress_all_methods_no_lzma_no_filter +mkdir $testdir; echo -n "\ 6e669ac40043287516be85ddce6e4ac9d41d4e550ea080e23f9dfde7fff8fd64 *amd64-linux.elf/upx-3.91 63be06791e4caa5ea530bd58d0fe5af7830fe6907cebb4de6eec5a73ff57bf58 *arm-wince.pe/upx-3.91.exe b95b5a9a1ba4577df41c135b0061a7282e633f006ce6a5c729d73a708f80c0f0 *armeb-linux.elf/upx-3.91 @@ -202,7 +218,7 @@ a647ed1aea16f58b544228279ad7159cd3ec5c3533efef1fd2df5a5a59b5d663 *i386-win32.pe/ 4ce409cc6c1a0e26b0d5e361cd6ef7b0198830a3244235eff3edb18099d1ad22 *m68k-atari.tos/upx-3.91.ttp 8b2b9f13dd613b62d9028d2c773a2633bb756a084e5620b3496449ffe1c2dc9e *mipsel-linux.elf/upx-3.91 84e82cfffa594230ee44aa06937ccb088778c05d5d67985a314764385018f59d *powerpc-linux.elf/upx-3.91 -" > $t/.sha256sums.expected +" > $testdir/.sha256sums.expected time testsuite_run_compress --all-methods --no-lzma --no-filter diff --git a/.travis.yml b/.travis.yml index 685b3c6c..f435b21a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ addons: env: global: - - C= B= ALLOW_FAIL= + - C= B= CROSS= T= matrix: - TRAVIS_EMPTY_JOB_WORKAROUND=true @@ -81,7 +81,7 @@ matrix: addons: { apt: { sources: *S, packages: [ "g++-6" ] } } - os: linux compiler: gcc - env: C=gcc-6-m64 B=valgrind + env: C=gcc-6-m64 B=valgrind T=valgrind addons: { apt: { sources: *S, packages: [ "g++-6", valgrind ] } } - os: linux compiler: clang @@ -138,6 +138,22 @@ matrix: compiler: clang env: C=clang-3.8-m64 B=scan-build addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } } + - os: linux + compiler: gcc + env: C=gcc-4.6 CROSS=arm-linux-gnueabi T=SKIP + addons: { apt: { packages: [ "g++-arm-linux-gnueabi", "qemu-user" ] } } + - os: linux + compiler: gcc + env: C=gcc-4.6 CROSS=arm-linux-gnueabihf T=SKIP + addons: { apt: { packages: [ "g++-arm-linux-gnueabihf", "qemu-user" ] } } + - os: linux + compiler: gcc + env: C=gcc-4.6 CROSS=i386-w64-mingw32 T=wine + addons: { apt: { packages: [ "binutils-mingw-w64-i686", "g++-mingw-w64-i686", "wine" ] } } + - os: linux + compiler: gcc + env: C=gcc-4.6 CROSS=x86_64-w64-mingw32 T=wine + addons: { apt: { packages: [ "binutils-mingw-w64-x86-64", "g++-mingw-w64-x86-64", "wine" ] } } - os: osx compiler: clang # must use debug build or else we get "ld: internal error: atom not found" when linking @@ -167,7 +183,8 @@ matrix: install: - umask 022; cd $TRAVIS_BUILD_DIR && mkdir -p ../deps - - cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/files/499379/ucl-1.03.tar.gz | tar -xz + - cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -xJ + - cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -xJ - cd ../deps && travis_retry git clone https://github.com/upx/upx-testsuite - | cd / @@ -185,6 +202,7 @@ install: fi script: + - cd $TRAVIS_BUILD_DIR && mkdir -p ../build/travis - cd $TRAVIS_BUILD_DIR && bash ./.github/travis_build.sh - cd $TRAVIS_BUILD_DIR && bash ./.github/travis_testsuite_1.sh