Skip to content

Commit

Permalink
ci: Remove use of cd
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Nov 22, 2019
1 parent fa2941b commit fad88e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
6 changes: 4 additions & 2 deletions ci/test/04_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (A
DOCKER_ADMIN="--cap-add SYS_PTRACE"
fi

export P_CI_DIR="$PWD"

if [ -z "$RUN_CI_ON_HOST" ]; then
echo "Creating $DOCKER_NAME_TAG container to run in"
${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG"
Expand All @@ -57,12 +59,12 @@ if [ -z "$RUN_CI_ON_HOST" ]; then
$DOCKER_NAME_TAG)

DOCKER_EXEC () {
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*"
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
}
else
echo "Running on host system without docker wrapper"
DOCKER_EXEC () {
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*"
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
}
fi

Expand Down
16 changes: 2 additions & 14 deletions ci/test/06_script_a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ else
fi
END_FOLD

# Create folder on host and docker, so that `cd` works
mkdir -p build
DOCKER_EXEC mkdir -p build

# Temporarily disable errexit, because Travis macOS fails without error message
set +o errexit
cd build || (echo "could not enter build directory"; exit 1)
set -o errexit
export P_CI_DIR="$P_CI_DIR/build"

BEGIN_FOLD configure
DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
Expand All @@ -38,9 +32,7 @@ mkdir -p "bitcoin-$HOST"
DOCKER_EXEC make distdir VERSION=$HOST
END_FOLD

set +o errexit
cd "bitcoin-$HOST" || (echo "could not enter distdir bitcoin-$HOST"; exit 1)
set -o errexit
export P_CI_DIR="$P_CI_DIR/bitcoin-$HOST"

BEGIN_FOLD configure
DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
Expand All @@ -52,7 +44,3 @@ trap 'DOCKER_EXEC "cat ${BASE_SCRATCH_DIR}/sanitizer-output/* 2> /dev/null"' ERR
BEGIN_FOLD build
DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
END_FOLD

set +o errexit
cd ${BASE_ROOT_DIR} || (echo "could not enter base root dir $BASE_ROOT_DIR"; exit 1)
set -o errexit
5 changes: 0 additions & 5 deletions ci/test/06_script_b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

export LC_ALL=C.UTF-8

# Temporarily disable errexit, because Travis macOS fails without error message
set +o errexit
cd "build/bitcoin-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
set -o errexit

if [ -n "$QEMU_USER_CMD" ]; then
BEGIN_FOLD wrap-qemu
echo "Prepare to run functional tests for HOST=$HOST"
Expand Down

0 comments on commit fad88e6

Please sign in to comment.