diff options
author | Jack Lloyd <[email protected]> | 2016-10-25 09:28:54 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-25 09:28:54 -0400 |
commit | b3f802d78f380850eb0ab967ab6bde663bdc0943 (patch) | |
tree | 4536cf911e8744a61756312a62f9ad51cb4041f1 | |
parent | 36e0ea1e407027ac48e82b56016a6813ff6a1082 (diff) | |
parent | d78a540dd0145665805e9804d8f20a71c39b0bf8 (diff) |
Merge GH #684 Add PKCS11 and TPM to Travis coverage build
-rwxr-xr-x | src/scripts/ci/travis/build.sh | 10 | ||||
-rwxr-xr-x | src/scripts/ci/travis/install.sh | 11 | ||||
-rw-r--r-- | src/tests/main.cpp | 19 |
3 files changed, 29 insertions, 11 deletions
diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh index 3b34f7320..da5734932 100755 --- a/src/scripts/ci/travis/build.sh +++ b/src/scripts/ci/travis/build.sh @@ -5,6 +5,7 @@ which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if avai MAKE_PREFIX="" TEST_PREFIX="" TEST_EXE=./botan-test +TEST_FLAGS="" CFG_FLAGS=(--prefix=/tmp/botan-installation --cc=$CC --os=$TRAVIS_OS_NAME) # PKCS11 is optional but doesn't pull in new dependencies @@ -51,6 +52,11 @@ elif [ "${BUILD_MODE:0:5}" != "cross" ]; then # Only use external libraries when compiling natively CFG_FLAGS+=(--with-bzip2 --with-lzma --with-sqlite --with-zlib) + if [ "$BUILD_MODE" = "coverage" ]; then + CFG_FLAGS+=(--with-tpm) + TEST_FLAGS="--pkcs11-lib=/tmp/softhsm/lib/softhsm/libsofthsm2.so" + fi + # Avoid OpenSSL when using dynamic checkers... if [ "$BUILD_MODE" != "sanitizer" ] && [ "$BUILD_MODE" != "valgrind" ]; then CFG_FLAGS+=(--with-openssl) @@ -161,8 +167,8 @@ if [ "$BUILD_MODE" = "sonarqube" ] || [ "$BUILD_MODE" = "docs" ] || \ ( [ "${BUILD_MODE:0:5}" = "cross" ] && [ "$TRAVIS_OS_NAME" = "osx" ] ); then echo "Running tests disabled on this build type" else - echo Running $TEST_PREFIX $TEST_EXE - time $TEST_PREFIX $TEST_EXE + echo Running $TEST_PREFIX $TEST_EXE $TEST_FLAGS + time $TEST_PREFIX $TEST_EXE $TEST_FLAGS fi # Run Python tests (need shared libs) diff --git a/src/scripts/ci/travis/install.sh b/src/scripts/ci/travis/install.sh index 30c54fdbe..c3e4ee834 100755 --- a/src/scripts/ci/travis/install.sh +++ b/src/scripts/ci/travis/install.sh @@ -28,8 +28,17 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip install sphinx fi - if [ "$BUILD_MODE" = "valgrind" ] || [ "${BUILD_MODE:0:5}" = "cross" ]; then + if [ "$BUILD_MODE" = "coverage" ]; then + sudo apt-get install trousers libtspi-dev + + # SoftHSMv1 in 14.04 does not work + # Installs prebuilt SoftHSMv2 binaries into /tmp + wget https://www.randombit.net/softhsm2-trusty-bin.tar.bz2 + tar -C / -xvjf softhsm2-trusty-bin.tar.bz2 + /tmp/softhsm/bin/softhsm2-util --init-token --free --label test --pin 123456 --so-pin 12345678 + fi + if [ "$BUILD_MODE" = "valgrind" ] || [ "${BUILD_MODE:0:5}" = "cross" ]; then if [ "$BUILD_MODE" = "valgrind" ]; then sudo apt-get install valgrind elif [ "$BUILD_MODE" = "cross-win32" ]; then diff --git a/src/tests/main.cpp b/src/tests/main.cpp index d80049d53..cf61ea0b0 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -93,16 +93,19 @@ class Test_Runner : public Botan_CLI::Command std::set<std::string> all_others = Botan_Tests::Test::registered_tests(); - // do not run pkcs11 tests by default - for(std::set<std::string>::iterator iter = all_others.begin(); iter != all_others.end();) + if(pkcs11_lib.empty()) { - if((*iter).find("pkcs11") != std::string::npos) + // do not run pkcs11 tests by default unless pkcs11-lib set + for(std::set<std::string>::iterator iter = all_others.begin(); iter != all_others.end();) { - iter = all_others.erase(iter); - } - else - { - ++iter; + if((*iter).find("pkcs11") != std::string::npos) + { + iter = all_others.erase(iter); + } + else + { + ++iter; + } } } |