From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59884 invoked by alias); 11 Feb 2020 08:10:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 59873 invoked by uid 89); 11 Feb 2020 08:10:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:Tue, Application, unreliable X-HELO: mail-wr1-f65.google.com Received: from mail-wr1-f65.google.com (HELO mail-wr1-f65.google.com) (209.85.221.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 08:10:46 +0000 Received: by mail-wr1-f65.google.com with SMTP id g3so9956626wrs.12 for ; Tue, 11 Feb 2020 00:10:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7YdWdbAo093zWvhJnL5jV0RNk/DS++u4G1w00eOoOUQ=; b=R9O0vUC5mgBW77d1ynXB59EUxbRRKG2nG8FPw1BSnZghjkg2ndDbQuOrWUVylKDt4+ T5JWR910FjsQMzgSh9aFHJjWfnxon1Fh/p3Svj2Yu1Y5y7SdNBC5UjUWzNQGQbOtj2Q+ O+KzeaEK5jK/oYZ7gDsDjMxt+hm1bsz7bofwRFPxDdO+Q0ZEndGYhxPUMu4iZ87jlb9F 9IAgjoV+c6clY6XAblpqUovDQSEMlsxJ2PT3JETjQxgamUjZ3WtNuoK/NXA4U1UPmPKl ycU37QqQUkijG+C33i3QVm9lfbEMgzN/pNT6jc5xGIyNIKCnRLuo4HkPeCQAJJv6vjsJ kctQ== Return-Path: Received: from [172.29.6.113] (26.124.146.82.ipv4.evonet.be. [82.146.124.26]) by smtp.gmail.com with ESMTPSA id x11sm2670793wmg.46.2020.02.11.00.10.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Feb 2020 00:10:43 -0800 (PST) Subject: Re: [PATCH 04/14] gdb/testsuite: Avoid fake failures when exit is unreliable To: Shahab Vahedi , gdb-patches@sourceware.org Cc: Shahab Vahedi , Francois Bedard , Anton Kolesov References: <20200207150003.8383-1-shahab.vahedi@gmail.com> <20200207150003.8383-5-shahab.vahedi@gmail.com> From: Luis Machado Message-ID: <8f69ff53-d8af-deed-b886-d83459f26b34@linaro.org> Date: Tue, 11 Feb 2020 08:10:00 -0000 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: <20200207150003.8383-5-shahab.vahedi@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00309.txt.bz2 Hi, On 2/7/20 11:59 AM, Shahab Vahedi wrote: > From: Anton Kolesov > > Tests that run in background will not run properly with targets that > doesn't have a proper "exit" function. For example, gdb.base/hook-stop > expects that after hook will resume inferior in background, there would > be a message "exited normally", however such a message will appear only > for targets with a proper exit(), while others will, for example, spin > in the infinite loop. > > Test gdb.base/nextoverexit expects message "inferior exited normally", > which is present only when exit() actually halts the target. > > Some tests in gdb.base/commands.exp has a flow that expects that > application can exit itself, which is not true when exit() function is > not reliable. > > This patch makes those tests conditional - they run only if exit is > reliable. I don't know about this one. Doesn't your debugging stub have a way of detecting a call to exit, for example? These changes seem to indicate you are using some custom/modified dejagnu board to run your tests. Is your target a qemu/probe that gdb connects to and then does the tests? > > gdb/testsuite/ChangeLog: > 2016-07-13 Anton Kolesov > > * gdb.base/callexit.exp: Expect an "exit()" only if > "exit_is_reliable" says so. > * gdb.base/commands.exp: Likewise. > * gdb.base/ena-dis-br.exp: Likewise. > * gdb.base/hook-stop.exp: Likewise. > * gdb.base/nextoverexit.exp: Likewise. > * gdb.mi/mi-break.exp: Likewise. > * gdb.mi/mi-exit-code.exp: Likewise. > * gdb.mi/mi-simplerun.exp: Likewise. > > Signed-off-by: Anton Kolesov > --- > gdb/testsuite/gdb.base/callexit.exp | 7 +++++++ > gdb/testsuite/gdb.base/commands.exp | 14 ++++++++++++++ > gdb/testsuite/gdb.base/ena-dis-br.exp | 18 +++++++++++------- > gdb/testsuite/gdb.base/hook-stop.exp | 12 +++++++++++- > gdb/testsuite/gdb.base/nextoverexit.exp | 7 +++++++ > gdb/testsuite/gdb.mi/mi-break.exp | 5 +++++ > gdb/testsuite/gdb.mi/mi-exit-code.exp | 5 +++++ > gdb/testsuite/gdb.mi/mi-simplerun.exp | 5 +++++ > 8 files changed, 65 insertions(+), 8 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/callexit.exp b/gdb/testsuite/gdb.base/callexit.exp > index 67ff48283646..4fc2d5a2669a 100644 > --- a/gdb/testsuite/gdb.base/callexit.exp > +++ b/gdb/testsuite/gdb.base/callexit.exp > @@ -28,6 +28,13 @@ if [target_info exists gdb,cannot_call_functions] { > continue > } > > +# Some targets (for example baremetal ones) doesn't have exit() that actually > +# exits anywhere. > +if ![exit_is_reliable] { > + unsupported "This target doesn't have reliable exit() function." > + continue > +} > + > # Start with a fresh gdb. > > clean_restart ${binfile} > diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp > index 869d0a81a4a7..fd92b3fa3111 100644 > --- a/gdb/testsuite/gdb.base/commands.exp > +++ b/gdb/testsuite/gdb.base/commands.exp > @@ -694,6 +694,13 @@ proc_with_prefix deprecated_command_test {} { > proc_with_prefix bp_deleted_in_command_test {} { > global gdb_prompt > > + # Flow of this test assumes that application will halt after reaching the > + # exit() function. > + if ![exit_is_reliable] { > + unsupported "Function exit() is not reliable on this board." > + return 0 > + } > + > delete_breakpoints > > # Create a breakpoint, and associate a command-list to it, with > @@ -736,6 +743,13 @@ proc_with_prefix bp_deleted_in_command_test {} { > } > > proc_with_prefix temporary_breakpoint_commands {} { > + # Flow of this test assumes that application will halt after reaching the > + # exit() function. > + if ![exit_is_reliable] { > + unsupported "Function exit() is not reliable on this board." > + return 0 > + } > + > delete_breakpoints > > # Create a temporary breakpoint, and associate a commands list to it. > diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp > index c338a0d51fa9..bf670cbae948 100644 > --- a/gdb/testsuite/gdb.base/ena-dis-br.exp > +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp > @@ -295,13 +295,17 @@ gdb_test "continue 2" \ > gdb_test "next" ".*$bp_location11\[ \t\]*marker1.*" \ > "step after continue with ignore count" > > -set test "continue with ignore count, not stopped at bpt" > -gdb_test_multiple "continue 2" "$test" { > - -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" { > - pass "$test" > - } > - -re "No breakpoint number -1.*$gdb_prompt $" { > - kfail gdb/1689 "$test" > +# Application is expected to reach an exit() here, so this can't be run if exit > +# is not working. > +if [exit_is_reliable] { > + set test "continue with ignore count, not stopped at bpt" > + gdb_test_multiple "continue 2" "$test" { > + -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" { > + pass "$test" > + } > + -re "No breakpoint number -1.*$gdb_prompt $" { > + kfail gdb/1689 "$test" > + } > } > } > > diff --git a/gdb/testsuite/gdb.base/hook-stop.exp b/gdb/testsuite/gdb.base/hook-stop.exp > index 6b49e39b7380..c9bc3d3b6438 100644 > --- a/gdb/testsuite/gdb.base/hook-stop.exp > +++ b/gdb/testsuite/gdb.base/hook-stop.exp > @@ -165,5 +165,15 @@ proc hook_stop_next {} { > hook_stop_before_frame > hook_stop_kill > hook_stop_continue_fg > -hook_stop_continue_bg > + > +# Tests that run in background will not run properly with targets that > +# doesn't have a proper "exit" function. For example, this particular > +# test expects that after hook will resume inferior in background, there > +# would be a message "exited normally", however such a message will > +# appear only for targets with a proper # exit(), while others will, for > +# example, spin in the infinite loop. > +if [exit_is_reliable] { > + hook_stop_continue_bg > +} > + > hook_stop_next > diff --git a/gdb/testsuite/gdb.base/nextoverexit.exp b/gdb/testsuite/gdb.base/nextoverexit.exp > index 30eafef675ff..fcea35762b00 100644 > --- a/gdb/testsuite/gdb.base/nextoverexit.exp > +++ b/gdb/testsuite/gdb.base/nextoverexit.exp > @@ -14,6 +14,13 @@ > > standard_testfile > > +# This tests expects message "inferior exited normally", which is present only > +# when exit() actually halts the target. > +if ![exit_is_reliable] { > + unsupported "Function exit() is not reliable on this board." > + return 0 > +} > + > if {[prepare_for_testing "failed to prepare" $testfile $testfile.c]} { > return -1 > } > diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp > index 1149bb34c8dc..acec246f52ee 100644 > --- a/gdb/testsuite/gdb.mi/mi-break.exp > +++ b/gdb/testsuite/gdb.mi/mi-break.exp > @@ -244,6 +244,11 @@ proc test_disabled_creation {} { > proc test_breakpoint_commands {} { > global line_callee2_body > > + if ![exit_is_reliable] { > + unsupported "This test requires working exit() function." > + return 0 > + } > + > set bp_no_script \ > [mi_create_breakpoint "basics.c:callee2" \ > "breakpoint commands: insert breakpoint at basics.c:callee2" \ > diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.exp b/gdb/testsuite/gdb.mi/mi-exit-code.exp > index f10b49cee0f8..fb5c693597da 100644 > --- a/gdb/testsuite/gdb.mi/mi-exit-code.exp > +++ b/gdb/testsuite/gdb.mi/mi-exit-code.exp > @@ -23,6 +23,11 @@ if [mi_gdb_start] { > > standard_testfile > > +if ![exit_is_reliable] { > + unsupported "Function exit() is not reliable on this board." > + return 0 > +} > + > if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { > untested "failed to compile" > return -1 > diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp > index 20a079ead896..ce19122803da 100644 > --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp > +++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp > @@ -177,6 +177,11 @@ proc test_program_termination {} { > # -exec-abort > # (normal termination of inferior) > > + if ![exit_is_reliable] { > + unsupported "Function exit() is not reliable on this board." > + return > + } > + > mi_execute_to "exec-continue" "exited-normally" "" "" "" "" "" "continue to end" > } > >