From 807ab8d19f0c26f1056f23399f1e6e901a7022e6 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 29 Sep 2016 01:55:52 +0200 Subject: [PATCH] Update Travis and AppVeyor. --- .appveyor.yml | 28 ++++++++++++++++++++-------- .github/travis_init.sh | 11 +++++++++-- .github/travis_testsuite_1.sh | 26 ++++++++++++++------------ 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index cd89550d..e2ac9a35 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,6 +4,7 @@ os: Visual Studio 2015 environment: + global: { C: "", B: release, ALLOW_FAIL: "", TRAVIS_OS_NAME: windows } 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 @@ -19,14 +20,15 @@ init: install: - cd c:\projects - - mkdir build build\%C% deps + - md build build\%C% deps - 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" - tar -xzf ucl-1.03.tar.gz - - sed -i '/snprintf *_v*snprintf/d' ucl-1.03/acc/acc_auto.h + # 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 - if "%C%"=="msvc-10.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 ) @@ -39,30 +41,40 @@ install: - if "%C%"=="msvc-14.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 ) build_script: - - set B=release + # 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 - - set DEFS=-D_CRT_SECURE_NO_WARNINGS +##- if "%C%"=="gcc-m64" ( bash -x ./.github/travis_build.sh && exit 0 ) # TODO - set BDIR=c:\projects\build\%C%\%B% - - mkdir %BDIR% %BDIR%\ucl-1.03 %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib-1.2.8 + - md %BDIR% %BDIR%\ucl-1.03 %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib-1.2.8 + - set DEFS=-D_CRT_SECURE_NO_WARNINGS + - git rev-parse --short=12 HEAD > %BDIR%\upx\.GITREV.txt + # build UCL - cd %BDIR%\ucl-1.03 - set s=c:\projects\deps\ucl-1.03 - cl -MT -O2 -W4 %DEFS% -I%s%\include -I%s% -c %s%\src\*.c - link -lib -out:ucl.lib *.obj + # build zlib - cd %BDIR%\zlib-1.2.8 - cl -MT -O2 -W2 %DEFS% -c c:\projects\deps\zlib-1.2.8\*.c - link -lib -out:zlib.lib *.obj + # build UPX - cd %BDIR%\upx - set s=c:\projects\upx\src - - cl -MT -EHsc -O2 -W4 -wd4244 %DEFS% -DWITH_LZMA=0x443 -DUCL_NO_ASM -I%s%\lzma-sdk -Ic:\projects\deps\ucl-1.03\include -Ic:\projects\deps\zlib-1.2.8 -Feupx.exe %s%\*.cpp %BDIR%\ucl-1.03\ucl.lib %BDIR%\zlib-1.2.8\zlib.lib - + - cat .GITREV.txt + - set /p GITREV=<.GITREV.txt + - cl -MT -EHsc -O2 -W4 -wd4244 -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -DWITH_LZMA=0x443 -DUCL_NO_ASM -I%s%\lzma-sdk -Ic:\projects\deps\ucl-1.03\include -Ic:\projects\deps\zlib-1.2.8 -Feupx.exe %s%\*.cpp %BDIR%\ucl-1.03\ucl.lib %BDIR%\zlib-1.2.8\zlib.lib test_script: + - set UPX=--no-color --no-progress - cd %BDIR%\upx + # basic tests - .\upx.exe --version - .\upx.exe upx.exe -o upx_packed.exe - dir *.exe + - .\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! - cd c:\projects\upx - bash ./.github/travis_testsuite_1.sh diff --git a/.github/travis_init.sh b/.github/travis_init.sh index 673c58db..3c27f71d 100644 --- a/.github/travis_init.sh +++ b/.github/travis_init.sh @@ -6,9 +6,13 @@ #set -x # debug umask 022 +# just in case +UPX= + # set CC and CXX from C -CC=false CXX=false SCAN_BUILD=false [[ -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 @@ -32,6 +36,7 @@ case $C in clang* | gcc*) CC="$CC -std=gnu89" ;; esac export CC CXX +fi # CC_OVERRIDE # B is BUILD_TYPE [[ -z $B ]] && B=release @@ -50,7 +55,7 @@ upx_testsuite_BUILDDIR="$tmake_top_bdir/upx-testsuite" 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 +[[ -d $tmake_top_bdir/.mfxnobackup ]] && echo "timestamp" > $tmake_top_bdir/.mfxnobackup export UPX_UCLDIR="$ucl_SRCDIR" @@ -63,7 +68,9 @@ cd / && cd $upx_BUILDDIR || exit 1 # enter srcdir cd / && cd $upx_SRCDIR || exit 1 +if [[ -n $APPVEYOR_JOB_ID ]]; then # for some reason this is needed for bash on AppVeyor sort() { /usr/bin/sort "$@" } +fi diff --git a/.github/travis_testsuite_1.sh b/.github/travis_testsuite_1.sh index 8bbc67ee..c064c8b6 100644 --- a/.github/travis_testsuite_1.sh +++ b/.github/travis_testsuite_1.sh @@ -18,7 +18,7 @@ source ./.github/travis_init.sh || exit 1 # ************************************************************************/ testsuite_header() { - local x="========"; x="$x$x$x$x$x$x$x$x$x" + local x="==========="; x="$x$x$x$x$x$x$x" echo -e "\n${x}\n${1}\n${x}\n" } @@ -34,26 +34,28 @@ testsuite_split_f() { testsuite_check_sha() { (cd "$1" && $sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current + echo cat $1/.sha256sums.current - if ! cmp -s $1/.sha256sums.current $1/.sha256sums.expected; then + if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then echo "UPX-ERROR: checksum mismatch" - diff -u $1/.sha256sums.current $1/.sha256sums.expected || true + diff -u $1/.sha256sums.expected $1/.sha256sums.current || true #exit 1 exit_code=1 fi + echo } testsuite_run_compress() { - testsuite_header "$t" + testsuite_header $t local f ff for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do - testsuite_split_f "$f" + testsuite_split_f $f [[ -z $fb ]] && continue mkdir -p $t/$fsubdir ff=t01_decompressed/$fsubdir/$fb $upx_exe --prefer-ucl "$@" $ff -o $t/$fsubdir/$fb done - testsuite_check_sha "$t" + testsuite_check_sha $t $upx_exe -l $t/*/* $upx_exe --file-info $t/*/* $upx_exe -t $t/*/* @@ -75,8 +77,8 @@ 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 [[ ! -f $upx_exe ]]; then exit 1; fi -if [[ ! -x $upx_exe ]]; then exit 1; fi +if [[ -z $upx_exe ]]; then exit 1; fi +if ! $upx_exe --version >/dev/null; then exit 1; fi sha256sum=sha256sum if [[ $TRAVIS_OS_NAME == osx ]]; then @@ -99,7 +101,7 @@ mkdir testsuite_1 cd testsuite_1 export UPX= -export UPX="--no-progress" +export UPX="--no-color --no-progress" # /*********************************************************************** @@ -119,14 +121,14 @@ c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.e b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91 " > $t/.sha256sums.expected -testsuite_header "$t" +testsuite_header $t for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do - testsuite_split_f "$f" + testsuite_split_f $f [[ -z $fb ]] && continue mkdir -p $t/$fsubdir $upx_exe -d $f -o $t/$fsubdir/$fb done -testsuite_check_sha "$t" +testsuite_check_sha $t # /***********************************************************************