Skip to content

Commit 80d70cb

Browse files
committed
Merge bitcoin/bitcoin#28185: ci: Use hard-coded root path for CI containers (bugfix)
fafa17c ci: Use hard-coded root path for CI containers (MarcoFalke) fa084f5 ci: Only create folders when needed (MarcoFalke) fab2712 ci: Drop BASE_SCRATCH_DIR from LIBCXX_DIR (MarcoFalke) Pull request description: Currently the CI system will fail if the git folder that holds the Bitcoin Core source is moved from one location to another. Fix this by using a single hard-coded root path *inside* the CI system containers. Steps to test: * Run the CI system: `MAKEJOBS="-j$(nproc)" FILE_ENV="./ci/test/00_setup_env_win64.sh" ./ci/test_run_all.sh` * Move the git folder: `pwd && cd .. && mv bitcoin_core_folder_1 bitcoin_core_folder_2 && cd ./bitcoin_core_folder_2 && pwd` * Run the CI system again: (same cmd as above) On master (error): ``` STRIPPROG="x86_64-w64-mingw32-strip" /bin/bash /bitcoin_core_folder_2/ci/scratch/build/bitcoin-x86_64-w64-mingw32/build-aux/install-sh -c -s ./src/qt/bitcoin-qt.exe ./release /bitcoin_core_folder_2/ci/scratch/build/bitcoin-x86_64-w64-mingw32/build-aux/install-sh: ./src/qt/bitcoin-qt.exe does not exist. make: *** [Makefile:1258: bitcoin-25.99.0-win64-setup.exe] Error 1 ``` On this pull: (pass). ACKs for top commit: fanquake: ACK bitcoin/bitcoin@fafa17c - somewhat tested. MSAN changes are the same as what we did for tidy. Tree-SHA512: 2ce693a3773c70fcfca062c2a6f0e5a16b94960b34a6145d10cee1a28f79154829d59d014465ccbb80e1cb9dcd5aa043729cee9afd2c4175b05e9bc945364b79
2 parents 85e672a + fafa17c commit 80d70cb

File tree

5 files changed

+48
-39
lines changed

5 files changed

+48
-39
lines changed

ci/test/00_setup_env.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ export LC_ALL=C.UTF-8
88

99
set -ex
1010

11-
# The root dir.
11+
# The source root dir, usually from git, usually read-only.
1212
# The ci system copies this folder.
13-
BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
14-
export BASE_ROOT_DIR
13+
BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
14+
export BASE_READ_ONLY_DIR
15+
# The destination root dir inside the container.
16+
if [ -z "${DANGER_RUN_CI_ON_HOST}" ] ; then
17+
# This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR
18+
export BASE_ROOT_DIR="/ci_container_base"
19+
else
20+
# This folder is equal to BASE_READ_ONLY_DIR and is read-write
21+
export BASE_ROOT_DIR="${BASE_READ_ONLY_DIR}"
22+
fi
1523
# The depends dir.
1624
# This folder exists only on the ci guest, and on the ci host as a volume.
1725
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}

ci/test/00_setup_env_native_fuzz_with_msan.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export LC_ALL=C.UTF-8
88

99
export CI_IMAGE_NAME_TAG="ubuntu:22.04"
10-
LIBCXX_DIR="${BASE_SCRATCH_DIR}/msan/cxx_build/"
10+
LIBCXX_DIR="/msan/cxx_build/"
1111
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
1212
LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
1313
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"

ci/test/00_setup_env_native_msan.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export LC_ALL=C.UTF-8
88

99
export CI_IMAGE_NAME_TAG="ubuntu:22.04"
10-
LIBCXX_DIR="${BASE_SCRATCH_DIR}/msan/cxx_build/"
10+
LIBCXX_DIR="/msan/cxx_build/"
1111
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
1212
LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
1313
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"

ci/test/01_base_install.sh

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,35 @@ if [ -n "$PIP_PACKAGES" ]; then
4242
fi
4343

