From 8a2c03d8a9432586d24d85d0276dace856eb24f3 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 29 Jul 2017 21:07:08 +0200 Subject: [PATCH] travis ci: enable gcc, call build.sh && test.sh gcc is default compiler on most distributions, we should also test with it. build.sh exists and should be tested as well, so why not use it in Travis. test.sh outputs much more details than "make check", so run it as well. Additionally, make build.sh and test.sh work when called from other directories. --- .travis.yml | 7 ++----- build.sh | 12 ++++++------ test.sh | 10 ++++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee42e1b..463513b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ sudo: true compiler: - clang + - gcc branches: only: @@ -21,14 +22,10 @@ env: before_script: - sudo modprobe fuse - - mkdir build - - cd build - cmake --version - - cmake .. - script: - - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && make check ; fi + - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./build.sh && ./test.sh && make check -C build ; fi addons: coverity_scan: diff --git a/build.sh b/build.sh index f5cf5cb..04604d7 100755 --- a/build.sh +++ b/build.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/bash -eu -set -eu +# Make sure we are in the directory this script is in. +cd "$(dirname "$0")" -if [ ! -d build ] +if [[ ! -d build ]] then mkdir build cd build cmake .. -else - cd build + cd .. fi -make +make -j2 -C build diff --git a/test.sh b/test.sh index 6609005..d9704e6 100755 --- a/test.sh +++ b/test.sh @@ -1,10 +1,16 @@ #!/bin/bash -eu -./build/checkops &> /dev/null +# Make sure we are in the directory this script is in. +cd "$(dirname "$0")" +# Failed tests can leave dangling mounts behind. for i in $(mount | grep -e "/tmp/encfs-reverse-tests-\|/tmp/encfs-tests-" | cut -f3 -d" "); do echo "Warning: unmounting leftover filesystem: $i" - fusermount -u $i + fusermount -u $i || true done +# This is very noisy so run it silently at first. Run it again with +# output if the first run fails. +./build/checkops &> /dev/null || ./build/checkops + perl -MTest::Harness -e '$$Test::Harness::debug=1; runtests @ARGV;' tests/*.t.pl