qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Robert Foley <robert.foley@linaro.org>
Cc: "Fam Zheng" <fam@euphon.net>,
	peter.puhov@linaro.org, cota@braap.org,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v1 09/12] tests/docker: Added docker build support for TSan.
Date: Tue, 02 Jun 2020 21:21:08 +0100	[thread overview]
Message-ID: <87zh9l5idn.fsf@linaro.org> (raw)
In-Reply-To: <20200529132341.755-9-robert.foley@linaro.org>


Robert Foley <robert.foley@linaro.org> writes:

> 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-build-ubuntu2004 V=1 TSAN=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>
> ---
>  tests/docker/Makefile.include              |  2 +
>  tests/docker/common.rc                     | 19 +++++++
>  tests/docker/dockerfiles/ubuntu2004.docker | 65 ++++++++++++++++++++++
>  tests/tsan/blacklist.tsan                  | 10 ++++
>  tests/tsan/suppressions.tsan               | 14 +++++
>  5 files changed, 110 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/ubuntu2004.docker
>  create mode 100644 tests/tsan/blacklist.tsan
>  create mode 100644 tests/tsan/suppressions.tsan
>
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 43a8678688..e029e54b42 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -202,6 +202,7 @@ endif
>  	@echo '                         (default is 1)'
>  	@echo '    DEBUG=1              Stop and drop to shell in the created container'
>  	@echo '                         before running the command.'
> +	@echo '    TSAN=1               Enable use of tsan during the
> build/test.'

I'd rather not pollute the build with another env flag, rather...

>  	@echo '    NETWORK=1            Enable virtual network interface with default backend.'
>  	@echo '    NETWORK=$$BACKEND     Enable virtual network interface with $$BACKEND.'
>  	@echo '    NOUSER               Define to disable adding current user to containers passwd.'
> @@ -239,6 +240,7 @@ docker-run: docker-qemu-src
>  			-e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
>  			-e V=$V -e J=$J -e DEBUG=$(DEBUG)		\
>  			-e SHOW_ENV=$(SHOW_ENV) 			\
> +	                $(if $(TSAN),,-e TSAN=$(TSAN))		        \
>  			$(if $(NOUSER),,				\
>  				-e CCACHE_DIR=/var/tmp/ccache 		\
>  				-v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
> diff --git a/tests/docker/common.rc b/tests/docker/common.rc
> index 02cd67a8c5..5df93c6326 100755
> --- a/tests/docker/common.rc
> +++ b/tests/docker/common.rc
> @@ -27,6 +27,25 @@ requires()
>  
>  configure_qemu()
>  {
> +    if test -z "$TSAN"; then
> +        requires clang tsan
> +        echo "Including TSan Support"
> +        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 detecter 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_warnings.txt"
> +        export TSAN_OPTIONS="$tsan_opts"
> +    fi

...I think it would be better to put this in it's own test (test-tsan?)

-- 
Alex Bennée


  reply	other threads:[~2020-06-02 20:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 13:23 [PATCH v1 01/12] configure: add --enable-tsan flag + fiber annotations for coroutine-ucontext Robert Foley
2020-05-29 13:23 ` [PATCH v1 02/12] cpu: convert queued work to a QSIMPLEQ Robert Foley
2020-05-29 13:23 ` [PATCH v1 03/12] thread: add qemu_spin_destroy Robert Foley
2020-06-02 19:23   ` Alex Bennée
2020-05-29 13:23 ` [PATCH v1 04/12] cputlb: destroy CPUTLB with tlb_destroy Robert Foley
2020-06-02 19:25   ` Alex Bennée
2020-05-29 13:23 ` [PATCH v1 05/12] qht: call qemu_spin_destroy for head buckets Robert Foley
2020-06-02 19:26   ` Alex Bennée
2020-05-29 13:23 ` [PATCH v1 06/12] tcg: call qemu_spin_destroy for tb->jmp_lock Robert Foley
2020-05-29 13:23 ` [PATCH v1 07/12] translate-all: call qemu_spin_destroy for PageDesc Robert Foley
2020-05-29 13:23 ` [PATCH v1 08/12] thread: add tsan annotations to QemuSpin Robert Foley
2020-06-02 20:14   ` Alex Bennée
2020-05-29 13:23 ` [PATCH v1 09/12] tests/docker: Added docker build support for TSan Robert Foley
2020-06-02 20:21   ` Alex Bennée [this message]
2020-06-03 15:46     ` Robert Foley
2020-05-29 13:23 ` [PATCH v1 10/12] include/qemu: Added tsan.h for annotations Robert Foley
2020-05-29 13:23 ` [PATCH v1 11/12] util: Added tsan annotate for thread name Robert Foley
2020-06-01  3:56   ` Emilio G. Cota
2020-05-29 13:51 ` [PATCH v1 01/12] configure: add --enable-tsan flag + fiber annotations for coroutine-ucontext Eric Blake
2020-05-29 14:56   ` Robert Foley
2020-06-02 19:22 ` Alex Bennée
2020-06-03 16:51   ` Robert Foley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh9l5idn.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=cota@braap.org \
    --cc=fam@euphon.net \
    --cc=peter.puhov@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=robert.foley@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).