Skip to content

Commit

Permalink
testing: ensure run.sh is executing in docker container
Browse files Browse the repository at this point in the history
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 <osbpau@gmail.com>
  • Loading branch information
posborne committed Mar 14, 2016
1 parent 72f6754 commit 0ed9167
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="."
Expand All @@ -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
}

#
Expand Down

0 comments on commit 0ed9167

Please sign in to comment.