diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2019-12-15 17:50:27 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2019-12-16 09:49:03 +0000 |
commit | e40b1f72adf06793b8b9ef94d8bef46f7aba0f04 (patch) | |
tree | ebfbf5e9c4abe03c8c62e0509937a5bd6dab3095 /ci | |
parent | 4badb00e44b3648bb586ea66c6783f712b49ea26 (diff) | |
download | pam-e40b1f72adf06793b8b9ef94d8bef46f7aba0f04.tar.gz pam-e40b1f72adf06793b8b9ef94d8bef46f7aba0f04.tar.bz2 pam-e40b1f72adf06793b8b9ef94d8bef46f7aba0f04.zip |
Add initial Travis CI support
This runs "make distcheck" using gcc-9, gcc-8, gcc-7, and clang
on x86_64, x86, x32, aarch64, s390x, and ppc64le architectures.
* .travis.yml: New file.
* ci/install-dependencies.sh: Likewise.
* ci/run-build-and-tests.sh: Likewise.
Resolves: https://github.com/linux-pam/linux-pam/issues/28
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/install-dependencies.sh | 83 | ||||
-rwxr-xr-x | ci/run-build-and-tests.sh | 88 |
2 files changed, 171 insertions, 0 deletions
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh new file mode 100755 index 00000000..aaeaf389 --- /dev/null +++ b/ci/install-dependencies.sh @@ -0,0 +1,83 @@ +#!/bin/sh -ex +# +# Copyright (c) 2018-2019 The strace developers. +# All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +j=-j`nproc` || j= +type sudo >/dev/null 2>&1 && sudo=sudo || sudo= +packages=" +autoconf +automake +autopoint +bison +bzip2 +docbook-xml +docbook-xsl +flex +gettext +libaudit-dev +libcrack2-dev +libdb-dev +libfl-dev +libselinux1-dev +libtool +libxcrypt-dev +libxml2-utils +make +pkg-config +sed +w3m +xsltproc +xz-utils +$CC" + +retry_if_failed() +{ + for i in `seq 0 99`; do + "$@" && i= && break || sleep 1 + done + [ -z "$i" ] +} + +updated= +apt_get_install() +{ + [ -n "$updated" ] || { + retry_if_failed $sudo apt-get -qq update + updated=1 + } + retry_if_failed $sudo \ + apt-get -qq --no-install-suggests --no-install-recommends \ + install -y "$@" +} + +case "$CC" in + gcc-*) + retry_if_failed \ + $sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + ;; +esac + +case "$TARGET" in + x32|x86) + packages="$packages gcc-multilib" + case "$CC" in + gcc-*) packages="$packages $CC-multilib" ;; + esac + ;; +esac + +apt_get_install $packages + +case "${CHECK-}" in + coverage) + apt_get_install lcov python-pip python-setuptools + retry_if_failed \ + pip install --user codecov + ;; + valgrind) + apt_get_install valgrind + ;; +esac diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh new file mode 100755 index 00000000..db55bdd0 --- /dev/null +++ b/ci/run-build-and-tests.sh @@ -0,0 +1,88 @@ +#!/bin/sh -ex +# +# Copyright (c) 2018-2019 The strace developers. +# All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking' +export DISTCHECK_CONFIGURE_FLAGS + +case "${TARGET-}" in + x32) + CC="$CC -mx32" + ;; + x86) + CC="$CC -m32" + DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu" + ;; +esac + +CPPFLAGS= + +case "${CHECK-}" in + coverage) + DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-code-coverage" + CFLAGS='-g -O0' + CFLAGS_FOR_BUILD="$CFLAGS" + export CFLAGS CFLAGS_FOR_BUILD + ;; + valgrind) + DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-valgrind" + ;; +esac + +echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION' +uname -a |head -1 +libc="$(ldd /bin/sh |sed -n 's|^[^/]*\(/[^ ]*/libc\.so[^ ]*\).*|\1|p' |head -1)" +$libc |head -1 +$CC --version |head -1 +make --version |head -1 +autoconf --version |head -1 +automake --version |head -1 +libtoolize --version |head -1 +kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC $CPPFLAGS -E -P -)" +printf 'kernel-headers %s.%s.%s\n' $(($kver/65536)) $(($kver/256%256)) $(($kver%256)) +echo 'END OF BUILD ENVIRONMENT INFORMATION' + +export CC_FOR_BUILD="$CC" + +./autogen.sh +./configure $DISTCHECK_CONFIGURE_FLAGS \ + || { + rc=$? + cat config.log + echo "$CC -dumpspecs follows" + $CC -dumpspecs + exit $rc +} + +j=-j`nproc` || j= + +case "${CHECK-}" in + coverage) + make -k $j all VERBOSE=${VERBOSE-} + make -k $j check VERBOSE=${VERBOSE-} + codecov --gcov-args=-abcp ||: + echo 'BEGIN OF TEST SUITE INFORMATION' + tail -n 99999 -- tests*/test-suite.log + echo 'END OF TEST SUITE INFORMATION' + ;; + valgrind) + make -k $j all VERBOSE=${VERBOSE-} + rc=$? + for n in ${VALGRIND_TOOLS:-memcheck helgrind drd}; do + make -k $j -C "${VALGRIND_TESTDIR:-.}" \ + check-valgrind-$n VERBOSE=${VERBOSE-} || + rc=$? + done + echo 'BEGIN OF TEST SUITE INFORMATION' + tail -n 99999 -- tests*/test-suite*.log || + rc=$? + echo 'END OF TEST SUITE INFORMATION' + [ "$rc" -eq 0 ] + ;; + *) + make -k $j distcheck VERBOSE=${VERBOSE-} + ;; +esac |