Update Travis.

This commit is contained in:
Markus F.X.J. Oberhumer 2016-09-25 14:00:49 +02:00
parent 68159d457e
commit 4cdc969801
5 changed files with 264 additions and 282 deletions

92
.ci/travis_build.sh Normal file
View File

@ -0,0 +1,92 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Support for Travis CI -- https://travis-ci.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
source "$TRAVIS_BUILD_DIR/.ci/travis_init.sh" || exit 1
echo "BUILD_METHOD='$BUILD_METHOD'"
echo "BUILD_DIR='$BUILD_DIR'"
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
echo "$CC --version"; $CC --version
echo "$CXX --version"; $CXX --version
# whitespace
if test "$TRAVIS_OS_NAME" = "linux"; then
echo "Checking source code for whitespace violations..."
find . \
-type d -name '.git' -prune -o \
-type d -name 'deps' -prune -o \
-type f -iname '*.bat' -prune -o \
-type f -iname '*.exe' -prune -o \
-type f -iname '*.pdf' -prune -o \
-type f -print0 | LC_ALL=C sort -z | \
xargs -0r perl -n -e '
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
if (m,([ \t]+)$,) {
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
if ($1 ne " " || $ARGV !~ m,\.md$,) {
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
}
}
if (m,\t,) {
if ($ARGV =~ m,(^|/)\.gitmodules$,) { }
elsif ($ARGV =~ 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."
fi # linux
set -x
#
# build UCL
#
cd /; cd "$UPX_UCLDIR" || exit 1
./configure --enable-static --disable-shared --disable-asm
make
#
# build UPX
#
cd /; cd "$BUILD_DIR" || exit 1
make="make -f $TRAVIS_BUILD_DIR/src/Makefile"
export EXTRA_CPPFLAGS="-DUCL_NO_ASM"
case $BUILD_METHOD in
debug | debug+*) make="$make USE_DEBUG=1" ;;
esac
case $BUILD_METHOD in
*sanitize)
make="$make USE_SANITIZE=1"
case $TRAVIS_OS_NAME-$CC in linux-gcc*) export EXTRA_LDFLAGS="-fuse-ld=gold" ;; esac
;;
*scan-build) make="$SCAN_BUILD $make" ;;
*valgrind) export EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DWITH_VALGRIND" ;;
esac
if test "$ALLOW_FAIL" = "1"; then
echo "ALLOW_FAIL=$ALLOW_FAIL"
set +e
fi
$make
ls -l upx.out
size upx.out
file upx.out
exit 0

32
.ci/travis_init.sh Normal file
View File

@ -0,0 +1,32 @@
## vim:set ts=4 sw=4 et:
# Support for Travis CI -- https://travis-ci.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
umask 022
cd /; cd "$TRAVIS_BUILD_DIR" || exit 1
BUILD_DIR="$TRAVIS_BUILD_DIR/build"
mkdir -p "$BUILD_DIR"
if test "X$B" = "X"; then B=release; fi
BUILD_METHOD="$B"
CC=false CXX=false SCAN_BUILD=false
case $C in
clang-m?? | clang-3.4-m?? | clang-[78][0-9][0-9]-m??)
CC="clang -std=gnu90"; CXX="clang++" ;;
clang-3.[0-9]-m??)
v=${C:6:3}; CC="clang-$v -std=gnu90"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
gcc-m?? | gcc-4.6-m??)
CC="gcc -std=gnu90"; CXX="g++" ;;
gcc-[56]-m?? | gcc-[56].[0-9]-m??)
v=${C:4:1}; CC="gcc-$v -std=gnu90"; CXX="g++-$v" ;;
esac
case $C in
*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
esac
export CC CXX
export UPX_UCLDIR="$TRAVIS_BUILD_DIR/deps/ucl-1.03"

74
.ci/travis_testsuite.sh Normal file
View File

