diff options
author | Simon Warta <[email protected]> | 2016-12-02 10:08:59 +0100 |
---|---|---|
committer | Simon Warta <[email protected]> | 2016-12-02 16:45:20 +0100 |
commit | 651c730562475b40d6b9c29efa7683cb426f3fd4 (patch) | |
tree | f24e10d06b421410a701822a0d882e5f2b343a2b /src/scripts/ci | |
parent | 86a19b4b86ec961f7c02970a5a24990af1abf9e5 (diff) |
Make shellcheck happy with travis/build.sh
This fixes some SC2086 (Double quote to prevent globbing and word
splitting.) cases. See also
https://github.com/koalaman/shellcheck/wiki/SC2086
Diffstat (limited to 'src/scripts/ci')
-rwxr-xr-x | src/scripts/ci/travis/build.sh | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh index a34737d8a..ebd53c529 100755 --- a/src/scripts/ci/travis/build.sh +++ b/src/scripts/ci/travis/build.sh @@ -2,8 +2,8 @@ set -ev which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if available -MAKE_PREFIX="" -TEST_PREFIX="" +MAKE_PREFIX=() +TEST_PREFIX=() TEST_EXE=./botan-test TEST_FLAGS="" CFG_FLAGS=(--prefix=/tmp/botan-installation --cc=$CC --os=$TRAVIS_OS_NAME) @@ -38,7 +38,7 @@ elif [ "$BUILD_MODE" = "sanitizer" ]; then CFG_FLAGS+=(--with-sanitizers --disable-modules=locking_allocator) elif [ "$BUILD_MODE" = "valgrind" ]; then CFG_FLAGS+=(--with-valgrind --with-debug-info --disable-modules=locking_allocator) - TEST_PREFIX="valgrind --error-exitcode=9 -v" + TEST_PREFIX=(valgrind --error-exitcode=9 -v) fi if [ "$BUILD_MODE" = "mini-static" ] || [ "$BUILD_MODE" = "mini-shared" ]; then @@ -72,7 +72,7 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then if [ "$TRAVIS_OS_NAME" = "osx" ]; then CFG_FLAGS+=(--disable-shared) - MAKE_PREFIX="xcrun --sdk iphoneos" + MAKE_PREFIX=(xcrun --sdk iphoneos) if [ "$BUILD_MODE" = "cross-arm32" ]; then CFG_FLAGS+=(--cpu=armv7 --cc-abi-flags="-arch armv7 -arch armv7s -stdlib=libc++") elif [ "$BUILD_MODE" = "cross-arm64" ]; then @@ -83,22 +83,22 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then if [ "$BUILD_MODE" = "cross-arm32" ]; then CC_BIN=arm-linux-gnueabihf-g++-4.8 - TEST_PREFIX="qemu-arm -L /usr/arm-linux-gnueabihf/" + TEST_PREFIX=(qemu-arm -L /usr/arm-linux-gnueabihf/) CFG_FLAGS+=(--cpu=armv7) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-arm64" ]; then CC_BIN=aarch64-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-aarch64 -L /usr/aarch64-linux-gnu/" + TEST_PREFIX=(qemu-aarch64 -L /usr/aarch64-linux-gnu/) CFG_FLAGS+=(--cpu=armv8-a) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-ppc32" ]; then CC_BIN=powerpc-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-ppc -L /usr/powerpc-linux-gnu/" + TEST_PREFIX=(qemu-ppc -L /usr/powerpc-linux-gnu/) CFG_FLAGS+=(--cpu=ppc32) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-ppc64" ]; then CC_BIN=powerpc64le-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-ppc64le -L /usr/powerpc64le-linux-gnu/" + TEST_PREFIX=(qemu-ppc64le -L /usr/powerpc64le-linux-gnu/) CFG_FLAGS+=(--cpu=ppc64 --with-endian=little) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-win32" ]; then @@ -113,7 +113,7 @@ fi CFG_FLAGS+=(--cc-bin="ccache $CC_BIN") if [ "$BUILD_MODE" = "sonarqube" ]; then - MAKE_PREFIX="./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs" + MAKE_PREFIX=(./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs) fi # configure @@ -128,8 +128,9 @@ if [ "$BUILD_MODE" = "docs" ]; then doxygen build/botan.doxy sphinx-build -a -W -c src/build-data/sphinx doc/manual manual-out else - echo $MAKE_PREFIX make -j $BUILD_JOBS - time $MAKE_PREFIX make -j $BUILD_JOBS + MAKE_CMD=("${MAKE_PREFIX[@]}" make -j "$BUILD_JOBS") + echo "Running" "${MAKE_CMD[@]}" + time "${MAKE_CMD[@]}" fi # post-build ccache stats @@ -157,11 +158,11 @@ if [ "$BUILD_MODE" = "sonarqube" ]; then # http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests # That's why the analysis does not need to be executed if the variable GITHUB_TOKEN is not defined. echo "Starting Pull Request analysis by SonarQube..." - sonar-scanner -Dsonar.login=$SONAR_TOKEN \ + sonar-scanner -Dsonar.login="$SONAR_TOKEN" \ -Dsonar.analysis.mode=preview \ - -Dsonar.github.oauth=$GITHUB_TOKEN \ - -Dsonar.github.repository=$TRAVIS_REPO_SLUG \ - -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST + -Dsonar.github.oauth="$GITHUB_TOKEN" \ + -Dsonar.github.repository="$TRAVIS_REPO_SLUG" \ + -Dsonar.github.pullRequest="$TRAVIS_PULL_REQUEST" fi # When neither on master branch nor on a non-external pull request => nothing to do fi @@ -170,8 +171,9 @@ 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 $TEST_FLAGS - time $TEST_PREFIX $TEST_EXE $TEST_FLAGS + TEST_CMD=("${TEST_PREFIX[@]}" $TEST_EXE $TEST_FLAGS) + echo "Running" "${TEST_CMD[@]}" + time "${TEST_CMD[@]}" fi # Run Python tests (need shared libs) |