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