From 0ed9167b9e424194b214f18eb46f2157f3b45380 Mon Sep 17 00:00:00 2001 From: Paul Osborne Date: Mon, 14 Mar 2016 14:27:30 -0500 Subject: [PATCH] testing: ensure run.sh is executing in docker container On the host, some undesired things could end up happening if this is executed, so we now exit and log if that is attempted. In addition, we now backup the previous cargo config if present. This will never be the case in the current build setup, but that could change if we decide to do builds in a data volume in the future. Signed-off-by: Paul Osborne --- ci/run.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ci/run.sh b/ci/run.sh index 0a7039f6dd..9534278501 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -5,6 +5,16 @@ set -e +# This should only be run in a docker container, so verify that +if [ ! -f /.dockerinit ]; then + echo "run.sh should only be executed in a docker container" + echo " and that does not appear to be the case. Maybe you meant" + echo " to execute the tests via run-all.sh or run-docker.sh." + echo "" + echo "For more instructions, please refer to ci/README.md" + exit 1 +fi + BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" MANIFEST_PATH="${BASE_DIR}/Cargo.toml" BUILD_DIR="." @@ -18,9 +28,8 @@ export RUST_TEST_THREADS=1 # Tell cargo what linker to use and whatever else is required # configure_cargo() { - rm -rf .cargo - mkdir .cargo - cp "${BASE_DIR}/ci/cargo-config" .cargo/config + mkdir -p .cargo + cp -b "${BASE_DIR}/ci/cargo-config" .cargo/config } #