compiler: clang
env: BUILDDIR=../build TOOL="cmake ../zlib-ng"
+ # Cross compiling for arm variants
+ - os: linux
+ compiler: aarch64-linux-gnu-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-aarch64-linux-gnu
+ - libc-dev-arm64-cross
+ # For all aarch64 implementations NEON is mandatory, while crypto/crc are not.
+ # So for aarch64 NEON should be automatically enabled, and "acle" should be explicitly defined
+ env: CHOST=aarch64-linux-gnu BUILDDIR=. TOOL="./configure --warn --zlib-compat"
+ - os: linux
+ compiler: aarch64-linux-gnu-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-aarch64-linux-gnu
+ - libc-dev-arm64-cross
+ # AArch64 toolchain in Trusty is 4.8.2, which doesn't support acle intrinsics.
+ # Until TravisCI provides Xenial dist (which comes with gcc-aarch64-5.3.1) 'acle' option cannot
+ # be enabled in subset. But the command
+ # "CHOST=aarch64-linux-gnu ./configure --warn --zlib-compat --acle"
+ # should work if manually test it in a dist with gcc-aarch64 5.1 or higher
+ # env: CHOST=aarch64-linux-gnu BUILDDIR=. TOOL="./configure --warn --zlib-compat --acle"
+ env: CHOST=aarch64-linux-gnu BUILDDIR=. TOOL="./configure --warn --zlib-compat"
+ # Hard-float subsets
+ - os: linux
+ compiler: arm-linux-gnueabihf-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabihf
+ - libc-dev-armhf-cross
+ env: CHOST=arm-linux-gnueabihf BUILDDIR=. TOOL="./configure --warn"
+ - os: linux
+ compiler: arm-linux-gnueabihf-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabihf
+ - libc-dev-armhf-cross
+ env: CHOST=arm-linux-gnueabihf BUILDDIR=. TOOL="./configure --warn --zlib-compat --neon"
+ - os: linux
+ compiler: arm-linux-gnueabihf-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabihf
+ - libc-dev-armhf-cross
+ env: CHOST=arm-linux-gnueabihf BUILDDIR=. TOOL="./configure --warn --zlib-compat"
+ # Soft-float subset
+ - os: linux
+ compiler: arm-linux-gnueabi-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabi
+ - libc-dev-armel-cross
+ env: CHOST=arm-linux-gnueabi BUILDDIR=. TOOL="./configure"
+ - os: linux
+ compiler: arm-linux-gnueabi-gcc
+ addons:
+ apt:
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabi
+ - libc-dev-armel-cross
+ env: CHOST=arm-linux-gnueabi BUILDDIR=. TOOL="./configure --zlib-compat"
+
script: mkdir -p $BUILDDIR && cd $BUILDDIR && $TOOL && make -j2 && make test
# ARM specific optimizations
arm | armv[3467]l | armv4b | armv4tl | armv5tel | armv5tejl | armv[67]hl | armv7hnl | armv[78]-a | armv8-a+* | armv8.[1234]-a | armv8.[1234]-a+*)
+ [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=arm
ARCHDIR=arch/arm
ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} fill_window_arm.o"
ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} fill_window_arm.lo"
;;
# 64-bit ARM specific optimizations
aarch64)
+ [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=aarch64
ARCHDIR=arch/aarch64
ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} fill_window_arm.o"
ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} fill_window_arm.lo"
CFLAGS="-march=${ARCH} ${CFLAGS} -DUNALIGNED_OK -DUNROLL_LESS"
SFLAGS="-march=${ARCH} ${SFLAGS} -DUNALIGNED_OK -DUNROLL_LESS"
;;
+ powerpc)
+ [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc
+ ;;
+ powerpc64)
+ [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc64
+ ;;
+ *)
+ [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=$ARCH
+ ;;
esac
echo "ARCH: ${ARCH}"
TESTINCLUDES="-I$SRCDIR"
if [ "$SRCDIR" != "$BUILDDIR" ]; then TESTINCLUDES="${TESTINCLUDES} -I$BUILDDIR"; fi
if test $compat -eq 1; then COMPATTESTS="compattests"; fi
+if test $QEMU_ARCH; then QEMU_RUN="qemu-$QEMU_ARCH -L /usr/${CHOST}/"; fi
sed < $SRCDIR/test/Makefile.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^SRCDIR *=/s#=.*#=$SRCDIR/test#
/^SRCTOP *=/s#=.*#=$SRCDIR#
/^COMPATTESTS *=/s#=.*#=$COMPATTESTS#
+/^QEMU_RUN *=/s#=.*#=$QEMU_RUN#
" > test/Makefile
# create zlib.pc with the configure results
TEST_LDFLAGS=-L.. ../libz.a
COMPATTESTS =
+QEMU_RUN=
+QEMU_VER:=$(shell command -v $(QEMU_RUN) --version 2> /dev/null)
all: oldtests cvetests $(COMPATTESTS)
oldtests: #set by ../configure
-
-teststatic:
+check_cross_dep:
+ifneq (,$(QEMU_RUN))
+ifeq (,$(QEMU_VER))
+ $(error "You need QEMU to run tests on non-native platform")
+endif
+endif
+
+teststatic: check_cross_dep
@TMPST=tmpst_$$; \
- if echo hello world | ../minigzip$(EXE) | ../minigzip$(EXE) -d && ../example$(EXE) $$TMPST ; then \
+ if echo hello world | ${QEMU_RUN} ../minigzip$(EXE) | ${QEMU_RUN} ../minigzip$(EXE) -d && ${QEMU_RUN} ../example$(EXE) $$TMPST ; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; exit 1; \
fi; \
rm -f $$TMPST
-testshared:
+testshared: check_cross_dep
@LD_LIBRARY_PATH=`pwd`/..:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
LD_LIBRARYN32_PATH=`pwd`/..:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
DYLD_LIBRARY_PATH=`pwd`/..:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`/..:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
- if echo hello world | ../minigzipsh$(EXE) | ../minigzipsh$(EXE) -d && ../examplesh$(EXE) $$TMPSH; then \
+ if echo hello world | ${QEMU_RUN} ../minigzipsh$(EXE) | ${QEMU_RUN} ../minigzipsh$(EXE) -d && ${QEMU_RUN} ../examplesh$(EXE) $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; exit 1; \
fi; \
rm -f $$TMPSH
-test64:
+test64: check_cross_dep
@TMP64=tmp64_$$; \
- if echo hello world | ../minigzip64$(EXE) | ../minigzip64$(EXE) -d && ../example64$(EXE) $$TMP64; then \
+ if echo hello world | ${QEMU_RUN} ../minigzip64$(EXE) | ${QEMU_RUN} ../minigzip64$(EXE) -d && ${QEMU_RUN} ../example64$(EXE) $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; exit 1; \
# Tests requiring zlib-ng to be built with --zlib-compat
compattests: testCVE-2003-0107
-testCVEinputs:
- @EXE=$(EXE) $(SRCDIR)/testCVEinputs.sh
+testCVEinputs: check_cross_dep
+ @EXE=$(EXE) QEMU_RUN="${QEMU_RUN}" $(SRCDIR)/testCVEinputs.sh
-testCVE-2003-0107: CVE-2003-0107$(EXE)
- @if ./CVE-2003-0107$(EXE); then \
+testCVE-2003-0107: CVE-2003-0107$(EXE) check_cross_dep
+ @if ${QEMU_RUN} ./CVE-2003-0107$(EXE); then \
echo ' *** zlib not vulnerable to CVE-2003-0107 ***'; \
else \
echo ' *** zlib VULNERABLE to CVE-2003-0107 ***'; exit 1; \
#!/bin/bash
TESTDIR="$(dirname "$0")"
+# check for QEMU if QEMU_RUN is set
+if [ ! -z "${QEMU_RUN}" ]; then
+ QEMU_VERSION=$(${QEMU_RUN} --version 2> /dev/null)
+ if [ -z "${QEMU_VERSION}" ]; then
+ echo "**** You need QEMU to run tests on non-native platform"
+ exit 1
+ fi
+fi
+
CVEs="CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096"
for CVE in $CVEs; do
fail=0
for testcase in ${TESTDIR}/${CVE}/*.gz; do
- ../minigzip${EXE} -d < "$testcase"
+ ${QEMU_RUN} ../minigzip${EXE} -d < "$testcase"
# we expect that a 1 error code is OK
# for a vulnerable failure we'd expect 134 or similar
if [ $? -ne 1 ] && [ $? -ne 0 ]; then