From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 5E4783858407; Mon, 18 Jul 2022 04:20:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E4783858407 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Allow override of ASAN_OPTIONS in lib/gdb.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 9d9dd861e9815829124a4413f0446e3bcc119dca X-Git-Newrev: c3d3b64b34bff289f178e2267e6363f71b0c4234 Message-Id: <20220718042041.5E4783858407@sourceware.org> Date: Mon, 18 Jul 2022 04:20:41 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2022 04:20:41 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc3d3b64b34bf= f289f178e2267e6363f71b0c4234 commit c3d3b64b34bff289f178e2267e6363f71b0c4234 Author: Tom de Vries Date: Mon Jul 18 06:20:38 2022 +0200 [gdb/testsuite] Allow override of ASAN_OPTIONS in lib/gdb.exp =20 Use set_sanitizer_default for ASAN_OPTIONS in lib/gdb.exp. =20 This allows us to override the default detect_leaks=3D0 setting, by man= ually doing: ... $ export ASAN_OPTIONS=3Ddetect_leaks=3D1 $ make check ... =20 Tested on x86_64-linux, by building with -fsanitize=3Daddress and runni= ng test-case gdb.dwarf2/gdb-add-index.exp with and without "export ASAN_OPTIONS=3Ddetect_leaks=3D1". Diff: --- 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 5d6f1266b0f..ef68c3ce9fb 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -25,13 +25,6 @@ if {$tool =3D=3D ""} { exit 2 } =20 -# 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) statu= s. -# This can affect tests that are sensitive to what GDB prints on stderr or= its -# exit status. Add `detect_leaks=3D0` to the ASAN_OPTIONS environment var= iable -# (which will affect any spawned sub-process) to avoid this. -append ::env(ASAN_OPTIONS) ",detect_leaks=3D0" - # Add VAR_ID=3DVAL to ENV_VAR, unless ENV_VAR already contains a VAR_ID se= tting. =20 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 =20 +# 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) statu= s. +# This can affect tests that are sensitive to what GDB prints on stderr or= its +# exit status. Add `detect_leaks=3D0` to the ASAN_OPTIONS environment var= iable +# (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]