forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: add TSAN to the sanitizers pipelines (JuliaLang#42444)
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
TOOLCHAIN=$(BUILDROOT)/../toolchain | ||
BINDIR=$(TOOLCHAIN)/usr/bin | ||
TOOLDIR=$(TOOLCHAIN)/usr/tools | ||
|
||
# use our new toolchain | ||
USECLANG=1 | ||
override CC=$(BINDIR)/clang | ||
override CXX=$(TOOLDIR)/clang++ | ||
|
||
USE_BINARYBUILDER_LLVM=1 | ||
|
||
override SANITIZE=1 | ||
override SANITIZE_THREAD=1 | ||
|
||
# default to a debug build for better line number reporting | ||
override JULIA_BUILD_MODE=debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
# This file is a part of Julia. License is MIT: https://julialang.org/license | ||
|
||
# | ||
# Usage: | ||
# contrib/tsan/build.sh <path> [<make_targets>...] | ||
# | ||
# Build TSAN-enabled julia. Given a workspace directory <path>, build | ||
# TSAN-enabled julia in <path>/tsan. Required toolss are install under | ||
# <path>/toolchain. Note that the same <path> passed to `contrib/asan/build.sh` | ||
# can be used to share the toolchain used for ASAN. This scripts also takes | ||
# optional <make_targets> arguments which are passed to `make`. The default | ||
# make target is `debug`. | ||
|
||
set -ue | ||
|
||
# `$WORKSPACE` is a directory in which we create `toolchain` and `tsan` | ||
# sub-directories. | ||
WORKSPACE="$1" | ||
shift | ||
if [ "$WORKSPACE" = "" ]; then | ||
echo "Workspace directory must be specified as the first argument" >&2 | ||
exit 2 | ||
fi | ||
|
||
mkdir -pv "$WORKSPACE" | ||
WORKSPACE="$(cd "$WORKSPACE" && pwd)" | ||
if [ "$WORKSPACE" = "" ]; then | ||
echo "Failed to create the workspace directory." >&2 | ||
exit 2 | ||
fi | ||
|
||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
JULIA_HOME="$HERE/../../" | ||
|
||
echo | ||
echo "Installing toolchain..." | ||
|
||
TOOLCHAIN="$WORKSPACE/toolchain" | ||
if [ ! -d "$TOOLCHAIN" ]; then | ||
make -C "$JULIA_HOME" configure O=$TOOLCHAIN | ||
cp "$HERE/../asan/Make.user.tools" "$TOOLCHAIN/Make.user" | ||
fi | ||
|
||
make -C "$TOOLCHAIN/deps" install-clang install-llvm-tools | ||
|
||
# TODO: https://github.com/JuliaPackaging/Yggdrasil/issues/3359 | ||
rm "$TOOLCHAIN/usr/tools/clang++" | ||
ln -s "$TOOLCHAIN/usr/bin/clang" "$TOOLCHAIN/usr/tools/clang++" | ||
|
||
echo | ||
echo "Building Julia..." | ||
|
||
BUILD="$WORKSPACE/tsan" | ||
if [ ! -d "$BUILD" ]; then | ||
make -C "$JULIA_HOME" configure O="$BUILD" | ||
cp "$HERE/Make.user.tsan" "$BUILD/Make.user" | ||
fi | ||
|
||
cd "$BUILD" # so that we can pass `-C src` to `make` | ||
make "$@" |