aboutsummaryrefslogtreecommitdiff
path: root/tests/docker/test-tsan
diff options
context:
space:
mode:
authorRobert Foley <robert.foley@linaro.org>2020-06-12 20:02:31 +0100
committerAlex Bennée <alex.bennee@linaro.org>2020-06-16 14:49:05 +0100
commitdf79fd5667fb99c6fdfa0d295cb020e9e3eef1e7 (patch)
tree9c80818d4c759488e72fcfe007280b6f0ea9c6ac /tests/docker/test-tsan
parent45a9595a1b16666cdac1969469937b72cfb28129 (diff)
downloadqemu-df79fd5667fb99c6fdfa0d295cb020e9e3eef1e7.zip
qemu-df79fd5667fb99c6fdfa0d295cb020e9e3eef1e7.tar.gz
qemu-df79fd5667fb99c6fdfa0d295cb020e9e3eef1e7.tar.bz2
tests/docker: Added docker build support for TSan.
Added a new docker for ubuntu 20.04. This docker has support for Thread Sanitizer including one patch we need in one of the header files. https://github.com/llvm/llvm-project/commit/a72dc86cd This command will build with tsan enabled: make docker-test-tsan-ubuntu2004 V=1 Also added the TSAN suppresion file to disable certain cases of TSAN warnings. Cc: Fam Zheng <fam@euphon.net> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Robert Foley <robert.foley@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200609200738.445-10-robert.foley@linaro.org> Message-Id: <20200612190237.30436-13-alex.bennee@linaro.org>
Diffstat (limited to 'tests/docker/test-tsan')
-rwxr-xr-xtests/docker/test-tsan44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/docker/test-tsan b/tests/docker/test-tsan
new file mode 100755
index 0000000..eb40ac4
--- /dev/null
+++ b/tests/docker/test-tsan
@@ -0,0 +1,44 @@
+#!/bin/bash -e
+#
+# This test will use TSan as part of a build and a make check.
+#
+# Copyright (c) 2020 Linaro
+# Copyright (c) 2016 Red Hat Inc.
+#
+# Authors:
+# Robert Foley <robert.foley@linaro.org>
+# Originally based on test-quick from Fam Zheng <famz@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+setup_tsan()
+{
+ requires clang tsan
+ tsan_log_dir="/tmp/qemu-test/build/tsan"
+ mkdir -p $tsan_log_dir > /dev/null || true
+ EXTRA_CONFIGURE_OPTS="${EXTRA_CONFIGURE_OPTS} --enable-tsan \
+ --cc=clang-10 --cxx=clang++-10 \
+ --disable-werror --extra-cflags=-O0"
+ # detect deadlocks is false currently simply because
+ # TSan crashes immediately with deadlock detector enabled.
+ # We have maxed out the history size to get the best chance of finding
+ # warnings during testing.
+ # Note, to get TSan to fail on warning, use exitcode=66 below.
+ tsan_opts="suppressions=/tmp/qemu-test/src/tests/tsan/suppressions.tsan\
+ detect_deadlocks=false history_size=7\
+ halt_on_error=0 exitcode=0 verbose=5\
+ log_path=$tsan_log_dir/tsan_warning"
+ export TSAN_OPTIONS="$tsan_opts"
+}
+
+cd "$BUILD_DIR"
+
+TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
+setup_tsan
+build_qemu
+check_qemu
+install_qemu