From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 6C8C03858D28 for ; Wed, 3 Nov 2021 12:50:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C8C03858D28 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 89252218D5; Wed, 3 Nov 2021 10:24:47 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7411F13CE7; Wed, 3 Nov 2021 10:24:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YG01G29jgmGVEQAAMHmgww (envelope-from ); Wed, 03 Nov 2021 10:24:47 +0000 Subject: Re: [PATCH] gdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests To: Simon Marchi , gdb-patches@sourceware.org References: <20211102203434.3889269-1-simon.marchi@efficios.com> From: Tom de Vries Message-ID: <39183fd0-d31d-feb4-9cfd-8c928b5eaf06@suse.de> Date: Wed, 3 Nov 2021 11:24:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20211102203434.3889269-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2021 12:50:52 -0000 On 11/2/21 9:34 PM, Simon Marchi via Gdb-patches wrote: > We see some additional failures when running the testsuite against a GDB > compiled with ASan, compared to a GDB compiled without ASan. Some of > them are caused by the memory leak report shown by the GDB process when > it exits, and the fact that it makes it exit with a non-zero exit code. > > I generally try to remember to set ASAN_OPTIONS=detect_leaks=0 in my > environment when running the tests, but I don't always do it. I think > it would be nice if the testsuite did it. I don't see any use to have > leak detection when running the tests. That is, unless we ever have a > test that ensures GDB doesn't leak memory, which isn't going to happen > any time soon. > I like the idea. I also use the setting in my test scripts. FWIW, in addition, I also use "alloc_dealloc_mismatch=0", that error was triggered at some point. I've just done a run without this setting, and it didn't trigger anything. I tried to understand why, and stumbled onto https://sourceware.org/pipermail/gdb-patches/2021-May/178413.html , which seems to have been approved, but never committed. The problem described there, using LD_PRELOAD like so: ... $ LD_PRELOAD=/usr/lib64/libasan.so.6 ./gdb ... does reproduce for me, and applying the patch fixes it. I've done a build and test run, and will commit shortly. Also there a few test-cases which fail when using asan, we could annotate those perhaps with abort_on_error=1 or some such. Thanks, - Tom > Here are some tests I found that were affected by this: > > gdb.base/batch-exit-status.exp > gdb.base/many-headers.exp: read core file > gdb.base/quit.exp > gdb.base/with-mf.exp > gdb.dwarf2/gdb-add-index.exp > gdb.dwarf2/gdb-add-index-symlink.exp > gdb.dwarf2/imported-unit-runto-main.exp > > Change-Id: I784c7df8a13979eb96587f735c1d33ba2cc6e0ca > --- > gdb/testsuite/lib/gdb.exp | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 7f02504262d..97bedd5cb58 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -25,6 +25,13 @@ 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" > + > # List of procs to run in gdb_finish. > set gdb_finish_hooks [list] > >