Skip to content

Commit a1c6434

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#21852: ci: Add msan fuzz config
fa0422c ci: Add msan fuzz config (MarcoFalke) fa399a7 ci: Use clang-12 in msan task (MarcoFalke) fab3017 ci: Set BASE_SCRATCH_DIR early, so that it can be used in test configs (MarcoFalke) Pull request description: Similar to the valgrind config, this config is not run by any ci task in this repo, but it can be used by other repos or self-hosted infrastructure. ACKs for top commit: practicalswift: cr ACK fa0422c: patch looks correct Tree-SHA512: 2122ac0948978a7b952efc80d4aa3674b27d48c6166e0ce917c61ac4ee6b68d701a83e5f71ee6868c208885ee45aae409ca022ebcb23ccbe37819a8c36e34872
2 parents 0ca8b7e + fa0422c commit a1c6434

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

ci/test/00_setup_env.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export BASE_ROOT_DIR
1414
# The depends dir.
1515
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
1616
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
17+
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
18+
# This folder only exists on the ci host.
19+
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
1720

1821
echo "Setting specific values in env"
1922
if [ -n "${FILE_ENV}" ]; then
@@ -25,9 +28,6 @@ fi
2528
echo "Fallback to default values in env (if not yet set)"
2629
# The number of parallel jobs to pass down to make and test_runner.py
2730
export MAKEJOBS=${MAKEJOBS:--j4}
28-
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
29-
# This folder only exists on the ci host.
30-
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
3131
# What host to compile for. See also ./depends/README.md
3232
# Tests that need cross-compilation export the appropriate HOST.
3333
# Tests that run natively guess the host
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2020 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
export DOCKER_NAME_TAG="ubuntu:20.04"
10+
LIBCXX_DIR="${BASE_SCRATCH_DIR}/msan/build/"
11+
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
12+
LIBCXX_FLAGS="-nostdinc++ -stdlib=libc++ -L${LIBCXX_DIR}lib -lc++abi -I${LIBCXX_DIR}include -I${LIBCXX_DIR}include/c++/v1 -lpthread -Wl,-rpath,${LIBCXX_DIR}lib -Wno-unused-command-line-argument"
13+
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
14+
15+
export CONTAINER_NAME="ci_native_msan"
16+
export PACKAGES="clang-9 llvm-9 cmake"
17+
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' boost_cxxflags='-std=c++17 -fvisibility=hidden -fPIC ${MSAN_AND_LIBCXX_FLAGS}' zeromq_cxxflags='-std=c++17 ${MSAN_AND_LIBCXX_FLAGS}'"
18+
export GOAL="install"
19+
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --with-asm=no --prefix=${DEPENDS_DIR}/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
20+
export USE_MEMORY_SANITIZER="true"
21+
export RUN_UNIT_TESTS="false"
22+
export RUN_FUNCTIONAL_TESTS="false"
23+
export RUN_FUZZ_TESTS=true
24+
export CCACHE_SIZE=250M

ci/test/00_setup_env_native_msan.sh

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

99
export DOCKER_NAME_TAG="ubuntu:20.04"
10-
LIBCXX_DIR="${BASE_ROOT_DIR}/ci/scratch/msan/build/"
10+
LIBCXX_DIR="${BASE_SCRATCH_DIR}/msan/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++ -stdlib=libc++ -L${LIBCXX_DIR}lib -lc++abi -I${LIBCXX_DIR}include -I${LIBCXX_DIR}include/c++/v1 -lpthread -Wl,-rpath,${LIBCXX_DIR}lib -Wno-unused-command-line-argument"
1313
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
@@ -17,7 +17,7 @@ export CONTAINER_NAME="ci_native_msan"
1717
export PACKAGES="clang-9 llvm-9 cmake"
1818
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' boost_cxxflags='-std=c++17 -fvisibility=hidden -fPIC ${MSAN_AND_LIBCXX_FLAGS}' zeromq_cxxflags='-std=c++17 ${MSAN_AND_LIBCXX_FLAGS}'"
1919
export GOAL="install"
20-
export BITCOIN_CONFIG="--enable-wallet --with-sanitizers=memory --with-asm=no --prefix=${BASE_ROOT_DIR}/depends/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-4.8' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
20+
export BITCOIN_CONFIG="--enable-wallet --with-sanitizers=memory --with-asm=no --prefix=${DEPENDS_DIR}/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-4.8' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
2121
export USE_MEMORY_SANITIZER="true"
2222
export RUN_FUNCTIONAL_TESTS="false"
2323
export CCACHE_SIZE=250M

ci/test/04_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
9292
DOCKER_EXEC "update-alternatives --install /usr/bin/clang++ clang++ \$(which clang++-9) 100"
9393
DOCKER_EXEC "update-alternatives --install /usr/bin/clang clang \$(which clang-9) 100"
9494
DOCKER_EXEC "mkdir -p ${BASE_SCRATCH_DIR}/msan/build/"
95-
DOCKER_EXEC "git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-10.0.0 ${BASE_SCRATCH_DIR}/msan/llvm-project"
95+
DOCKER_EXEC "git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-12.0.0 ${BASE_SCRATCH_DIR}/msan/llvm-project"
9696
DOCKER_EXEC "cd ${BASE_SCRATCH_DIR}/msan/build/ && cmake -DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi' -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Memory -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_TARGETS_TO_BUILD=X86 ../llvm-project/llvm/"
9797
DOCKER_EXEC "cd ${BASE_SCRATCH_DIR}/msan/build/ && make $MAKEJOBS cxx"
9898
fi

0 commit comments

Comments
 (0)