#!/usr/bin/env bash # SPDX-License-Identifier: BSD-3-Clause set -e source $TRAVIS_BUILD_DIR/.ci/docker-prelude.sh export CONFIGURE_OPTIONS= if [ -d build ]; then rm -rf build fi if [ -d ./build-no-tests ]; then rm -rf build-no-tests fi # Do not run tests when building on coverity_scan branch if [ "$COVERITY_SCAN_BRANCH" == 1 ]; then echo "Coverity scan branch detected, not running build nor tests...exiting!" exit 0 fi if [ -z "$WITH_CRYPTO" ]; then echo "variable WITH_CRYPTO not set, defaulting to ossl" export WITH_CRYPTO="ossl" fi if [ "$WITH_CRYPTO" != "ossl" ]; then export CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --disable-fapi" fi ./bootstrap # Is it a fuzz run, if so build the fuzz test and exit. if [ "$GEN_FUZZ" == "1" ]; then ./configure --with-fuzzing=libfuzzer --enable-tcti-fuzzing --disable-tcti-device --disable-tcti-mssim --disable-shared --with-crypto="$WITH_CRYPTO" make -j$(nproc) check exit 0 fi # # General build runs # # build with no tests enabled mkdir ./build-no-tests pushd ./build-no-tests echo "PWD: $(pwd)" echo "ls -la ../ $(ls -la ../)" ../configure --enable-tcti-partial-reads=$WITH_TCTI_PARTIAL --enable-tcti-device-async=$WITH_TCTI_ASYNC --with-crypto=$WITH_CRYPTO $CONFIGURE_OPTIONS make -j$(nproc) popd # build with all tests enabled mkdir ./build pushd ./build if [ "$CC" == "gcc" ]; then export CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-code-coverage"; fi if [ "$SCANBUILD" == "yes" ]; then scan-build --status-bugs ../configure --enable-tcti-partial-reads=$WITH_TCTI_PARTIAL --enable-tcti-device-async=$WITH_TCTI_ASYNC --enable-unit --enable-integration --with-crypto=$WITH_CRYPTO $CONFIGURE_OPTIONS elif [ "$CC" == "clang" ]; then ../configure --enable-tcti-partial-reads=$WITH_TCTI_PARTIAL --enable-tcti-device-async=$WITH_TCTI_ASYNC --enable-unit --enable-integration --with-crypto=$WITH_CRYPTO $CONFIGURE_OPTIONS else ../configure --with-sanitizer=undefined --enable-tcti-partial-reads=$WITH_TCTI_PARTIAL --enable-tcti-device-async=$WITH_TCTI_ASYNC --enable-unit --enable-integration --with-crypto=$WITH_CRYPTO $CONFIGURE_OPTIONS fi if [ "$SCANBUILD" == "yes" ]; then scan-build --status-bugs make -j distcheck elif [ "$CC" == "clang" ]; then make -j distcheck else make -j check fi popd # back in root git directory, check for whitespace errors. We do this post CI # so people can verify the rest of their patch works in CI before dying. # git diff --check fails with a non-zero return code causing the shell to die # as it has a set -e executed. [ -z "$TRAVIS_TAG" ] && git diff --check origin/${TRAVIS_BRANCH:-master} if [ "$ENABLE_COVERAGE" == "true" ]; then bash <(curl -s https://codecov.io/bash) else echo "ENABLE_COVERAGE not true, got \"$ENABLE_COVERAGE\"" fi exit 0