public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Andrew Burgess <aburgess@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCHv2 6/8] gdb/testsuite: expand gdb.base/foll-vfork.exp
Date: Wed, 5 Jul 2023 11:22:56 +0000	[thread overview]
Message-ID: <DM4PR11MB730310CD9DFEE77C6BD9EFE1C42FA@DM4PR11MB7303.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20cb4bbc67707268a75d32b8eaa539758ac4b31b.1688484032.git.aburgess@redhat.com>

On Tuesday, July 4, 2023 5:23 PM, Andrew Burgess wrote:
> This commit provides tests for all of the bugs fixed in the previous
> four commits, this is achieved by expanding gdb.base/foll-vfork.exp to
> run with different configurations:
> 
>   * target-non-stop on/off
>   * non-stop on/off
>   * schedule-multiple on/off
> 
> We don't test with schedule-multiple on if we are using a remote
> target, this is due to bug gdb/30574.  I've added a link to that bug
> in this commit, but all this commit does is expose that bug, there's
> no fixes here.
> 
> Some of the bugs fixed in the previous commits are very timing
> dependent, as such, they don't always show up.  I've had more success
> when running this test on a very loaded machine -- I usually run ~8
> copies of the test in parallel, then the bugs would normally show up
> pretty quickly.
> 
> Other than running the test in more configurations, I've not made any
> changes to what is actually being tested, other than in one place
> where, when testing with non-stop mode, GDB stops in a different
> inferior, as such I had to add a new 'inferior 2' call, this can be
> found in vfork_relations_in_info_inferiors.
> 
> I have cleaned things up a little, for example, making use of
> proc_with_prefix to remove some with_test_prefix calls.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30574
> ---
>  gdb/testsuite/gdb.base/foll-vfork.exp | 628 ++++++++++++--------------
>  1 file changed, 300 insertions(+), 328 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-
> vfork.exp
> index bdceff0f5de..be0715b05c0 100644
> --- a/gdb/testsuite/gdb.base/foll-vfork.exp
> +++ b/gdb/testsuite/gdb.base/foll-vfork.exp
> @@ -25,56 +25,52 @@ if {![istarget "*-linux*"]} {
>      continue
>  }
> 
> -standard_testfile
> +standard_testfile .c -exit.c vforked-prog.c
> 
> -set compile_options debug
> +set binfile $testfile
> +set binfile2 ${testfile}-exit
> +set binfile3 vforked-prog
> 
> -if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} {
> +if {[build_executable "compile $binfile" $binfile $srcfile] == -1} {
>      untested "failed to compile main testcase"
>      return -1
>  }
> 
> -set testfile2 "vforked-prog"
> -set srcfile2 ${testfile2}.c
> +if {[build_executable "compile $binfile2" $binfile2 $srcfile2] == -1} {
> +    untested "failed to compile main testcase"

A slightly different message can be used here, to distinguish it from the
case above.  Also in the untested usage below.

> +    return -1
> +}
> 
> -if {[build_executable $testfile.exp $testfile2 $srcfile2 $compile_options] == -1} {
> -    untested "failed to compile secondary testcase"
> +if {[build_executable "compile $binfile3" $binfile3 $srcfile3] == -1} {
> +    untested "failed to compile main testcase"
>      return -1
>  }
> 
...
> +proc_with_prefix vfork_child_follow_to_exit { binfile srcfile } {
> +    setup_gdb $binfile $srcfile
> +
> +    gdb_test_no_output "set follow-fork child"
> +
> +    gdb_test_multiple "continue" "continue to child exit" {
> +	-re -wrap "Couldn't get registers.*" {
> +	    # PR gdb/14766
> +	    fail $gdb_test_name

Since this is known, we can use a setup_kfail, I think.

> +	}
> +	-re -wrap "\\\[Attaching after.* vfork to.*\\\[Detaching vfork parent .* after
> child exit.*" {
> +	    pass $gdb_test_name
> +	}
> +    }
> +
> +    # The parent has been detached; allow time for any output it might
> +    # generate to arrive, so that output doesn't get confused with
> +    # any gdb_expected debugger output from a subsequent testpoint.
> +    #
> +    exec sleep 1
> +}
> +
...
> +proc_with_prefix vfork_relations_in_info_inferiors { variant binfile srcfile
> non_stop } {
> +    setup_gdb $binfile $srcfile
> +
> +    gdb_test_no_output "set follow-fork child"
> +
> +    gdb_test_multiple "next" "next over vfork" {
> +	-re -wrap "\\\[Attaching after .* vfork to child.*if \\(pid == 0\\).*" {
> +	    pass $gdb_test_name
> +	}
> +    }
> +
> +    if { $non_stop } {
> +	gdb_test "inferior 2" ".*"
> +    }
> +
> +    gdb_test "info inferiors" \
> +	".*is vfork parent of inferior 2.*is vfork child of inferior 1" \
> +	"info inferiors shows vfork parent/child relation"
> +
> +    if { $variant == "exec" } {
> +	set linenum [gdb_get_line_number "Hello from vforked-prog" ${::srcfile3}]
> +	gdb_test_multiple "continue" "continue to bp" {
> +	    -re -wrap ".*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*"
> {
> +		pass $gdb_test_name
> +	    }
> +	}
> +    } else {
> +	gdb_test_multiple "continue" "continue to child exit" {
> +	   -re -wrap "exited normally.*" {
> +	       pass $gdb_test_name
>  	   }

How about using gdb_continue_to_end instead of this gdb_test_multiple?

Thanks
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  reply	other threads:[~2023-07-05 11:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 13:17 [PATCH 0/8] Some vfork related fixes Andrew Burgess
2023-06-22 13:17 ` [PATCH 1/8] gdb: catch more errors in gdb.base/foll-vfork.exp Andrew Burgess
2023-06-22 13:17 ` [PATCH 2/8] gdb: don't restart vfork parent while waiting for child to finish Andrew Burgess
2023-06-22 13:17 ` [PATCH 3/8] gdb: fix an issue with vfork in non-stop mode Andrew Burgess
2023-06-22 13:17 ` [PATCH 4/8] gdb, infrun: refactor part of `proceed` into separate function Andrew Burgess
2023-06-28  8:47   ` Aktemur, Tankut Baris
2023-07-04 15:24     ` Andrew Burgess
2023-06-22 13:17 ` [PATCH 5/8] gdb: don't resume vfork parent while child is still running Andrew Burgess
2023-06-22 13:17 ` [PATCH 6/8] gdb/testsuite: expand gdb.base/foll-vfork.exp Andrew Burgess
2023-06-22 13:17 ` [PATCH 7/8] gdb/testsuite: remove use of sleep from gdb.base/foll-vfork.exp Andrew Burgess
2023-06-22 13:17 ` [PATCH 8/8] gdb: additional debug output in infrun.c and linux-nat.c Andrew Burgess
2023-07-04 15:22 ` [PATCHv2 0/8] Some vfork related fixes Andrew Burgess
2023-07-04 15:22   ` [PATCHv2 1/8] gdb: catch more errors in gdb.base/foll-vfork.exp Andrew Burgess
2023-07-04 15:22   ` [PATCHv2 2/8] gdb: don't restart vfork parent while waiting for child to finish Andrew Burgess
2023-07-05 10:08     ` Aktemur, Tankut Baris
2023-07-04 15:22   ` [PATCHv2 3/8] gdb: fix an issue with vfork in non-stop mode Andrew Burgess
2023-07-04 15:22   ` [PATCHv2 4/8] gdb, infrun: refactor part of `proceed` into separate function Andrew Burgess
2023-07-04 15:22   ` [PATCHv2 5/8] gdb: don't resume vfork parent while child is still running Andrew Burgess
2023-07-18 20:42     ` Simon Marchi
2023-07-21  9:47       ` Andrew Burgess
2023-07-23  8:53       ` Andrew Burgess
2023-08-16 14:02         ` Andrew Burgess
2023-08-17  6:36           ` Tom de Vries
2023-08-17  7:01             ` Tom de Vries
2023-08-17  8:06               ` Tom de Vries
2023-08-17  8:22                 ` Tom de Vries
2023-07-04 15:22   ` [PATCHv2 6/8] gdb/testsuite: expand gdb.base/foll-vfork.exp Andrew Burgess
2023-07-05 11:22     ` Aktemur, Tankut Baris [this message]
2023-07-04 15:22   ` [PATCHv2 7/8] gdb/testsuite: remove use of sleep from gdb.base/foll-vfork.exp Andrew Burgess
2023-07-04 15:22   ` [PATCHv2 8/8] gdb: additional debug output in infrun.c and linux-nat.c Andrew Burgess
2023-07-05 11:30   ` [PATCHv2 0/8] Some vfork related fixes Aktemur, Tankut Baris
2023-07-17  8:53     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM4PR11MB730310CD9DFEE77C6BD9EFE1C42FA@DM4PR11MB7303.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).