4444
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
45-
git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-16.0.6 "${BASE_SCRATCH_DIR}"/msan/llvm-project
46-
47-
cmake -G Ninja -B "${BASE_SCRATCH_DIR}"/msan/clang_build/ -DLLVM_ENABLE_PROJECTS="clang" \
48-
-DCMAKE_BUILD_TYPE=Release \
49-
-DLLVM_TARGETS_TO_BUILD=Native \
50-
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
51-
-S "${BASE_SCRATCH_DIR}"/msan/llvm-project/llvm
52-
53-
ninja -C "${BASE_SCRATCH_DIR}"/msan/clang_build/ "$MAKEJOBS"
54-
ninja -C "${BASE_SCRATCH_DIR}"/msan/clang_build/ install-runtimes
55-
56-
update-alternatives --install /usr/bin/clang++ clang++ "${BASE_SCRATCH_DIR}"/msan/clang_build/bin/clang++ 100
57-
update-alternatives --install /usr/bin/clang clang "${BASE_SCRATCH_DIR}"/msan/clang_build/bin/clang 100
58-
update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "${BASE_SCRATCH_DIR}"/msan/clang_build/bin/llvm-symbolizer 100
59-
60-
cmake -G Ninja -B "${BASE_SCRATCH_DIR}"/msan/cxx_build/ -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \
61-
-DCMAKE_BUILD_TYPE=Release \
62-
-DLLVM_USE_SANITIZER=MemoryWithOrigins \
63-
-DCMAKE_C_COMPILER=clang \
64-
-DCMAKE_CXX_COMPILER=clang++ \
65-
-DLLVM_TARGETS_TO_BUILD=Native \
66-
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
67-
-DLIBCXX_ENABLE_DEBUG_MODE=ON \
68-
-DLIBCXX_ENABLE_ASSERTIONS=ON \
69-
-S "${BASE_SCRATCH_DIR}"/msan/llvm-project/runtimes
70-
71-
ninja -C "${BASE_SCRATCH_DIR}"/msan/cxx_build/ "$MAKEJOBS"
45+
git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-16.0.6 /msan/llvm-project
46+
47+
cmake -G Ninja -B /msan/clang_build/ \
48+
-DLLVM_ENABLE_PROJECTS="clang" \
49+
-DCMAKE_BUILD_TYPE=Release \
50+
-DLLVM_TARGETS_TO_BUILD=Native \
51+
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
52+
-S /msan/llvm-project/llvm
53+
54+
ninja -C /msan/clang_build/ "$MAKEJOBS"
55+
ninja -C /msan/clang_build/ install-runtimes
56+
57+
update-alternatives --install /usr/bin/clang++ clang++ /msan/clang_build/bin/clang++ 100
58+
update-alternatives --install /usr/bin/clang clang /msan/clang_build/bin/clang 100
59+
update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /msan/clang_build/bin/llvm-symbolizer 100
60+
61+
cmake -G Ninja -B /msan/cxx_build/ \
62+
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \
63+
-DCMAKE_BUILD_TYPE=Release \
64+
-DLLVM_USE_SANITIZER=MemoryWithOrigins \
65+
-DCMAKE_C_COMPILER=clang \
66+
-DCMAKE_CXX_COMPILER=clang++ \
67+
-DLLVM_TARGETS_TO_BUILD=Native \
68+
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
69+
-DLIBCXX_ENABLE_DEBUG_MODE=ON \
70+
-DLIBCXX_ENABLE_ASSERTIONS=ON \
71+
-S /msan/llvm-project/runtimes
72+
73+
ninja -C /msan/cxx_build/ "$MAKEJOBS"
7274
fi
7375

7476
if [[ "${RUN_TIDY}" == "true" ]]; then

ci/test/04_install.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
export LC_ALL=C.UTF-8
88

9-
# Create folders that are mounted into the docker
10-
mkdir -p "${CCACHE_DIR}"
11-
mkdir -p "${PREVIOUS_RELEASES_DIR}"
12-
139
export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
1410
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
1511
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
@@ -23,11 +19,11 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
2319
docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append /tmp/env
2420
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
2521
DOCKER_BUILDKIT=1 docker build \
26-
--file "${BASE_ROOT_DIR}/ci/test_imagefile" \
22+
--file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
2723
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
2824
--build-arg "FILE_ENV=${FILE_ENV}" \
2925
--tag="${CONTAINER_NAME}" \
30-
"${BASE_ROOT_DIR}"
26+
"${BASE_READ_ONLY_DIR}"
3127
docker volume create "${CONTAINER_NAME}_ccache" || true
3228
docker volume create "${CONTAINER_NAME}_depends" || true
3329
docker volume create "${CONTAINER_NAME}_previous_releases" || true
@@ -41,7 +37,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
4137

4238
# shellcheck disable=SC2086
4339
CI_CONTAINER_ID=$(docker run $CI_CONTAINER_CAP --rm --interactive --detach --tty \
44-
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
40+
--mount type=bind,src=$BASE_READ_ONLY_DIR,dst=/ro_base,readonly \
4541
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
4642
--mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR" \
4743
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \
@@ -52,6 +48,9 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
5248
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
5349
else
5450
echo "Running on host system without docker wrapper"
51+
echo "Create missing folders"
52+
mkdir -p "${CCACHE_DIR}"
53+
mkdir -p "${PREVIOUS_RELEASES_DIR}"
5554
fi
5655

5756
CI_EXEC () {

0 commit comments

Comments
 (0)