From patchwork Tue Feb 18 09:39:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 38196 Received: (qmail 103993 invoked by alias); 18 Feb 2020 09:39:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 103981 invoked by uid 89); 18 Feb 2020 09:39:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=redirect, intentional, hitting, 18022020 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Feb 2020 09:39:36 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9DC4EB31B; Tue, 18 Feb 2020 09:39:34 +0000 (UTC) Subject: [committed][gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info To: Simon Marchi , Tom Tromey Cc: gdb-patches@sourceware.org References: <20200213105754.GA22520@delia> <87imkapngd.fsf@tromey.com> <2319b744-2902-9c09-2448-450e40347c04@suse.de> From: Tom de Vries Message-ID: Date: Tue, 18 Feb 2020 10:39:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes [ was: Re: [PATCH][gdb/testsuite] Ignore pass/fail/unsupported in gdb-caching-proc.exp ] On 18-02-2020 00:58, Simon Marchi wrote: >> >> if { ! [runto "GNAT_Debug_Info_Test"] } { >> - fail "failed to run to GNAT_Debug_Info_Test" >> return 0 >> } >> >> @@ -183,7 +190,6 @@ gdb_caching_proc gnat_runtime_has_debug_info { >> } >> default { >> # Some other unexpected output... >> - fail $gdb_test_name >> } >> } >> > > I'd be tempted to keep these last two "fail"s. They should not show up normally, > regardless of whether gnatmake is installed. But let's say: > > - the Ada runtime ever changes (__gnat_debug_raise_exception is renamed), or > - the output of the command "whatis __gnat_debug_raise_exception" changes > > then they'll show up, which is desirable because it means we need to come > and change something here. If the output of > "whatis __gnat_debug_raise_exception" changes in a way that it is not > recognized anymore and there is no FAIL, then gnat_runtime_has_debug_info > will just start returning false all the time and we might not notice it for a > while. Ack, committed as attached, keeping the last two fails. FWIW, I scanned a bit other gdb_caching_procs and there seems to be an idiom to handle hitting the default case of an expect using a warning, f.i. in skip_aarch64_sve_tests: ... default { warning "\n$me: default case taken" set skip_sve_tests 1 } ... So we could use that at least for the last fail. Also, here and there verbose seems to be used instead of fail. The gdb_caching_procs seem to avoid explicitly calling pass and fail, but usage of gdb_test_multiple does happen a couple of time, which might result in fails etc (but then again, that might not have been intentional, I'm not sure). In any case, we could either: - forbid calling pass in gdb_caching_proc, or - more accommodatingly, ignore pass in gdb_caching_proc. Both by renaming pass in gdb_do_cache. Likewise, we could perhaps redirect fails to warnings. Thanks, - Tom [gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info After de-installing gnatmake, I get on stdout/stderr: ... Running src/gdb/testsuite/gdb.base/gdb-caching-proc.exp ... FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary ... FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary ... In gdb.sum, we see these FAILs (each paired with an UNSUPPORTED as well) followed by: ... PASS: gdb-caching-proc.exp: gnat_runtime_has_debug_info consistency ... Likewise, after re-installing gnatmake, I get a PASS for each of the UNSUPPORTEDs, and the FAILs disappear. The FAIL comes from gnat_runtime_has_debug_info, the PASS/UNSUPPORTED comes from gdb_compile_ada. Fix this by removing the corresponding fail call in gnat_runtime_has_debug_info, as well as using a new variant gdb_compile_ada_1 that doesn't call pass/unsupported. Tested on x86_64-linux, with gnatmake installed and de-installed. gdb/testsuite/ChangeLog: 2020-02-18 Tom de Vries * lib/ada.exp (gdb_compile_ada_1): Factor out of ... (gdb_compile_ada): ... here. (gnat_runtime_has_debug_info): Remove fail call for gdb_compile_ada failure. Use gdb_compile_ada_1 instead of gdb_compile_ada. --- gdb/testsuite/lib/ada.exp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 9933cc951e..6648566ec3 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -52,9 +52,9 @@ proc target_compile_ada_from_dir {builddir source dest type options} { return -options $options $result } -# Compile some Ada code. +# Compile some Ada code. Return "" if the compile was successful. -proc gdb_compile_ada {source dest type options} { +proc gdb_compile_ada_1 {source dest type options} { set srcdir [file dirname $source] set gprdir [file dirname $srcdir] @@ -80,6 +80,15 @@ proc gdb_compile_ada {source dest type options} { # We therefore simply check whether the dest file has been created # or not. Unless not present, the build has succeeded. if [file exists $dest] { set result "" } + return $result +} + +# Compile some Ada code. Generate "PASS: foo.exp: compilation SOURCE" if the +# compile was successful. + +proc gdb_compile_ada {source dest type options} { + set result [gdb_compile_ada_1 $source $dest $type $options] + gdb_compile_test $source $result return $result } @@ -162,8 +171,7 @@ gdb_caching_proc gnat_runtime_has_debug_info { set src "$srcdir/lib/gnat_debug_info_test.adb" set dst [standard_output_file "gnat_debug_info_test"] - if { [gdb_compile_ada $src $dst executable {debug}] != "" } { - fail "failed to compile gnat-debug-info test binary" + if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } { return 0 }