From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D09B838460AD for ; Mon, 28 Nov 2022 14:34:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D09B838460AD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669646060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Qk7pJ3nFnKEvO7arjMgEnzDEls1E9YZH4ptP1uN0tbg=; b=huwVg3AbKOqEL4erAADcWZy7lKsi4kuars4AM0AGTrQo9cfTtmLHsKijZgY1Tsph3o67HE b6KV4nkV5GfeAQLFCFtNHQdZ9NTf8OospfW7/TcTKRf5KYov/wUvwJLmIxFtvYY4SIxhm7 JzNpI/aSMQDdy0pQkXVr8FNcUk4mEGQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-176-TYpU7P57NDSp_sC8igjMlg-1; Mon, 28 Nov 2022 09:34:19 -0500 X-MC-Unique: TYpU7P57NDSp_sC8igjMlg-1 Received: by mail-wm1-f69.google.com with SMTP id 8-20020a05600c228800b003d0376e42deso3757784wmf.4 for ; Mon, 28 Nov 2022 06:34:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qk7pJ3nFnKEvO7arjMgEnzDEls1E9YZH4ptP1uN0tbg=; b=A5j4T5kmqNtFJNr81griWdw/1+TaiGY456Hc6Qnh6ir/NGtsIvo3IcGKTa3ioxTeFP bCqY6oUgokgKvrL7If833WXb8Xp0eKiRNFLx3HMZO1fYA7SyrEbtBvSouSEHJ9EGEEsn KQNUFD7DUKbkX3n8LNw/awYyLvWiX/8qjM+G9xHF67w77DK4419S9hg8lZE6Zp4+AbNk jm2DhwIGh4zGxG+kMt7r13/yDqrEZNQtdxTC3eY/0gR4Bc4il9UTrC3QdIWhhy2yi21K fSDfnP6ZdaY13F+GqRdom1+L8pX5oZdPCsE+J12lk168Nt0uMVVdR7ExzPEkdGR8jnO4 PHcw== X-Gm-Message-State: ANoB5pkBmE0as4zoBA1ASUDxF6isNhciDJAjUdnkS+wBpwLSRoX94HVG h47inxNsDuBk6KvHoe/HF0tRsQOIR/C8xBJX+QQIaL1pZ926oFW+VT70qowN9W3vLUSh/lhtaB5 A3e0OjUNzs9mKSII3eA/ocqx+xOpJfktx4lAQuFzb0/nw6i6q4I1VStxj+Fk3jPT9lesNuzQ0Mw == X-Received: by 2002:a7b:c00a:0:b0:3cf:e8f0:ad11 with SMTP id c10-20020a7bc00a000000b003cfe8f0ad11mr41944428wmb.65.1669646057803; Mon, 28 Nov 2022 06:34:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf41ZqKAvF/JfwjZMMBdRxWPEDLziFFSyN9zs5veBLW5Y7Vj2RVeIarFnbSJ9DPK2KEj2s3DeQ== X-Received: by 2002:a7b:c00a:0:b0:3cf:e8f0:ad11 with SMTP id c10-20020a7bc00a000000b003cfe8f0ad11mr41944395wmb.65.1669646057345; Mon, 28 Nov 2022 06:34:17 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id f6-20020adff8c6000000b002258235bda3sm10500558wrq.61.2022.11.28.06.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 06:34:16 -0800 (PST) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH] gdb/testsuite: fail if gdb_start_cmd fails In-Reply-To: <20221118160647.912966-1-simon.marchi@polymtl.ca> References: <20221118160647.912966-1-simon.marchi@polymtl.ca> Date: Mon, 28 Nov 2022 14:34:15 +0000 Message-ID: <877czf2lnc.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Simon Marchi via Gdb-patches writes: > I broke gdb.ada/start.exp, and did not notice it, because it outputs an > UNTESTED if gdb_start_cmd fails. I don't really see when start would > fail and it's not a problem that should be looked at. Change all spots > that call untested after a gdb_start_cmd failure, use fail instead. > > Doing so caused some failures with the native-gdbserver board. Some > tests that use "start" were relying on the fact that start would fail > with that board to just return with "untested". Change them to add an > early return if use_gdb_stub returns true. > > Some gdb.pascal tests also failed with native-gdbserver, because they > did use gdb_start_cmd to start the inferior, for no good reason. > Convert them to use runto_main instead, which does the right thing if > the target is a stub. > > A further refactoring could be to make gdb_start_cmd match the expected > breakpoint hit and the prompt, which it doesn't do currently (it leaves > that to the callers, but not all of them do). LGTM too. Thanks, Andrew > > Change-Id: I097370851213e798ff29fb6cf8ba25ef7d2be007 > --- > gdb/testsuite/gdb.ada/exec_changed.exp | 2 +- > gdb/testsuite/gdb.ada/start.exp | 2 +- > gdb/testsuite/gdb.base/start-cpp.exp | 7 ++++++- > gdb/testsuite/gdb.base/start.exp | 6 +++++- > gdb/testsuite/gdb.base/watchpoint-hw.exp | 6 +++++- > gdb/testsuite/gdb.dwarf2/main-subprogram.exp | 7 ++++++- > gdb/testsuite/gdb.pascal/floats.exp | 12 ++++-------- > gdb/testsuite/gdb.pascal/gdb11492.exp | 12 +++++------- > gdb/testsuite/gdb.pascal/hello.exp | 18 +++++------------- > gdb/testsuite/gdb.pascal/integers.exp | 13 +++++-------- > 10 files changed, 43 insertions(+), 42 deletions(-) > > diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp > index 52868f61c893..e09f59e52695 100644 > --- a/gdb/testsuite/gdb.ada/exec_changed.exp > +++ b/gdb/testsuite/gdb.ada/exec_changed.exp > @@ -54,7 +54,7 @@ gdb_load ${common_binfile} > > # Start the program, we should land in the program main procedure > if { [gdb_start_cmd] < 0 } { > - untested start > + fail start > return -1 > } > > diff --git a/gdb/testsuite/gdb.ada/start.exp b/gdb/testsuite/gdb.ada/start.exp > index de080711f7b9..63dcc619f1fb 100644 > --- a/gdb/testsuite/gdb.ada/start.exp > +++ b/gdb/testsuite/gdb.ada/start.exp > @@ -34,7 +34,7 @@ clean_restart ${testfile} > > # Verify that "start" lands inside the right procedure. > if { [gdb_start_cmd] < 0 } { > - untested "start failed to land inside the right procedure" > + fail "start failed to land inside the right procedure" > return -1 > } > > diff --git a/gdb/testsuite/gdb.base/start-cpp.exp b/gdb/testsuite/gdb.base/start-cpp.exp > index 9fabab4fe640..63b6ec006ca6 100644 > --- a/gdb/testsuite/gdb.base/start-cpp.exp > +++ b/gdb/testsuite/gdb.base/start-cpp.exp > @@ -13,6 +13,11 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see . > > +if { [use_gdb_stub] } { > + unsupported "test requires running" > + return > +} > + > standard_testfile .cc > > if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { > @@ -28,7 +33,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { > > # For C++ programs, "start" should stop in main(). > if { [gdb_start_cmd] < 0 } { > - untested start > + fail start > return -1 > } > > diff --git a/gdb/testsuite/gdb.base/start.exp b/gdb/testsuite/gdb.base/start.exp > index 9de3db31469e..a0c8c8c41c1c 100644 > --- a/gdb/testsuite/gdb.base/start.exp > +++ b/gdb/testsuite/gdb.base/start.exp > @@ -13,6 +13,10 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see . > > +if { [use_gdb_stub] } { > + unsupported "test requires running" > + return > +} > > standard_testfile > > @@ -25,7 +29,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { > > # For C programs, "start" should stop in main(). > if { [gdb_start_cmd] < 0 } { > - untested start > + fail start > return -1 > } > > diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.exp b/gdb/testsuite/gdb.base/watchpoint-hw.exp > index 23de0c3a91e9..d0fd1621efe4 100644 > --- a/gdb/testsuite/gdb.base/watchpoint-hw.exp > +++ b/gdb/testsuite/gdb.base/watchpoint-hw.exp > @@ -13,6 +13,10 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see . > > +if { [use_gdb_stub] } { > + unsupported "test requires running" > + return > +} > > if {[skip_hw_watchpoint_tests]} { > return 0 > @@ -33,7 +37,7 @@ gdb_test "watch watchee" "atchpoint 1: watchee" > # `runto_main' or `runto main' would delete the watchpoint created above. > > if { [gdb_start_cmd] < 0 } { > - untested start > + fail start > return -1 > } > gdb_test "" "main .* at .*" "start" > diff --git a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp > index df302ff94281..14adf66fba97 100644 > --- a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp > +++ b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp > @@ -19,6 +19,11 @@ if {![dwarf2_support]} { > return 0 > } > > +if { [use_gdb_stub] } { > + unsupported "test requires running" > + return > +} > + > standard_testfile .c -dw.S > > # Make some DWARF for the test. > @@ -62,7 +67,7 @@ set have_index [exec_has_index_section $binfile] > # that this was the real "main". > > if {[gdb_start_cmd] < 0} { > - untested "could not start ${testfile}" > + fail "could not start ${testfile}" > return -1 > } > > diff --git a/gdb/testsuite/gdb.pascal/floats.exp b/gdb/testsuite/gdb.pascal/floats.exp > index 32a8ea4352de..1804597e902e 100644 > --- a/gdb/testsuite/gdb.pascal/floats.exp > +++ b/gdb/testsuite/gdb.pascal/floats.exp > @@ -24,6 +24,10 @@ if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable > > clean_restart ${testfile} > > +if { ![runto_main] } { > + return > +} > + > set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] > set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] > > @@ -34,14 +38,6 @@ if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { > pass "setting breakpoint 2" > } > > -# Verify that "start" lands inside the right procedure. > -if { [gdb_start_cmd] < 0 } { > - untested start > - return -1 > -} > - > -gdb_test "" ".* at .*${srcfile}.*" "start" > - > gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "going to first breakpoint" > gdb_test "print r" ".* = 0" "print r before assigned to 1.25" > > diff --git a/gdb/testsuite/gdb.pascal/gdb11492.exp b/gdb/testsuite/gdb.pascal/gdb11492.exp > index 66c2de1c4a2e..84dcca75ae2d 100644 > --- a/gdb/testsuite/gdb.pascal/gdb11492.exp > +++ b/gdb/testsuite/gdb.pascal/gdb11492.exp > @@ -23,19 +23,17 @@ if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable > } > > clean_restart ${testfile} > + > +if { ![runto_main] } { > + return > +} > + > set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] > > if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { > pass "setting breakpoint 1" > } > > -# Verify that "start" lands inside the right procedure. > -if { [gdb_start_cmd] < 0 } { > - untested start > - return -1 > -} > - > -gdb_test "" ".* at .*${srcfile}.*" "start" > gdb_test "continue" "" > > gdb_test "print integer_array" { = \{50, 51, 52, 53, 54, 55, 56, 57\}} > diff --git a/gdb/testsuite/gdb.pascal/hello.exp b/gdb/testsuite/gdb.pascal/hello.exp > index f7ae8ed89d01..e744045ac4fa 100644 > --- a/gdb/testsuite/gdb.pascal/hello.exp > +++ b/gdb/testsuite/gdb.pascal/hello.exp > @@ -22,6 +22,11 @@ if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable > } > > clean_restart ${testfile} > + > +if { ![runto_main] } { > + return > +} > + > set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] > set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] > > @@ -32,19 +37,6 @@ if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { > pass "setting breakpoint 2" > } > > -# Verify that "start" lands inside the right procedure. > -if { [gdb_start_cmd] < 0 } { > - untested start > - return -1 > -} > - > -# This test fails for gpc > -# because debug information for 'main' > -# is in some > -gdb_test "" \ > - ".* at .*hello.pas.*" \ > - "start" > - > gdb_test "cont" \ > "Breakpoint .*:${bp_location1}.*" \ > "Going to first breakpoint" > diff --git a/gdb/testsuite/gdb.pascal/integers.exp b/gdb/testsuite/gdb.pascal/integers.exp > index e11335a5faec..8a2f517c6731 100644 > --- a/gdb/testsuite/gdb.pascal/integers.exp > +++ b/gdb/testsuite/gdb.pascal/integers.exp > @@ -22,6 +22,11 @@ if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable > } > > clean_restart ${testfile} > + > +if { ![runto_main] } { > + return > +} > + > set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] > set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] > > @@ -32,14 +37,6 @@ if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { > pass "setting breakpoint 2" > } > > -# Verify that "start" lands inside the right procedure. > -if { [gdb_start_cmd] < 0 } { > - untested start > - return -1 > -} > - > -gdb_test "" ".* at .*${srcfile}.*" "start" > - > gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "going to first breakpoint" > > gdb_test "print i" ".* = 0" "print i before assigned to 1" > > base-commit: 6533cbeeb831224e2d2dd2a7bea54b22b798fa39 > -- > 2.38.1