@ -0,0 +1,74 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Support for Travis CI -- https://travis-ci.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
source "$TRAVIS_BUILD_DIR/.ci/travis_init.sh" || exit 1
set -x
cd /; cd "$BUILD_DIR" || exit 1
if ! test -x $PWD/upx.out; then exit 1; fi
#
# very first version of the upx-testsuite
#
exit_code=0
checksum=sha256sum
if test "$TRAVIS_OS_NAME" = "osx"; then
checksum=true # TODO: travis-osx does not have md5sum and friends?
fi
upx="$PWD/upx.out"
case $BUILD_METHOD in
*valgrind) upx="valgrind $upx" ;;
esac
upx_391=false
if test "$TRAVIS_OS_NAME" = "linux"; then
cp "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files/packed/amd64-linux.elf/upx-3.91" upx391.out
upx_391="$PWD/upx391.out"
fi
$upx --help
cd /; cd "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files" || exit 1
ls -l packed/*/upx-3.91*
$upx -l packed/*/upx-3.91*
$upx --file-info packed/*/upx-3.91*
for f in packed/*/upx-3.91*; do
echo "===== $f"
if test "$TRAVIS_OS_NAME" = "linux"; then
$upx_391 -d $f -o v391.tmp
$upx -d $f -o v392.tmp
$checksum v391.tmp v392.tmp
cmp -s v391.tmp v392.tmp
$upx_391 --lzma --fake-stub-version=3.92 --fake-stub-year=2016 v391.tmp -o v391_packed.tmp
$upx --lzma v392.tmp -o v392_packed.tmp
$checksum v391_packed.tmp v392_packed.tmp
else
$upx -d $f -o v392.tmp
$checksum v392.tmp
$upx --lzma v392.tmp -o v392_packed.tmp
$checksum v392_packed.tmp
fi
$upx -d v392_packed.tmp -o v392_decompressed.tmp
# after the first compression+decompression step the exe should be
# canonicalized so that further compression+decompression runs
# should yield identical results
if ! cmp -s v392.tmp v392_decompressed.tmp; then
# UPX 3.91 and 3.92 differ; run one more compression+decompression
ls -l v392.tmp v392_decompressed.tmp
echo "UPX-WARNING: $f"
$upx v392_decompressed.tmp -o v392_packed_2.tmp
$upx -d v392_packed_2.tmp -o v392_decompressed_2.tmp
if ! cmp -s v392_decompressed.tmp v392_decompressed_2.tmp; then
ls -l v392_decompressed.tmp v392_decompressed_2.tmp
echo "UPX-ERROR: $f"
exit_code=1
fi
fi
rm *.tmp
done
exit $exit_code

View File

