2020-02-12 16:49:14 +00:00
|
|
|
#!/bin/sh
|
2014-02-26 16:49:07 +00:00
|
|
|
# Build script for Travis CI
|
|
|
|
|
2018-09-12 10:05:14 +00:00
|
|
|
build_botan()
|
|
|
|
{
|
2018-09-12 13:51:08 +00:00
|
|
|
# same revision used in the build recipe of the testing environment
|
2020-01-15 13:57:56 +00:00
|
|
|
BOTAN_REV=0881f2c33ff7 # 2.13.0 + amalgamation patch
|
2020-01-30 10:09:04 +00:00
|
|
|
BOTAN_DIR=$DEPS_BUILD_DIR/botan
|
2018-09-12 11:12:44 +00:00
|
|
|
|
2018-10-02 14:13:26 +00:00
|
|
|
if test -d "$BOTAN_DIR"; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-11-22 14:38:49 +00:00
|
|
|
echo "$ build_botan()"
|
|
|
|
|
2018-09-12 10:05:14 +00:00
|
|
|
# if the leak detective is enabled we have to disable threading support
|
|
|
|
# (used for std::async) as that causes invalid frees somehow, the
|
|
|
|
# locking allocator causes a static leak via the first function that
|
|
|
|
# references it (e.g. crypter or hasher), so we disable that too
|
|
|
|
if test "$LEAK_DETECTIVE" = "yes"; then
|
|
|
|
BOTAN_CONFIG="--without-os-features=threads
|
|
|
|
--disable-modules=locking_allocator"
|
|
|
|
fi
|
|
|
|
# disable some larger modules we don't need for the tests
|
2020-01-30 10:09:04 +00:00
|
|
|
BOTAN_CONFIG="$BOTAN_CONFIG --disable-modules=pkcs11,tls,x509,xmss
|
|
|
|
--prefix=$DEPS_PREFIX"
|
2018-09-12 13:51:08 +00:00
|
|
|
|
|
|
|
git clone https://github.com/randombit/botan.git $BOTAN_DIR &&
|
2018-09-12 11:12:44 +00:00
|
|
|
cd $BOTAN_DIR &&
|
2018-09-12 15:18:15 +00:00
|
|
|
git checkout -qf $BOTAN_REV &&
|
2018-09-12 11:12:44 +00:00
|
|
|
python ./configure.py --amalgamation $BOTAN_CONFIG &&
|
2018-09-12 10:05:14 +00:00
|
|
|
make -j4 libs >/dev/null &&
|
|
|
|
sudo make install >/dev/null &&
|
|
|
|
sudo ldconfig || exit $?
|
2018-09-12 11:12:44 +00:00
|
|
|
cd -
|
2018-09-12 10:05:14 +00:00
|
|
|
}
|
|
|
|
|
2019-04-09 08:40:54 +00:00
|
|
|
build_wolfssl()
|
|
|
|
{
|
2020-01-15 13:57:56 +00:00
|
|
|
WOLFSSL_REV=87859f9e810b # v4.3.0-stable + IBM Z patch
|
2020-01-30 10:09:04 +00:00
|
|
|
WOLFSSL_DIR=$DEPS_BUILD_DIR/wolfssl
|
2019-04-09 08:40:54 +00:00
|
|
|
|
|
|
|
if test -d "$WOLFSSL_DIR"; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$ build_wolfssl()"
|
|
|
|
|
|
|
|
WOLFSSL_CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB"
|
2020-01-30 10:09:04 +00:00
|
|
|
WOLFSSL_CONFIG="--prefix=$DEPS_PREFIX
|
|
|
|
--enable-keygen --enable-rsapss --enable-aesccm
|
2019-04-09 08:40:54 +00:00
|
|
|
--enable-aesctr --enable-des3 --enable-camellia
|
|
|
|
--enable-curve25519 --enable-ed25519"
|
|
|
|
|
|
|
|
git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR &&
|
|
|
|
cd $WOLFSSL_DIR &&
|
|
|
|
git checkout -qf $WOLFSSL_REV &&
|
|
|
|
./autogen.sh &&
|
|
|
|
./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
|
|
|
|
make -j4 >/dev/null &&
|
|
|
|
sudo make install >/dev/null &&
|
|
|
|
sudo ldconfig || exit $?
|
|
|
|
cd -
|
|
|
|
}
|
|
|
|
|
2018-10-15 14:33:34 +00:00
|
|
|
build_tss2()
|
|
|
|
{
|
2019-09-26 09:50:46 +00:00
|
|
|
TSS2_REV=2.3.1
|
2018-10-15 14:33:34 +00:00
|
|
|
TSS2_PKG=tpm2-tss-$TSS2_REV
|
2020-01-30 10:09:04 +00:00
|
|
|
TSS2_DIR=$DEPS_BUILD_DIR/$TSS2_PKG
|
2018-10-15 14:33:34 +00:00
|
|
|
TSS2_SRC=https://github.com/tpm2-software/tpm2-tss/releases/download/$TSS2_REV/$TSS2_PKG.tar.gz
|
|
|
|
|
|
|
|
if test -d "$TSS2_DIR"; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-11-22 14:38:49 +00:00
|
|
|
echo "$ build_tss2()"
|
|
|
|
|
2020-01-30 10:09:04 +00:00
|
|
|
curl -L $TSS2_SRC | tar xz -C $DEPS_BUILD_DIR &&
|
2018-10-15 14:33:34 +00:00
|
|
|
cd $TSS2_DIR &&
|
2020-01-30 10:09:04 +00:00
|
|
|
./configure --prefix=$DEPS_PREFIX --disable-doxygen-doc &&
|
2018-11-09 15:14:23 +00:00
|
|
|
make -j4 >/dev/null &&
|
|
|
|
sudo make install >/dev/null &&
|
2018-10-15 14:33:34 +00:00
|
|
|
sudo ldconfig || exit $?
|
|
|
|
cd -
|
|
|
|
}
|
|
|
|
|
2020-01-30 10:09:04 +00:00
|
|
|
: ${TRAVIS_BUILD_DIR=$PWD}
|
|
|
|
: ${DEPS_BUILD_DIR=$TRAVIS_BUILD_DIR/..}
|
|
|
|
: ${DEPS_PREFIX=/usr/local}
|
2014-02-26 16:49:07 +00:00
|
|
|
|
|
|
|
TARGET=check
|
|
|
|
|
2014-03-01 07:49:52 +00:00
|
|
|
DEPS="libgmp-dev"
|
|
|
|
|
2014-05-08 13:14:33 +00:00
|
|
|
CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror"
|
|
|
|
|
2014-02-26 16:49:07 +00:00
|
|
|
case "$TEST" in
|
|
|
|
default)
|
2014-03-03 17:44:29 +00:00
|
|
|
# should be the default, but lets make sure
|
|
|
|
CONFIG="--with-printf-hooks=glibc"
|
2014-02-26 16:49:07 +00:00
|
|
|
;;
|
2018-11-22 14:38:49 +00:00
|
|
|
openssl*)
|
|
|
|
CONFIG="--disable-defaults --enable-pki --enable-openssl --enable-pem"
|
2019-05-07 11:43:45 +00:00
|
|
|
export TESTS_PLUGINS="test-vectors pem openssl!"
|
2014-03-01 07:49:52 +00:00
|
|
|
DEPS="libssl-dev"
|
2014-02-26 16:49:07 +00:00
|
|
|
;;
|
|
|
|
gcrypt)
|
2014-06-27 13:26:53 +00:00
|
|
|
CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1"
|
2019-05-07 11:43:45 +00:00
|
|
|
export TESTS_PLUGINS="test-vectors pkcs1 gcrypt!"
|
2014-03-01 07:49:52 +00:00
|
|
|
DEPS="libgcrypt11-dev"
|
2014-02-26 16:49:07 +00:00
|
|
|
;;
|
2018-08-08 09:35:46 +00:00
|
|
|
botan)
|
2018-10-22 15:55:13 +00:00
|
|
|
CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem"
|
2019-05-07 11:43:45 +00:00
|
|
|
export TESTS_PLUGINS="test-vectors pem botan!"
|
2018-08-08 09:35:46 +00:00
|
|
|
# we can't use the old package that comes with Ubuntu so we build from
|
|
|
|
# the current master until 2.8.0 is released and then probably switch to
|
|
|
|
# that unless we need newer features (at least 2.7.0 plus PKCS#1 patch is
|
|
|
|
# currently required)
|
|
|
|
DEPS=""
|
|
|
|
if test "$1" = "deps"; then
|
2018-09-12 10:05:14 +00:00
|
|
|
build_botan
|
2018-08-08 09:35:46 +00:00
|
|
|
fi
|
|
|
|
;;
|
2019-04-09 08:40:54 +00:00
|
|
|
wolfssl)
|
|
|
|
CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem"
|
2019-05-07 11:43:45 +00:00
|
|
|
export TESTS_PLUGINS="test-vectors pem wolfssl!"
|
2019-04-09 08:40:54 +00:00
|
|
|
# build with custom options to enable all the features the plugin supports
|
|
|
|
DEPS=""
|
|
|
|
if test "$1" = "deps"; then
|
|
|
|
build_wolfssl
|
|
|
|
fi
|
|
|
|
;;
|
2014-03-03 17:44:29 +00:00
|
|
|
printf-builtin)
|
|
|
|
CONFIG="--with-printf-hooks=builtin"
|
|
|
|
;;
|
2018-09-10 16:46:20 +00:00
|
|
|
all|coverage|sonarcloud)
|
2014-02-26 16:49:07 +00:00
|
|
|
CONFIG="--enable-all --disable-android-dns --disable-android-log
|
2018-09-12 09:02:32 +00:00
|
|
|
--disable-kernel-pfroute --disable-keychain
|
2017-03-08 10:00:22 +00:00
|
|
|
--disable-lock-profiler --disable-padlock --disable-fuzzing
|
2016-06-24 10:18:28 +00:00
|
|
|
--disable-osx-attr --disable-tkm --disable-uci
|
2019-12-12 12:54:44 +00:00
|
|
|
--disable-unwind-backtraces
|
2014-04-02 09:35:19 +00:00
|
|
|
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
|
2014-04-02 09:36:19 +00:00
|
|
|
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
|
2014-02-26 16:49:07 +00:00
|
|
|
# not enabled on the build server
|
|
|
|
CONFIG="$CONFIG --disable-af-alg"
|
2020-01-15 13:57:56 +00:00
|
|
|
if test "$TRAVIS_CPU_ARCH" != "amd64"; then
|
|
|
|
CONFIG="$CONFIG --disable-aesni --disable-rdrand"
|
|
|
|
fi
|
2017-03-15 09:19:02 +00:00
|
|
|
if test "$TEST" != "coverage"; then
|
|
|
|
CONFIG="$CONFIG --disable-coverage"
|
|
|
|
else
|
|
|
|
# not actually required but configure checks for it
|
|
|
|
DEPS="$DEPS lcov"
|
|
|
|
fi
|
2014-03-01 07:49:52 +00:00
|
|
|
DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
|
|
|
|
libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
|
2020-01-30 10:53:41 +00:00
|
|
|
libpcsclite-dev libpam0g-dev binutils-dev libnm-dev libgcrypt20-dev
|
2019-10-17 06:31:51 +00:00
|
|
|
libjson-c-dev iptables-dev python-pip libtspi-dev libsystemd-dev"
|
2020-02-13 15:34:27 +00:00
|
|
|
PYDEPS="tox"
|
2018-09-12 10:05:14 +00:00
|
|
|
if test "$1" = "deps"; then
|
|
|
|
build_botan
|
2019-04-09 08:40:54 +00:00
|
|
|
build_wolfssl
|
2018-10-15 14:33:34 +00:00
|
|
|
build_tss2
|
2018-09-12 10:05:14 +00:00
|
|
|
fi
|
2014-02-26 16:49:07 +00:00
|
|
|
;;
|
2014-06-05 12:07:21 +00:00
|
|
|
win*)
|
|
|
|
CONFIG="--disable-defaults --enable-svc --enable-ikev2
|
2014-05-08 15:08:42 +00:00
|
|
|
--enable-ikev1 --enable-static --enable-test-vectors --enable-nonce
|
|
|
|
--enable-constraints --enable-revocation --enable-pem --enable-pkcs1
|
|
|
|
--enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
|
|
|
|
--enable-eap-tnc --enable-eap-ttls --enable-eap-identity
|
2016-09-23 06:52:17 +00:00
|
|
|
--enable-updown --enable-ext-auth --enable-libipsec
|
2014-05-08 15:08:42 +00:00
|
|
|
--enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
|
|
|
|
--enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
|
2018-11-09 14:24:29 +00:00
|
|
|
--enable-pki --enable-swanctl --enable-socket-win
|
|
|
|
--enable-kernel-iph --enable-kernel-wfp --enable-winhttp"
|
2017-07-19 10:34:35 +00:00
|
|
|
# no make check for Windows binaries unless we run on a windows host
|
|
|
|
if test "$APPVEYOR" != "True"; then
|
|
|
|
TARGET=
|
2018-11-13 17:59:38 +00:00
|
|
|
CCACHE=ccache
|
2017-07-28 08:12:33 +00:00
|
|
|
else
|
|
|
|
CONFIG="$CONFIG --enable-openssl"
|
|
|
|
CFLAGS="$CFLAGS -I/c/OpenSSL-$TEST/include"
|
|
|
|
LDFLAGS="-L/c/OpenSSL-$TEST"
|
|
|
|
export LDFLAGS
|
2017-07-19 10:34:35 +00:00
|
|
|
fi
|
2014-05-08 15:08:42 +00:00
|
|
|
CFLAGS="$CFLAGS -mno-ms-bitfields"
|
2016-08-25 12:04:22 +00:00
|
|
|
DEPS="gcc-mingw-w64-base"
|
2014-06-05 12:07:21 +00:00
|
|
|
case "$TEST" in
|
|
|
|
win64)
|
2018-11-09 14:24:29 +00:00
|
|
|
CONFIG="--host=x86_64-w64-mingw32 $CONFIG --enable-dbghelp-backtraces"
|
2016-08-25 12:04:22 +00:00
|
|
|
DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS"
|
2018-11-13 17:59:38 +00:00
|
|
|
CC="$CCACHE x86_64-w64-mingw32-gcc"
|
2014-06-05 12:07:21 +00:00
|
|
|
;;
|
|
|
|
win32)
|
|
|
|
CONFIG="--host=i686-w64-mingw32 $CONFIG"
|
2018-11-09 14:24:29 +00:00
|
|
|
DEPS="gcc-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-i686-dev $DEPS"
|
2018-11-13 17:59:38 +00:00
|
|
|
CC="$CCACHE i686-w64-mingw32-gcc"
|
2014-06-05 12:07:21 +00:00
|
|
|
;;
|
|
|
|
esac
|
2014-05-08 15:08:42 +00:00
|
|
|
;;
|
2015-11-16 15:44:03 +00:00
|
|
|
osx)
|
2017-12-08 08:59:13 +00:00
|
|
|
# this causes a false positive in ip-packet.c since Xcode 8.3
|
|
|
|
CFLAGS="$CFLAGS -Wno-address-of-packed-member"
|
2015-11-16 15:44:03 +00:00
|
|
|
# use the same options as in the Homebrew Formula
|
|
|
|
CONFIG="--disable-defaults --enable-charon --enable-cmd --enable-constraints
|
|
|
|
--enable-curl --enable-eap-gtc --enable-eap-identity
|
|
|
|
--enable-eap-md5 --enable-eap-mschapv2 --enable-ikev1 --enable-ikev2
|
|
|
|
--enable-kernel-libipsec --enable-kernel-pfkey
|
|
|
|
--enable-kernel-pfroute --enable-nonce --enable-openssl
|
|
|
|
--enable-osx-attr --enable-pem --enable-pgp --enable-pkcs1
|
|
|
|
--enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation
|
|
|
|
--enable-scepclient --enable-socket-default --enable-sshkey
|
|
|
|
--enable-stroke --enable-swanctl --enable-unity --enable-updown
|
|
|
|
--enable-x509 --enable-xauth-generic"
|
|
|
|
DEPS="bison gettext openssl curl"
|
|
|
|
BREW_PREFIX=$(brew --prefix)
|
|
|
|
export PATH=$BREW_PREFIX/opt/bison/bin:$PATH
|
|
|
|
export ACLOCAL_PATH=$BREW_PREFIX/opt/gettext/share/aclocal:$ACLOCAL_PATH
|
|
|
|
for pkg in openssl curl
|
|
|
|
do
|
2016-09-23 08:08:13 +00:00
|
|
|
PKG_CONFIG_PATH=$BREW_PREFIX/opt/$pkg/lib/pkgconfig:$PKG_CONFIG_PATH
|
2015-11-16 15:44:03 +00:00
|
|
|
CPPFLAGS="-I$BREW_PREFIX/opt/$pkg/include $CPPFLAGS"
|
|
|
|
LDFLAGS="-L$BREW_PREFIX/opt/$pkg/lib $LDFLAGS"
|
|
|
|
done
|
|
|
|
export PKG_CONFIG_PATH
|
|
|
|
export CPPFLAGS
|
|
|
|
export LDFLAGS
|
|
|
|
;;
|
2019-08-27 16:22:33 +00:00
|
|
|
freebsd)
|
|
|
|
# use the options of the FreeBSD port (including options), except smp,
|
|
|
|
# which requires a patch but is deprecated anyway, only using the builtin
|
|
|
|
# printf hooks
|
|
|
|
CONFIG="--enable-kernel-pfkey --enable-kernel-pfroute --disable-scripts
|
|
|
|
--disable-kernel-netlink --enable-openssl --enable-eap-identity
|
|
|
|
--enable-eap-md5 --enable-eap-tls --enable-eap-mschapv2
|
|
|
|
--enable-eap-peap --enable-eap-ttls --enable-md4 --enable-blowfish
|
|
|
|
--enable-addrblock --enable-whitelist --enable-cmd --enable-curl
|
|
|
|
--enable-eap-aka --enable-eap-aka-3gpp2 --enable-eap-dynamic
|
|
|
|
--enable-eap-radius --enable-eap-sim --enable-eap-sim-file
|
|
|
|
--enable-gcm --enable-ipseckey --enable-kernel-libipsec
|
|
|
|
--enable-load-tester --enable-ldap --enable-mediation
|
|
|
|
--enable-mysql --enable-sqlite --enable-tpm --enable-unbound
|
|
|
|
--enable-unity --enable-xauth-eap --enable-xauth-pam
|
|
|
|
--with-printf-hooks=builtin --enable-attr-sql --enable-sql"
|
|
|
|
DEPS="gmp openldap-client libxml2 mysql80-client sqlite3 unbound ldns"
|
|
|
|
export GPERF=/usr/local/bin/gperf
|
|
|
|
export LEX=/usr/local/bin/flex
|
|
|
|
;;
|
2017-05-30 16:41:31 +00:00
|
|
|
fuzzing)
|
|
|
|
CFLAGS="$CFLAGS -DNO_CHECK_MEMWIPE"
|
2018-03-02 12:35:30 +00:00
|
|
|
CONFIG="--enable-fuzzing --enable-static --disable-shared --disable-scripts
|
2018-03-09 13:40:00 +00:00
|
|
|
--enable-imc-test --enable-tnccs-20"
|
2017-05-30 16:41:31 +00:00
|
|
|
# don't run any of the unit tests
|
|
|
|
export TESTS_RUNNERS=
|
|
|
|
# prepare corpora
|
|
|
|
if test -z "$1"; then
|
|
|
|
if test -z "$FUZZING_CORPORA"; then
|
|
|
|
git clone --depth 1 https://github.com/strongswan/fuzzing-corpora.git fuzzing-corpora
|
|
|
|
export FUZZING_CORPORA=$TRAVIS_BUILD_DIR/fuzzing-corpora
|
|
|
|
fi
|
2017-05-30 17:38:31 +00:00
|
|
|
# these are about the same as those on OSS-Fuzz (except for the
|
|
|
|
# symbolize options and strip_path_prefix)
|
|
|
|
export ASAN_OPTIONS=redzone=16:handle_sigill=1:strict_string_check=1:\
|
|
|
|
allocator_release_to_os_interval_ms=500:strict_memcmp=1:detect_container_overflow=1:\
|
|
|
|
coverage=0:allocator_may_return_null=1:use_sigaltstack=1:detect_stack_use_after_return=1:\
|
|
|
|
alloc_dealloc_mismatch=0:detect_leaks=1:print_scariness=1:max_uar_stack_size_log=16:\
|
|
|
|
handle_abort=1:check_malloc_usable_size=0:quarantine_size_mb=10:detect_odr_violation=0:\
|
|
|
|
symbolize=1:handle_segv=1:fast_unwind_on_fatal=0:external_symbolizer_path=/usr/bin/llvm-symbolizer-3.5
|
2017-05-30 16:41:31 +00:00
|
|
|
fi
|
|
|
|
;;
|
2014-02-26 16:49:07 +00:00
|
|
|
dist)
|
|
|
|
TARGET=distcheck
|
|
|
|
;;
|
2016-06-30 08:34:54 +00:00
|
|
|
apidoc)
|
|
|
|
DEPS="doxygen"
|
|
|
|
CONFIG="--disable-defaults"
|
|
|
|
TARGET=apidoc
|
|
|
|
;;
|
2020-01-28 15:15:45 +00:00
|
|
|
lgtm)
|
|
|
|
DEPS="jq"
|
|
|
|
|
|
|
|
if test -z "$1"; then
|
|
|
|
# fall back to the parent of the latest commit (on new branches we might
|
|
|
|
# not have a range, also on duplicate branches)
|
|
|
|
base="${TRAVIS_COMMIT}^"
|
|
|
|
if test -n "$TRAVIS_COMMIT_RANGE"; then
|
|
|
|
base="${TRAVIS_COMMIT_RANGE%...*}"
|
|
|
|
# after rebases, the first commit ID in the range might not be valid
|
|
|
|
git rev-parse -q --verify $base
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
# this will always compare against master, while the range
|
|
|
|
# otherwise only contains "new" commits
|
|
|
|
base=$(git merge-base origin/master ${TRAVIS_COMMIT})
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
base=$(git rev-parse $base)
|
|
|
|
project_id=1506185006272
|
|
|
|
|
|
|
|
echo "Starting code review for $TRAVIS_COMMIT (base $base) on lgtm.com"
|
|
|
|
git diff --binary $base > lgtm.patch || exit $?
|
|
|
|
curl -s -X POST --data-binary @lgtm.patch \
|
|
|
|
"https://lgtm.com/api/v1.0/codereviews/${project_id}?base=${base}&external-id=${TRAVIS_BUILD_NUMBER}" \
|
|
|
|
-H 'Content-Type: application/octet-stream' \
|
|
|
|
-H 'Accept: application/json' \
|
|
|
|
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res || exit $?
|
|
|
|
lgtm_check_url=$(jq -r '."task-result-url"' lgtm.res)
|
2020-02-12 16:49:14 +00:00
|
|
|
if [ "$lgtm_check_url" = "null" ]; then
|
2020-01-28 15:15:45 +00:00
|
|
|
cat lgtm.res | jq
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
lgtm_url=$(jq -r '."task-result"."results-url"' lgtm.res)
|
|
|
|
echo "Progress and full results: ${lgtm_url}"
|
|
|
|
|
|
|
|
echo -n "Waiting for completion: "
|
|
|
|
lgtm_status=pending
|
|
|
|
while [ "$lgtm_status" = "pending" ]; do
|
|
|
|
sleep 15
|
|
|
|
curl -s -X GET "${lgtm_check_url}" \
|
|
|
|
-H 'Accept: application/json' \
|
|
|
|
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo -n "-"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo -n "."
|
|
|
|
lgtm_status=$(jq -r '.status' lgtm.res)
|
|
|
|
done
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
if [ "$lgtm_status" != "success" ]; then
|
|
|
|
lgtm_message=$(jq -r '.["status-message"]' lgtm.res)
|
|
|
|
echo "Code review failed: ${lgtm_message}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
lgtm_new=$(jq -r '.languages[].new' lgtm.res | awk '{t+=$1} END {print t}')
|
|
|
|
lgtm_fixed=$(jq -r '.languages[].fixed' lgtm.res | awk '{t+=$1} END {print t}')
|
|
|
|
echo -n "Code review complete: "
|
2020-02-12 16:49:14 +00:00
|
|
|
printf "%b\n" "\e[1;31m${lgtm_new}\e[0m new alerts, \e[1;32m${lgtm_fixed}\e[0m fixed"
|
2020-01-28 15:15:45 +00:00
|
|
|
exit $lgtm_new
|
|
|
|
fi
|
|
|
|
;;
|
2014-02-26 16:49:07 +00:00
|
|
|
*)
|
|
|
|
echo "$0: unknown test $TEST" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2014-03-01 07:49:52 +00:00
|
|
|
if test "$1" = "deps"; then
|
2015-11-16 15:44:03 +00:00
|
|
|
case "$TRAVIS_OS_NAME" in
|
|
|
|
linux)
|
|
|
|
sudo apt-get update -qq && \
|
|
|
|
sudo apt-get install -qq bison flex gperf gettext $DEPS
|
|
|
|
;;
|
|
|
|
osx)
|
|
|
|
brew update && \
|
|
|
|
brew install $DEPS
|
|
|
|
;;
|
2019-08-27 16:22:33 +00:00
|
|
|
freebsd)
|
|
|
|
pkg install -y automake autoconf libtool pkgconf && \
|
|
|
|
pkg install -y bison flex gperf gettext $DEPS
|
|
|
|
;;
|
2015-11-16 15:44:03 +00:00
|
|
|
esac
|
2014-03-01 07:49:52 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2015-03-18 13:28:17 +00:00
|
|
|
if test "$1" = "pydeps"; then
|
2018-08-06 09:54:24 +00:00
|
|
|
test -z "$PYDEPS" || pip -q install --user $PYDEPS
|
2015-03-18 13:28:17 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2014-02-26 16:49:07 +00:00
|
|
|
CONFIG="$CONFIG
|
2015-11-16 15:44:03 +00:00
|
|
|
--disable-dependency-tracking
|
2014-02-26 16:49:07 +00:00
|
|
|
--enable-silent-rules
|
|
|
|
--enable-test-vectors
|
|
|
|
--enable-monolithic=${MONOLITHIC-no}
|
|
|
|
--enable-leak-detective=${LEAK_DETECTIVE-no}"
|
|
|
|
|
2015-11-16 15:44:03 +00:00
|
|
|
echo "$ ./autogen.sh"
|
|
|
|
./autogen.sh || exit $?
|
2016-06-30 08:34:54 +00:00
|
|
|
echo "$ CC=$CC CFLAGS=\"$CFLAGS\" ./configure $CONFIG"
|
|
|
|
CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG || exit $?
|
|
|
|
|
|
|
|
case "$TEST" in
|
|
|
|
apidoc)
|
|
|
|
exec 2>make.warnings
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "$ make $TARGET"
|
2018-09-10 16:46:20 +00:00
|
|
|
case "$TEST" in
|
|
|
|
sonarcloud)
|
2019-10-17 06:31:51 +00:00
|
|
|
# there is an issue with the platform detection that causes sonarqube to
|
|
|
|
# fail on bionic with "ERROR: ld.so: object '...libinterceptor-${PLATFORM}.so'
|
|
|
|
# from LD_PRELOAD cannot be preloaded (cannot open shared object file)"
|
|
|
|
# https://jira.sonarsource.com/browse/CPP-2027
|
|
|
|
BW_PATH=$(dirname $(which build-wrapper-linux-x86-64))
|
|
|
|
cp $BW_PATH/libinterceptor-x86_64.so $BW_PATH/libinterceptor-haswell.so
|
2018-09-10 16:46:20 +00:00
|
|
|
# without target, coverage is currently not supported anyway because
|
|
|
|
# sonarqube only supports gcov, not lcov
|
|
|
|
build-wrapper-linux-x86-64 --out-dir bw-output make -j4 || exit $?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
make -j4 $TARGET || exit $?
|
|
|
|
;;
|
|
|
|
esac
|
2016-06-30 08:34:54 +00:00
|
|
|
|
|
|
|
case "$TEST" in
|
|
|
|
apidoc)
|
|
|
|
if test -s make.warnings; then
|
|
|
|
cat make.warnings
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-04 15:41:53 +00:00
|
|
|
rm make.warnings
|
2016-06-30 08:34:54 +00:00
|
|
|
;;
|
2018-09-10 16:46:20 +00:00
|
|
|
sonarcloud)
|
|
|
|
sonar-scanner \
|
|
|
|
-Dsonar.projectKey=strongswan \
|
|
|
|
-Dsonar.projectVersion=$(git describe)+${TRAVIS_BUILD_NUMBER} \
|
|
|
|
-Dsonar.sources=. \
|
2018-11-13 11:08:43 +00:00
|
|
|
-Dsonar.cfamily.threads=2 \
|
2018-09-10 16:46:20 +00:00
|
|
|
-Dsonar.cfamily.build-wrapper-output=bw-output || exit $?
|
2019-04-04 15:41:53 +00:00
|
|
|
rm -r bw-output .scannerwork
|
2018-09-10 16:46:20 +00:00
|
|
|
;;
|
2016-06-30 08:34:54 +00:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2019-04-04 15:41:53 +00:00
|
|
|
|
|
|
|
# ensure there are no unignored build artifacts (or other changes) in the Git repo
|
|
|
|
unclean="$(git status --porcelain)"
|
|
|
|
if test -n "$unclean"; then
|
|
|
|
echo "Unignored build artifacts or other changes:"
|
|
|
|
echo "$unclean"
|
|
|
|
exit 1
|
|
|
|
fi
|