[PATCH] Add initial Travis CI support
by Dmitry V. Levin
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
---
I've also pushed it to ldv/travis-ci branch.
.travis.yml | 115 +++++++++++++++++++++++++++++++++++++
ci/install-dependencies.sh | 83 ++++++++++++++++++++++++++
ci/run-build-and-tests.sh | 88 ++++++++++++++++++++++++++++
3 files changed, 286 insertions(+)
create mode 100644 .travis.yml
create mode 100755 ci/install-dependencies.sh
create mode 100755 ci/run-build-and-tests.sh
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..ae627ed4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,115 @@
+language: c
+
+dist: bionic
+
+before_install: ci/install-dependencies.sh
+
+script: ci/run-build-and-tests.sh
+
+sudo: required
+
+git:
+ depth: 2147483647
+
+env:
+ global:
+ - VERBOSE=1
+
+matrix:
+ include:
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc-9
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc-8
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: clang
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc-9
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc-8
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: clang
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: gcc-9
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: gcc-8
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: clang
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
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
--
ldv
4 years
Further fixes for warnings
by Tomas Mraz
In many cases it is impossible to avoid casting out the const so I had
to add -Wno-cast-qual to individual CFLAGS.
IMO explicit cast out should be allowed so we might as well consider
dropping this warning flag from the configure.
OK to commit as is? Or alternatively I can drop -Wcast-qual from
configure.
--
Tomáš Mráz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
[You'll know whether the road is wrong if you carefully listen to your
conscience.]
4 years, 2 months
Fix all warnings encountered with -Wall -Wextra options
by Tomas Mraz
The attached patch fixes all warnings encountered in build with -Wall
-Wextra options with gcc-9.2.1.
I had to suppress two warnings for bison/flex generated code.
OK to commit?
--
Tomáš Mráz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
[You'll know whether the road is wrong if you carefully listen to your
conscience.]
4 years, 4 months
[PATCH] pam_pwhistory: fix build when -lxcrypt is not available
by Dmitry V. Levin
When xcrypt.h is available but -lxcrypt is not, pam_pwhistory fails to
build with the following diagnostics:
modules/pam_pwhistory/opasswd.c:111: undefined reference to `xcrypt_r'
Fix this by using the same check for xcrypt as in other modules.
* modules/pam_pwhistory/opasswd.c: Replace HAVE_XCRYPT_H with
HAVE_LIBXCRYPT.
---
modules/pam_pwhistory/opasswd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
index 813f579c..77142f2c 100644
--- a/modules/pam_pwhistory/opasswd.c
+++ b/modules/pam_pwhistory/opasswd.c
@@ -49,7 +49,7 @@
#include <syslog.h>
#include <sys/stat.h>
-#if defined (HAVE_XCRYPT_H)
+#if defined HAVE_LIBXCRYPT
#include <xcrypt.h>
#elif defined (HAVE_CRYPT_H)
#include <crypt.h>
--
ldv
4 years, 4 months