@ -1,3 +1,6 @@
# Support for Travis CI -- https://travis-ci.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
sudo: false
language: cpp
@ -10,7 +13,7 @@ branches:
- travis
addons:
sources: &apt_sources
sources: &S
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- llvm-toolchain-precise-3.6
@ -28,153 +31,114 @@ matrix:
- env: TRAVIS_EMPTY_JOB_WORKAROUND=true
include:
- os: linux
compiler: clang
env: C=clang-m32 B=debug
addons:
apt:
packages: [ "g++-multilib", "zlib1g-dev:i386" ]
compiler: gcc
env: C=gcc-4.6-m32
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.6-m64
- os: linux
compiler: gcc
env: C=gcc-5.4-m32
addons: { apt: { sources: *S, packages: [ "g++-5-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-5.4-m64
addons: { apt: { sources: *S, packages: [ "g++-5" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m32
addons: { apt: { sources: *S, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m64
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m32 B=debug
addons: { apt: { sources: *S, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m64 B=debug
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m64 B=debug+sanitize
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6.2-m64 B=release+valgrind
addons: { apt: { sources: *S, packages: [ "g++-6", "valgrind" ] } }
- os: linux
compiler: clang
env: C=clang-m64 B=debug
env: C=clang-3.4-m32
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-m32
addons:
apt:
packages: [ "g++-multilib", "zlib1g-dev:i386" ]
- os: linux
compiler: clang
env: C=clang-m64
env: C=clang-3.4-m64
- os: linux
compiler: clang
env: C=clang-3.5-m32
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.5", "g++-6-multilib", "zlib1g-dev:i386" ]
addons: { apt: { sources: *S, packages: [ "clang-3.5", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.5-m64
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.5" ]
addons: { apt: { sources: *S, packages: [ "clang-3.5" ] } }
- os: linux
compiler: clang
env: C=clang-3.6-m32
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.6", "g++-6-multilib", "zlib1g-dev:i386" ]
addons: { apt: { sources: *S, packages: [ "clang-3.6", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.6-m64
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.6" ]
addons: { apt: { sources: *S, packages: [ "clang-3.6" ] } }
- os: linux
compiler: clang
env: C=clang-3.7-m32
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.7", "g++-6-multilib", "zlib1g-dev:i386" ]
addons: { apt: { sources: *S, packages: [ "clang-3.7", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.7-m64
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.7" ]
addons: { apt: { sources: *S, packages: [ "clang-3.7" ] } }
- os: linux
compiler: clang
env: C=clang-3.8-m32
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.8", "g++-6-multilib", "zlib1g-dev:i386" ]
addons: { apt: { sources: *S, packages: [ "clang-3.8", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.8-m64
addons:
apt:
sources: *apt_sources
packages: [ "clang-3.8" ]
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
- os: linux
compiler: gcc
env: C=gcc-m32
addons:
apt:
packages: [ "g++-multilib", "zlib1g-dev:i386" ]
- os: linux
compiler: gcc
env: C=gcc-m64
- os: linux
compiler: gcc-5
env: C=gcc-5-m32
addons:
apt:
sources: *apt_sources
packages: [ "g++-5-multilib", "zlib1g-dev:i386" ]
- os: linux
compiler: gcc-5
env: C=gcc-5-m64
addons:
apt:
sources: *apt_sources
packages: [ "g++-5" ]
- os: linux
compiler: gcc-6
env: C=gcc-6-m32
addons:
apt:
sources: *apt_sources
packages: [ "g++-6-multilib", "zlib1g-dev:i386" ]
- os: linux
compiler: gcc-6
env: C=gcc-6-m64
addons:
apt:
sources: *apt_sources
packages: [ "g++-6" ]
- os: linux
compiler: gcc-6
env: C=gcc-6-m64 B=debug+sanitize
addons:
apt:
sources: *apt_sources
packages: [ "g++-6" ]
- os: linux
compiler: gcc-6
env: C=gcc-6-m64 B=debug+valgrind
addons:
apt:
sources: *apt_sources
packages: [ "g++-6", "valgrind" ]
compiler: clang
env: C=clang-3.8-m64 B=scan-build
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
- os: osx
compiler: clang
env: C=clang-m32
env: C=clang-703-m32
osx_image: xcode7.3
- os: osx
compiler: clang
env: C=clang-m64
env: C=clang-703-m64
osx_image: xcode7.3
- os: osx
compiler: clang
env: C=clang-m32
env: C=clang-800-m32
osx_image: xcode8
- os: osx
compiler: clang
env: C=clang-m64
env: C=clang-800-m64
osx_image: xcode8
allow_failures:
- os: linux
env: C=gcc-6.2-m64 B=debug+sanitize
install:
- DEPS_DIR="$TRAVIS_BUILD_DIR/deps"; mkdir -p "$DEPS_DIR" && cd "$DEPS_DIR"
- umask 022; DEPS_DIR="$TRAVIS_BUILD_DIR/deps"; mkdir -p "$DEPS_DIR" && cd "$DEPS_DIR"
- wget --no-check-certificate -q -O - https://download.freenas.org/distfiles/ucl-1.03.tar.gz | tar -xz
- git clone https://github.com/upx/upx-testsuite
script:
- bash "$TRAVIS_BUILD_DIR/.travis_build.sh"
- bash $TRAVIS_BUILD_DIR/.ci/travis_build.sh
- bash $TRAVIS_BUILD_DIR/.ci/travis_testsuite.sh
# vim:set ts=2 sw=2 et:

View File

@ -1,180 +0,0 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
cd /; cd "$TRAVIS_BUILD_DIR" || exit 1
if test "X$B" = "X"; then B=release; fi
BUILD_METHOD="$B"
case $C in
clang-m32) CC="clang -m32"; CXX="clang++ -m32" ;;
clang-m64) CC="clang -m64"; CXX="clang++ -m64" ;;
clang-3.4-m32) CC="clang-3.4 -m32"; CXX="clang++-3.4 -m32" ;;
clang-3.4-m64) CC="clang-3.4 -m64"; CXX="clang++-3.4 -m64" ;;
clang-3.5-m32) CC="clang-3.5 -m32"; CXX="clang++-3.5 -m32" ;;
clang-3.5-m64) CC="clang-3.5 -m64"; CXX="clang++-3.5 -m64" ;;
clang-3.6-m32) CC="clang-3.6 -m32"; CXX="clang++-3.6 -m32" ;;
clang-3.6-m64) CC="clang-3.6 -m64"; CXX="clang++-3.6 -m64" ;;
clang-3.7-m32) CC="clang-3.7 -m32"; CXX="clang++-3.7 -m32" ;;
clang-3.7-m64) CC="clang-3.7 -m64"; CXX="clang++-3.7 -m64" ;;
clang-3.8-m32) CC="clang-3.8 -m32"; CXX="clang++-3.8 -m32" ;;
clang-3.8-m64) CC="clang-3.8 -m64"; CXX="clang++-3.8 -m64" ;;
clang-3.9-m32) CC="clang-3.9 -m32"; CXX="clang++-3.9 -m32" ;;
clang-3.9-m64) CC="clang-3.9 -m64"; CXX="clang++-3.9 -m64" ;;
gcc-m32) CC="gcc -m32"; CXX="g++ -m32" ;;
gcc-m64) CC="gcc -m64"; CXX="g++ -m64" ;;
gcc-5-m32) CC="gcc-5 -m32"; CXX="g++-5 -m32" ;;
gcc-5-m64) CC="gcc-5 -m64"; CXX="g++-5 -m64" ;;
gcc-6-m32) CC="gcc-6 -m32 -std=gnu90"; CXX="g++-6 -m32" ;;
gcc-6-m64) CC="gcc-6 -m64 -std=gnu90"; CXX="g++-6 -m64" ;;
esac
export CC CXX
export UPX_UCLDIR="$TRAVIS_BUILD_DIR/deps/ucl-1.03"
echo "BUILD_METHOD='$BUILD_METHOD'"
echo "CC='$CC'"
echo "CXX='$CXX'"
echo "CPPFLAGS='$CPPFLAGS'"
echo "CFLAGS='$CFLAGS'"
echo "CXXFLAGS='$CXXFLAGS'"
echo "LDFLAGS='$LDFLAGS'"
echo "LIBS='$LIBS'"
echo "BUILD_DIR='$BUILD_DIR'"
echo "UPX_UCLDIR='$UPX_UCLDIR'"
#env | LC_ALL=C sort
echo "$CC --version"; $CC --version
echo "$CXX --version"; $CXX --version
# whitespace
if test "X$TRAVIS_OS_NAME" = "Xlinux"; then
echo "Checking source code for whitespace violations..."
find . \
-type d -name '.git' -prune -o \
-type d -name 'deps' -prune -o \
-type f -iname '*.bat' -prune -o \
-type f -iname '*.exe' -prune -o \
-type f -iname '*.pdf' -prune -o \
-type f -print0 | LC_ALL=C sort -z | \
xargs -0r perl -n -e '
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
if (m,([ \t]+)$,) {
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
if ($1 ne " " || $ARGV !~ m,\.md$,) {
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
}
}
if (m,\t,) {
if ($ARGV =~ m,(^|/)\.gitmodules$,) { }
elsif ($ARGV =~ 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."
fi # linux
set -x
BUILD_DIR="$TRAVIS_BUILD_DIR/build"
mkdir -p "$BUILD_DIR"
# build UCL
cd /; cd "$UPX_UCLDIR" || exit 1
./configure --enable-static --disable-shared --disable-asm
make
# build UPX
cd /; cd "$BUILD_DIR" || exit 1
export EXTRA_CPPFLAGS="-DUCL_NO_ASM"
case $BUILD_METHOD in
*sanitize) case $CC in gcc*) export EXTRA_LDFLAGS="-fuse-ld=gold" ;; esac ;;
*valgrind) export EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DWITH_VALGRIND" ;;
esac
make="make -f $TRAVIS_BUILD_DIR/src/Makefile"
if test "X$ALLOW_FAIL" = "X1"; then
echo "ALLOW_FAIL=$ALLOW_FAIL"
set +e
fi
case $BUILD_METHOD in
debug | debug+valgrind)
$make USE_DEBUG=1 ;;
debug+sanitize)
$make USE_DEBUG=1 USE_SANITIZE=1 ;;
release | release+valgrind | valgrind)
$make ;;
sanitize)
$make USE_SANITIZE=1 ;;
scan-build)
scan-build $make ;;
*)
echo "ERROR: invalid BUILD_METHOD '$BUILD_METHOD'"
exit 1
;;
esac
ls -l upx.out
size upx.out
file upx.out
exit_code=0
# very first version of the upx-testsuite
if test -x $PWD/upx.out; then
checksum=sha256sum
if test "X$TRAVIS_OS_NAME" = "Xosx"; then
checksum=true # TODO: travis-osx does not have md5sum and friends?
fi
upx="$PWD/upx.out"
case $BUILD_METHOD in
*valgrind) upx="valgrind $upx" ;;
esac
upx_391=false
if test "X$TRAVIS_OS_NAME" = "Xlinux"; then
cp "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files/packed/amd64-linux.elf/upx-3.91" upx391.out
upx_391="$PWD/upx391.out"
fi
$upx --help
cd /; cd "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files" || exit 1
$upx -l packed/*/upx-3.91*
$upx --file-info packed/*/upx-3.91*
for f in packed/*/upx-3.91*; do
echo "===== $f"
if test "X$TRAVIS_OS_NAME" = "Xlinux"; then
$upx_391 -d $f -o v391.tmp
$upx -d $f -o v392.tmp
$checksum v391.tmp v392.tmp
cmp -s v391.tmp v392.tmp
$upx_391 --lzma --fake-stub-version=3.92 --fake-stub-year=2016 v391.tmp -o v391_packed.tmp
$upx --lzma v392.tmp -o v392_packed.tmp
$checksum v391_packed.tmp v392_packed.tmp
else
$upx -d $f -o v392.tmp
$checksum v392.tmp
$upx --lzma v392.tmp -o v392_packed.tmp
$checksum v392_packed.tmp
fi
$upx -d v392_packed.tmp -o v392_decompressed.tmp
# after the first compression+decompression step the exe should be
# canonicalized so that further compression+decompression runs
# should yield identical results
if ! cmp -s v392.tmp v392_decompressed.tmp; then
# UPX 3.91 and 3.92 differ; run one more compression+decompression
ls -l v392.tmp v392_decompressed.tmp
echo "UPX-WARNING: $f"
$upx v392_decompressed.tmp -o v392_packed_2.tmp
$upx -d v392_packed_2.tmp -o v392_decompressed_2.tmp
if ! cmp -s v392_decompressed.tmp v392_decompressed_2.tmp; then
ls -l v392_decompressed.tmp v392_decompressed_2.tmp
echo "UPX-ERROR: $f"
exit_code=1
fi
fi
rm *.tmp
done
fi
exit $exit_code
# vim:set ts=4 sw=4 et: