Skip to content

Commit 1d74abc

Browse files
committed
ci: Use tsan-instrumented cap'n proto in sanitizers job
This makes libmultiprocess CI output match bitcoin core CI output and catches a race in the new thread busy test from 1238170 (#214).
1 parent 91b606a commit 1d74abc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ci/configs/sanitize.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CI_DESC="CI job running ThreadSanitizer"
22
CI_DIR=build-sanitize
3-
NIX_ARGS=(--arg enableLibcxx true --argstr libcxxSanitizers "Thread")
3+
NIX_ARGS=(--arg enableLibcxx true --argstr libcxxSanitizers "Thread" --argstr capnprotoSanitizers "thread")
44
export CXX=clang++
55
export CXXFLAGS="-ggdb -Werror -Wall -Wextra -Wpedantic -Wthread-safety -Wno-unused-parameter -fsanitize=thread"
66
CMAKE_ARGS=()

shell.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
, enableLibcxx ? false # Whether to use libc++ toolchain and libraries instead of libstdc++
44
, minimal ? false # Whether to create minimal shell without extra tools (faster when cross compiling)
55
, capnprotoVersion ? null
6+
, capnprotoSanitizers ? null # Optional sanitizers to build cap'n proto with
67
, cmakeVersion ? null
78
, libcxxSanitizers ? null # Optional LLVM_USE_SANITIZER value to use for libc++, see https://llvm.org/docs/CMake.html
89
}:
@@ -41,7 +42,17 @@ let
4142
} // (lib.optionalAttrs (lib.versionOlder capnprotoVersion "0.10") {
4243
env = { }; # Drop -std=c++20 flag forced by nixpkgs
4344
}));
44-
capnproto = capnprotoBase.override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
45+
capnproto = (capnprotoBase.overrideAttrs (old: lib.optionalAttrs (capnprotoSanitizers != null) {
46+
env = (old.env or { }) // {
47+
CXXFLAGS =
48+
lib.concatStringsSep " " [
49+
(old.env.CXXFLAGS or "")
50+
"-fsanitize=${capnprotoSanitizers}"
51+
"-fno-omit-frame-pointer"
52+
"-g"
53+
];
54+
};
55+
})).override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
4556
clang = if enableLibcxx then llvm.libcxxClang else llvm.clang;
4657
clang-tools = llvm.clang-tools.override { inherit enableLibcxx; };
4758
cmakeHashes = {

0 commit comments

Comments
 (0)