public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Allow override of ASAN_OPTIONS in lib/gdb.exp
Date: Tue, 12 Jul 2022 14:38:16 +0200	[thread overview]
Message-ID: <20220712123814.GA19876@delia.home> (raw)

Hi,

Use set_sanitizer_default for ASAN_OPTIONS in lib/gdb.exp.

This allows us to override the default detect_leaks=0 setting, by manually
doing:
...
$ export ASAN_OPTIONS=detect_leaks=1
$ make check
...

Tested on x86_64-linux, by building with -fsanitize=address and running
test-case gdb.dwarf2/gdb-add-index.exp with and without
"export ASAN_OPTIONS=detect_leaks=1".

Any comments?

Thanks,
- Tom

[gdb/testsuite] Allow override of ASAN_OPTIONS in lib/gdb.exp

---
 gdb/testsuite/lib/gdb.exp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 698dd14504e..a8f25b5f0dd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -25,13 +25,6 @@ if {$tool == ""} {
     exit 2
 }
 
-# If GDB is built with ASAN (and because there are leaks), it will output a
-# leak report when exiting as well as exit with a non-zero (failure) status.
-# This can affect tests that are sensitive to what GDB prints on stderr or its
-# exit status.  Add `detect_leaks=0` to the ASAN_OPTIONS environment variable
-# (which will affect any spawned sub-process) to avoid this.
-append ::env(ASAN_OPTIONS) ",detect_leaks=0"
-
 # Add VAR_ID=VAL to ENV_VAR, unless ENV_VAR already contains a VAR_ID setting.
 
 proc set_sanitizer_default { env_var var_id val } {
@@ -58,6 +51,13 @@ proc set_sanitizer_default { env_var var_id val } {
 set_sanitizer_default TSAN_OPTIONS suppressions \
     $srcdir/../tsan-suppressions.txt
 
+# If GDB is built with ASAN (and because there are leaks), it will output a
+# leak report when exiting as well as exit with a non-zero (failure) status.
+# This can affect tests that are sensitive to what GDB prints on stderr or its
+# exit status.  Add `detect_leaks=0` to the ASAN_OPTIONS environment variable
+# (which will affect any spawned sub-process) to avoid this.
+set_sanitizer_default ASAN_OPTIONS detect_leaks 0
+
 # List of procs to run in gdb_finish.
 set gdb_finish_hooks [list]
 

             reply	other threads:[~2022-07-12 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 12:38 Tom de Vries [this message]
2022-07-15 16:03 ` Tom Tromey

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=20220712123814.GA19876@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).