diff options
-rw-r--r-- | .travis.yml | 12 | ||||
-rw-r--r-- | .travis/autotools/after_failure.sh | 3 | ||||
-rw-r--r-- | .travis/autotools/after_success.sh | 13 | ||||
-rw-r--r-- | .travis/autotools/before_install.sh | 9 | ||||
-rw-r--r-- | .travis/autotools/install.sh | 14 | ||||
-rw-r--r-- | .travis/autotools/script.sh | 12 | ||||
-rw-r--r-- | .travis/linux/after_failure.sh | 2 | ||||
-rw-r--r-- | .travis/linux/after_success.sh | 10 | ||||
-rw-r--r-- | .travis/linux/before_install.sh | 4 | ||||
-rw-r--r-- | .travis/linux/script.sh | 33 | ||||
-rw-r--r-- | build/cross_file_mingw64.txt | 18 |
11 files changed, 106 insertions, 24 deletions
diff --git a/.travis.yml b/.travis.yml index 1be53bd..ce8230a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,27 +3,27 @@ matrix: - os: linux sudo: required services: docker - env: BUILD_OPTS="" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="" + env: SRCDIR=/srcdir BUILDDIR=/builddir - os: linux sudo: required services: docker - env: BUILD_OPTS="--enable-coverage" COVERAGE=yes SRCDIR=/coverage BUILDDIR=/coverage EXTRA_PKGS="lcov python-pip" + env: PROFILE=autotools BUILD_OPTS="--enable-coverage" COVERAGE=yes SRCDIR=/coverage BUILDDIR=/coverage EXTRA_PKGS="lcov python-pip" - os: linux sudo: required services: docker - env: BUILD_OPTS="CFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' CXXFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' LDFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' LIBS='-lasan -ldl -lpthread'" SRCDIR=/srcdir BUILDDIR=/builddir PRELOAD_CMD='ls -1 /usr/lib64/libasan.so.* | head -1' LSAN_OPTIONS='suppressions=/srcdir/build/lsan.supp' EXTRA_PKGS="libasan" + env: MESON_BUILD_OPTS="-Db_sanitize=address" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="libasan" - os: linux sudo: required services: docker - env: BUILD_OPTS="CFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' CXXFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' LDFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' LIBS='-lubsan -ldl -lpthread'" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="libubsan" + env: MESON_BUILD_OPTS="-Db_sanitize=undefined" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="libubsan" - os: linux sudo: required services: docker - env: BUILD_OPTS="" SCAN_BUILD="scan-build --status-bugs" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="clang-analyzer" + env: MESON_BUILD_OPTS="" SCAN_BUILD="scan-build --status-bugs" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="clang-analyzer" - os: linux sudo: required services: docker - env: BUILD_OPTS="--host=x86_64-w64-mingw32 --without-libffi" CHECK_OPTS="LOG_COMPILER=/srcdir/build/wine-wrapper.sh" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="mingw64-gcc mingw64-libffi mingw64-libtasn1 wine" + env: MESON_BUILD_OPTS="--cross-file build/cross_file_mingw64.txt" MESON_TEST_ENV="WINEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw/bin" MESON_TEST_OPTS="--num-processes 1" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="mingw64-gcc mingw64-libffi mingw64-libtasn1 wine" - os: linux sudo: required services: docker diff --git a/.travis/autotools/after_failure.sh b/.travis/autotools/after_failure.sh new file mode 100644 index 0000000..9d65133 --- /dev/null +++ b/.travis/autotools/after_failure.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && cat test-suite.log" diff --git a/.travis/autotools/after_success.sh b/.travis/autotools/after_success.sh new file mode 100644 index 0000000..6c648a2 --- /dev/null +++ b/.travis/autotools/after_success.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if test x"$COVERAGE" = xyes; then + # docker exec $CONTAINER pip install cpp-coveralls + + # manually install cpp-coveralls until the gcov fix has been + # incorporated in the pip version + docker exec $CONTAINER sh -c "cd /tmp && rm -rf cpp-coveralls && git clone -q https://github.com/eddyxu/cpp-coveralls && cd cpp-coveralls && python setup.py build && python setup.py install" + docker exec \ + -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" \ + -e TRAVIS_BRANCH="$TRAVIS_BRANCH" \ + $CONTAINER sh -c "cd $BUILDDIR && cpp-coveralls -b $BUILDDIR -E '(^|.*/)(frob|mock|test)-.*|(^|.*/)(virtual-fixed-generated\.h)' --gcov-options '\-lp'" +fi diff --git a/.travis/autotools/before_install.sh b/.travis/autotools/before_install.sh new file mode 100644 index 0000000..454b9eb --- /dev/null +++ b/.travis/autotools/before_install.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +docker pull fedora +export CONTAINER=$(docker run -d fedora sleep 1800) + +docker exec $CONTAINER dnf -y install 'dnf-command(builddep)' +docker exec $CONTAINER dnf -y builddep p11-kit +docker exec $CONTAINER dnf -y install gettext-devel git libtool make opensc openssl valgrind $EXTRA_PKGS +docker exec $CONTAINER useradd user diff --git a/.travis/autotools/install.sh b/.travis/autotools/install.sh new file mode 100644 index 0000000..a7257d0 --- /dev/null +++ b/.travis/autotools/install.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +docker cp . $CONTAINER:/srcdir +docker exec $CONTAINER cp -R /srcdir /coverage +docker exec $CONTAINER mkdir /builddir +docker exec $CONTAINER chown -R user /builddir +docker exec $CONTAINER mkdir /installdir +docker exec $CONTAINER mkdir -p /installdir/etc/pki/ca-trust-source +docker exec $CONTAINER mkdir -p /installdir/share/pki/ca-trust-source +docker exec $CONTAINER chown -R user /installdir +# FIXME: This is needed because some files are included in distribution +# and need to be generated in $srcdir rather than $builddir +docker exec $CONTAINER chown -R user /srcdir +docker exec $CONTAINER chown -R user /coverage diff --git a/.travis/autotools/script.sh b/.travis/autotools/script.sh new file mode 100644 index 0000000..c8ad2e3 --- /dev/null +++ b/.travis/autotools/script.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +docker exec $CONTAINER sh -c "cd $SRCDIR && NOCONFIGURE=1 ./autogen.sh" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && $SRCDIR/configure --enable-strict --prefix=/installdir --libdir=/installdir/lib --sysconfdir=/installdir/etc --with-trust-paths=/installdir/etc/pki/ca-trust-source:/installdir/share/pki/ca-trust-source $BUILD_OPTS" +if test -n "$PRELOAD_CMD"; then + P11_KIT_TEST_LD_PRELOAD=$(docker exec $CONTAINER su - user sh -c "$PRELOAD_CMD") +fi +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && $SCAN_BUILD make -j$(nproc) V=1" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && P11_KIT_DEBUG=all LSAN_OPTIONS="$LSAN_OPTIONS" P11_KIT_TEST_LD_PRELOAD=\"$P11_KIT_TEST_LD_PRELOAD\" make check -j$(nproc) V=1 $CHECK_OPTS" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && make install" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && make installcheck" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && valgrind --error-exitcode=81 pkcs11-tool --module p11-kit-proxy.so -L; test $? != 81" diff --git a/.travis/linux/after_failure.sh b/.travis/linux/after_failure.sh index 9d65133..e060eb1 100644 --- a/.travis/linux/after_failure.sh +++ b/.travis/linux/after_failure.sh @@ -1,3 +1,3 @@ #!/bin/sh -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && cat test-suite.log" +docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && cat meson-logs/testlog.txt" diff --git a/.travis/linux/after_success.sh b/.travis/linux/after_success.sh index 6c648a2..ff3d31c 100644 --- a/.travis/linux/after_success.sh +++ b/.travis/linux/after_success.sh @@ -1,13 +1,11 @@ #!/bin/sh -if test x"$COVERAGE" = xyes; then - # docker exec $CONTAINER pip install cpp-coveralls +set +x - # manually install cpp-coveralls until the gcov fix has been - # incorporated in the pip version - docker exec $CONTAINER sh -c "cd /tmp && rm -rf cpp-coveralls && git clone -q https://github.com/eddyxu/cpp-coveralls && cd cpp-coveralls && python setup.py build && python setup.py install" +if test x"$COVERAGE" = xyes; then + docker exec $CONTAINER su user sh -c "pip3 install --user cpp-coveralls" docker exec \ -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" \ -e TRAVIS_BRANCH="$TRAVIS_BRANCH" \ - $CONTAINER sh -c "cd $BUILDDIR && cpp-coveralls -b $BUILDDIR -E '(^|.*/)(frob|mock|test)-.*|(^|.*/)(virtual-fixed-generated\.h)' --gcov-options '\-lp'" + $CONTAINER su user sh -c "cd $SRCDIR && /home/user/.local/bin/cpp-coveralls -b $BUILDDIR -E '(^|.*/)(frob|mock|test)-.*|(^|.*/)(virtual-fixed-generated\.c)' --gcov-options '\-lp'" fi diff --git a/.travis/linux/before_install.sh b/.travis/linux/before_install.sh index 454b9eb..fb996d1 100644 --- a/.travis/linux/before_install.sh +++ b/.travis/linux/before_install.sh @@ -1,9 +1,11 @@ #!/bin/sh +set -e + docker pull fedora export CONTAINER=$(docker run -d fedora sleep 1800) docker exec $CONTAINER dnf -y install 'dnf-command(builddep)' docker exec $CONTAINER dnf -y builddep p11-kit -docker exec $CONTAINER dnf -y install gettext-devel git libtool make opensc openssl valgrind $EXTRA_PKGS +docker exec $CONTAINER dnf -y install gettext-devel git libtool make opensc openssl valgrind meson ninja-build $EXTRA_PKGS docker exec $CONTAINER useradd user diff --git a/.travis/linux/script.sh b/.travis/linux/script.sh index c8ad2e3..24d48be 100644 --- a/.travis/linux/script.sh +++ b/.travis/linux/script.sh @@ -1,12 +1,25 @@ #!/bin/sh -docker exec $CONTAINER sh -c "cd $SRCDIR && NOCONFIGURE=1 ./autogen.sh" -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && $SRCDIR/configure --enable-strict --prefix=/installdir --libdir=/installdir/lib --sysconfdir=/installdir/etc --with-trust-paths=/installdir/etc/pki/ca-trust-source:/installdir/share/pki/ca-trust-source $BUILD_OPTS" -if test -n "$PRELOAD_CMD"; then - P11_KIT_TEST_LD_PRELOAD=$(docker exec $CONTAINER su - user sh -c "$PRELOAD_CMD") -fi -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && $SCAN_BUILD make -j$(nproc) V=1" -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && P11_KIT_DEBUG=all LSAN_OPTIONS="$LSAN_OPTIONS" P11_KIT_TEST_LD_PRELOAD=\"$P11_KIT_TEST_LD_PRELOAD\" make check -j$(nproc) V=1 $CHECK_OPTS" -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && make install" -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && make installcheck" -docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && valgrind --error-exitcode=81 pkcs11-tool --module p11-kit-proxy.so -L; test $? != 81" +docker exec $CONTAINER su - user sh -c "cd $SRCDIR && meson $BUILDDIR -Dstrict=true -Dprefix=/installdir -Dlibdir=/installdir/lib -Dsysconfdir=/installdir/etc -Dtrust-paths=/installdir/etc/pki/ca-trust-source:/installdir/share/pki/ca-trust-source $MESON_BUILD_OPTS" +if test $? -ne 0; then + exit 1 +fi + +if test -n "$SCAN_BUILD"; then + docker exec $CONTAINER su - user sh -c "cd $SRCDIR && SCAN_BUILD='$SCAN_BUILD' ninja scan-build -C $BUILDDIR" +else + docker exec $CONTAINER su - user sh -c "cd $SRCDIR && ninja -C $BUILDDIR" +fi +if test $? -ne 0; then + exit 1 +fi + +docker exec $CONTAINER su - user sh -c "cd $SRCDIR && P11_KIT_DEBUG=all $MESON_TEST_ENV meson test -C $BUILDDIR $MESON_TEST_OPTS || cat $BUILDDIR/meson-logs/testlog.txt" +if test $? -ne 0; then + exit 1 +fi + +docker exec $CONTAINER su - user sh -c "cd $SRCDIR && ninja -C $BUILDDIR install" +if test $? -ne 0; then + exit 1 +fi diff --git a/build/cross_file_mingw64.txt b/build/cross_file_mingw64.txt new file mode 100644 index 0000000..cc776c3 --- /dev/null +++ b/build/cross_file_mingw64.txt @@ -0,0 +1,18 @@ +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[properties] +c_args = [] +c_link_args = [] + +[binaries] +c = 'x86_64-w64-mingw32-gcc' +cpp = 'x86_64-w64-mingw32-g++' +ar = 'x86_64-w64-mingw32-ar' +strip = 'x86_64-w64-mingw32-strip' +pkgconfig = 'x86_64-w64-mingw32-pkg-config' +windres = 'x86_64-w64-mingw32-windres' +exe_wrapper = 'wine' |