Skip to content

Commit fa8a428

Browse files
author
MarcoFalke
committed
move-only: Move almost all CI_EXEC code to 06_script_b.sh
[WARN] The commit is obviously broken and will not run the CI system. In the rare case this is hit in a git bisect, just skip the commit. The goal here was to make it trivial to review with the git option: --color-moved=dimmed-zebra It is required to move everything into one file because "exit 0" will otherwise stop working as intended when the containing bash script is no longer executed with "source ...". If there is desire to split up 06_script_b.sh into logical chunks in the future, it will also be easier after the following commit.
1 parent 883766f commit fa8a428

File tree

5 files changed

+119
-135
lines changed

5 files changed

+119
-135
lines changed

ci/test/04_install.sh

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,3 @@ CI_EXEC rsync --archive --stats --human-readable /ro_base/ "${BASE_ROOT_DIR}" ||
7474
CI_EXEC git config --global --add safe.directory \"*\"
7575

7676
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
77-
78-
if [ "$CI_OS_NAME" == "macos" ]; then
79-
top -l 1 -s 0 | awk ' /PhysMem/ {print}'
80-
echo "Number of CPUs: $(sysctl -n hw.logicalcpu)"
81-
else
82-
CI_EXEC free -m -h
83-
CI_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\)
84-
CI_EXEC echo "$(lscpu | grep Endian)"
85-
fi
86-
CI_EXEC echo "Free disk space:"
87-
CI_EXEC df -h
88-
89-
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
90-
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/
91-
if [ ! -d "$DIR_FUZZ_IN" ]; then
92-
CI_EXEC git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${DIR_QA_ASSETS}"
93-
fi
94-
elif [ "$RUN_UNIT_TESTS" = "true" ] || [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
95-
export DIR_UNIT_TEST_DATA=${DIR_QA_ASSETS}/unit_test_data/
96-
if [ ! -d "$DIR_UNIT_TEST_DATA" ]; then
97-
CI_EXEC mkdir -p "$DIR_UNIT_TEST_DATA"
98-
CI_EXEC curl --location --fail https://github.com/bitcoin-core/qa-assets/raw/main/unit_test_data/script_assets_test.json -o "${DIR_UNIT_TEST_DATA}/script_assets_test.json"
99-
fi
100-
fi
101-
102-
CI_EXEC mkdir -p "${BASE_SCRATCH_DIR}/sanitizer-output/"
103-
104-
if [ "$USE_BUSY_BOX" = "true" ]; then
105-
echo "Setup to use BusyBox utils"
106-
# tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version)
107-
# ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed)
108-
# shellcheck disable=SC1010
109-
CI_EXEC for util in \$\(busybox --list \| grep -v "^ar$" \| grep -v "^tar$" \)\; do ln -s \$\(command -v busybox\) "${BINS_SCRATCH_DIR}/\$util"\; done
110-
# Print BusyBox version
111-
CI_EXEC patch --help
112-
fi

ci/test/05_before_script.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

ci/test/06_script_a.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.

ci/test/06_script_b.sh

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,125 @@ export LC_ALL=C.UTF-8
88

99
set -ex
1010

11+
if [ "$CI_OS_NAME" == "macos" ]; then
12+
top -l 1 -s 0 | awk ' /PhysMem/ {print}'
13+
echo "Number of CPUs: $(sysctl -n hw.logicalcpu)"
14+
else
15+
CI_EXEC free -m -h
16+
CI_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\)
17+
CI_EXEC echo "$(lscpu | grep Endian)"
18+
fi
19+
CI_EXEC echo "Free disk space:"
20+
CI_EXEC df -h
21+
22+
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
23+
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/
24+
if [ ! -d "$DIR_FUZZ_IN" ]; then
25+
CI_EXEC git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${DIR_QA_ASSETS}"
26+
fi
27+
elif [ "$RUN_UNIT_TESTS" = "true" ] || [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
28+
export DIR_UNIT_TEST_DATA=${DIR_QA_ASSETS}/unit_test_data/
29+
if [ ! -d "$DIR_UNIT_TEST_DATA" ]; then
30+
CI_EXEC mkdir -p "$DIR_UNIT_TEST_DATA"
31+
CI_EXEC curl --location --fail https://github.com/bitcoin-core/qa-assets/raw/main/unit_test_data/script_assets_test.json -o "${DIR_UNIT_TEST_DATA}/script_assets_test.json"
32+
fi
33+
fi
34+
35+
CI_EXEC mkdir -p "${BASE_SCRATCH_DIR}/sanitizer-output/"
36+
37+
if [ "$USE_BUSY_BOX" = "true" ]; then
38+
echo "Setup to use BusyBox utils"
39+
# tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version)
40+
# ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed)
41+
# shellcheck disable=SC1010
42+
CI_EXEC for util in \$\(busybox --list \| grep -v "^ar$" \| grep -v "^tar$" \)\; do ln -s \$\(command -v busybox\) "${BINS_SCRATCH_DIR}/\$util"\; done
43+
# Print BusyBox version
44+
CI_EXEC patch --help
45+
fi
46+
47+
# Make sure default datadir does not exist and is never read by creating a dummy file
48+
if [ "$CI_OS_NAME" == "macos" ]; then
49+
echo > "${HOME}/Library/Application Support/Bitcoin"
50+
else
51+
CI_EXEC echo \> \$HOME/.bitcoin
52+
fi
53+
54+
if [ -z "$NO_DEPENDS" ]; then
55+
if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then
56+
# CentOS has problems building the depends if the config shell is not explicitly set
57+
# (i.e. for libevent a Makefile with an empty SHELL variable is generated, leading to
58+
# an error as the first command is executed)
59+
SHELL_OPTS="LC_ALL=en_US.UTF-8 CONFIG_SHELL=/bin/dash"
60+
else
61+
SHELL_OPTS="CONFIG_SHELL="
62+
fi
63+
CI_EXEC "$SHELL_OPTS" make "$MAKEJOBS" -C depends HOST="$HOST" "$DEP_OPTS" LOG=1
64+
fi
65+
if [ "$DOWNLOAD_PREVIOUS_RELEASES" = "true" ]; then
66+
CI_EXEC test/get_previous_releases.py -b -t "$PREVIOUS_RELEASES_DIR"
67+
fi
68+
69+
BITCOIN_CONFIG_ALL="--enable-suppress-external-warnings --disable-dependency-tracking"
70+
if [ -z "$NO_DEPENDS" ]; then
71+
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} CONFIG_SITE=$DEPENDS_DIR/$HOST/share/config.site"
72+
fi
73+
if [ -z "$NO_WERROR" ]; then
74+
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror"
75+
fi
76+
77+
CI_EXEC "ccache --zero-stats --max-size=$CCACHE_SIZE"
78+
PRINT_CCACHE_STATISTICS="ccache --version | head -n 1 && ccache --show-stats"
79+
80+
if [ -n "$ANDROID_TOOLS_URL" ]; then
81+
CI_EXEC make distclean || true
82+
CI_EXEC ./autogen.sh
83+
CI_EXEC ./configure "$BITCOIN_CONFIG_ALL" "$BITCOIN_CONFIG" || ( (CI_EXEC cat config.log) && false)
84+
CI_EXEC "make $MAKEJOBS && cd src/qt && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk"
85+
CI_EXEC "${PRINT_CCACHE_STATISTICS}"
86+
exit 0
87+
fi
88+
89+
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-external-signer --prefix=$BASE_OUTDIR"
90+
91+
if [ -n "$CONFIG_SHELL" ]; then
92+
CI_EXEC "$CONFIG_SHELL" -c "./autogen.sh"
93+
else
94+
CI_EXEC ./autogen.sh
95+
fi
96+
97+
CI_EXEC mkdir -p "${BASE_BUILD_DIR}"
98+
export P_CI_DIR="${BASE_BUILD_DIR}"
99+
100+
CI_EXEC "${BASE_ROOT_DIR}/configure" --cache-file=config.cache "$BITCOIN_CONFIG_ALL" "$BITCOIN_CONFIG" || ( (CI_EXEC cat config.log) && false)
101+
102+
CI_EXEC make distdir VERSION="$HOST"
103+
104+
export P_CI_DIR="${BASE_BUILD_DIR}/bitcoin-$HOST"
105+
106+
CI_EXEC ./configure --cache-file=../config.cache "$BITCOIN_CONFIG_ALL" "$BITCOIN_CONFIG" || ( (CI_EXEC cat config.log) && false)
107+
108+
set -o errtrace
109+
trap 'CI_EXEC "cat ${BASE_SCRATCH_DIR}/sanitizer-output/* 2> /dev/null"' ERR
110+
111+
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
112+
# MemorySanitizer (MSAN) does not support tracking memory initialization done by
113+
# using the Linux getrandom syscall. Avoid using getrandom by undefining
114+
# HAVE_SYS_GETRANDOM. See https://github.com/google/sanitizers/issues/852 for
115+
# details.
116+
CI_EXEC 'grep -v HAVE_SYS_GETRANDOM src/config/bitcoin-config.h > src/config/bitcoin-config.h.tmp && mv src/config/bitcoin-config.h.tmp src/config/bitcoin-config.h'
117+
fi
118+
119+
if [[ "${RUN_TIDY}" == "true" ]]; then
120+
MAYBE_BEAR="bear --config src/.bear-tidy-config"
121+
MAYBE_TOKEN="--"
122+
fi
123+
124+
CI_EXEC "${MAYBE_BEAR}" "${MAYBE_TOKEN}" make "$MAKEJOBS" "$GOAL" || ( echo "Build failure. Verbose build follows." && CI_EXEC make "$GOAL" V=1 ; false )
125+
126+
CI_EXEC "${PRINT_CCACHE_STATISTICS}"
127+
CI_EXEC du -sh "${DEPENDS_DIR}"/*/
128+
CI_EXEC du -sh "${PREVIOUS_RELEASES_DIR}"
129+
11130
if [[ $HOST = *-mingw32 ]]; then
12131
# Generate all binaries, so that they can be wrapped
13132
make "$MAKEJOBS" -C src/secp256k1 VERBOSE=1

ci/test_run_all.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ export LC_ALL=C.UTF-8
88

99
set -o errexit; source ./ci/test/00_setup_env.sh
1010
set -o errexit; source ./ci/test/04_install.sh
11-
set -o errexit; source ./ci/test/05_before_script.sh
12-
set -o errexit; source ./ci/test/06_script_a.sh
1311
set -o errexit
1412
CI_EXEC "${BASE_ROOT_DIR}/ci/test/06_script_b.sh"
1513

0 commit comments

Comments
 (0)