xref: /openbmc/qemu/tests/docker/test-tsan (revision 171080d8)
1df79fd56SRobert Foley#!/bin/bash -e
2df79fd56SRobert Foley#
3df79fd56SRobert Foley# This test will use TSan as part of a build and a make check.
4df79fd56SRobert Foley#
5df79fd56SRobert Foley# Copyright (c) 2020 Linaro
6df79fd56SRobert Foley# Copyright (c) 2016 Red Hat Inc.
7df79fd56SRobert Foley#
8df79fd56SRobert Foley# Authors:
9df79fd56SRobert Foley#  Robert Foley <robert.foley@linaro.org>
10df79fd56SRobert Foley#  Originally based on test-quick from Fam Zheng <famz@redhat.com>
11df79fd56SRobert Foley#
12df79fd56SRobert Foley# This work is licensed under the terms of the GNU GPL, version 2
13df79fd56SRobert Foley# or (at your option) any later version. See the COPYING file in
14df79fd56SRobert Foley# the top-level directory.
15df79fd56SRobert Foley
16df79fd56SRobert Foley. common.rc
17df79fd56SRobert Foley
18df79fd56SRobert Foleysetup_tsan()
19df79fd56SRobert Foley{
20888673bbSDaniel P. Berrangé    requires_binary clang
21df79fd56SRobert Foley    tsan_log_dir="/tmp/qemu-test/build/tsan"
22df79fd56SRobert Foley    mkdir -p $tsan_log_dir > /dev/null || true
23df79fd56SRobert Foley    EXTRA_CONFIGURE_OPTS="${EXTRA_CONFIGURE_OPTS} --enable-tsan \
24*171080d8SAlex Bennée                          --cc=clang --cxx=clang++ \
25df79fd56SRobert Foley                          --disable-werror --extra-cflags=-O0"
26df79fd56SRobert Foley    # detect deadlocks is false currently simply because
27df79fd56SRobert Foley    # TSan crashes immediately with deadlock detector enabled.
28df79fd56SRobert Foley    # We have maxed out the history size to get the best chance of finding
29df79fd56SRobert Foley    # warnings during testing.
30df79fd56SRobert Foley    # Note, to get TSan to fail on warning, use exitcode=66 below.
31df79fd56SRobert Foley    tsan_opts="suppressions=/tmp/qemu-test/src/tests/tsan/suppressions.tsan\
32df79fd56SRobert Foley               detect_deadlocks=false history_size=7\
33df79fd56SRobert Foley               halt_on_error=0 exitcode=0 verbose=5\
34df79fd56SRobert Foley               log_path=$tsan_log_dir/tsan_warning"
35df79fd56SRobert Foley    export TSAN_OPTIONS="$tsan_opts"
36df79fd56SRobert Foley}
37df79fd56SRobert Foley
38df79fd56SRobert Foleycd "$BUILD_DIR"
39df79fd56SRobert Foley
40df79fd56SRobert FoleyTARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
41df79fd56SRobert Foleysetup_tsan
42df79fd56SRobert Foleybuild_qemu
43df79fd56SRobert Foleycheck_qemu
44df79fd56SRobert Foleyinstall_qemu
45