Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/8] foll-vfork.exp: Use with_test_prefix.
Date: Thu, 25 Oct 2012 17:42:00 -0000	[thread overview]
Message-ID: <20121025174226.13324.29918.stgit@brno.lan> (raw)
In-Reply-To: <20121025174002.13324.8164.stgit@brno.lan>

Looking at a FAIL in this test (caused by some other changes I was
working on), I had some trouble matching the gdb.sum output with the
test's code.  The gdb.sum output currently looks like:

 PASS: gdb.base/foll-vfork.exp: set verbose
 PASS: gdb.base/foll-vfork.exp: insert first vfork catchpoint
 PASS: gdb.base/foll-vfork.exp: continue to first vfork catchpoint
 PASS: gdb.base/foll-vfork.exp: set follow-fork parent, vfork through step
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, through step
 PASS: gdb.base/foll-vfork.exp: set follow-fork parent, vfork to bp
 PASS: gdb.base/foll-vfork.exp: break, vfork to bp
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, to bp
 PASS: gdb.base/foll-vfork.exp: set follow-fork child, vfork and exec to main bp
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, to main bp
 PASS: gdb.base/foll-vfork.exp: set follow-fork child, vfork and exec through step
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, through step
 PASS: gdb.base/foll-vfork.exp: set follow-fork parent, tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, set tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, finish after tcatch vfork
 PASS: gdb.base/foll-vfork.exp: set follow-fork child, tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork child follow, set tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork child follow, tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork (followed exec)

This patch changes the tests to use with_test_prefix instead of
hardcoding a prefix in gdb_test/gdb_test_multiple (and being
inconsistent).  We now get:

 PASS: gdb.base/foll-vfork.exp: set verbose
 PASS: gdb.base/foll-vfork.exp: insert first vfork catchpoint
 PASS: gdb.base/foll-vfork.exp: continue to first vfork catchpoint
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, through step: set follow-fork parent
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, through step: step
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, to bp: set follow-fork parent
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, to bp: break, vfork to bp
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, to bp: continue to bp
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, to main bp: set follow-fork child
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, to main bp: continue to bp
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, through step: set follow-fork child
 PASS: gdb.base/foll-vfork.exp: vfork and exec child follow, through step: step over vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, finish after tcatch vfork: set follow-fork parent
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, finish after tcatch vfork: tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, finish after tcatch vfork: continue to vfork
 PASS: gdb.base/foll-vfork.exp: vfork parent follow, finish after tcatch vfork: finish
 PASS: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork: set follow-fork child
 PASS: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork: tcatch vfork
 PASS: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork: continue to vfork
 PASS: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork: finish (followed exec)

Split off to a separate patch because this is the first change in the
series that actually changes gdb.sum output.

gdb/testsuite/
2012-10-25  Pedro Alves  <palves@redhat.com>

	* gdb.base/foll-vfork.exp (vfork_parent_follow_through_step)
	(vfork_parent_follow_to_bp)
	(vfork_and_exec_child_follow_to_main_bp)
	(vfork_and_exec_child_follow_through_step)
	(tcatch_vfork_then_parent_follow)
	(tcatch_vfork_then_parent_follow, tcatch_vfork_then_child_follow):
	Use with_test_prefix.
---
 gdb/testsuite/gdb.base/foll-vfork.exp |   66 +++++++++++++++------------------
 1 file changed, 29 insertions(+), 37 deletions(-)

diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 54f5971..f978f8c 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -84,15 +84,15 @@ proc check_vfork_catchpoints {} {
 }
 
 proc vfork_parent_follow_through_step {} {
+  with_test_prefix "vfork parent follow, through step" {
    global gdb_prompt
 
-   gdb_test_no_output "set follow-fork parent" \
-       "set follow-fork parent, vfork through step"
+   gdb_test_no_output "set follow-fork parent"
 
-   set test "vfork parent follow, through step"
+   set test "step"
    gdb_test_multiple "next" $test {
        -re "Detaching after fork from.*if \\(pid == 0\\).*$gdb_prompt " {
-	   pass "vfork parent follow, through step"
+	   pass $test
        }
    }
    # The child has been detached; allow time for any output it might
@@ -100,19 +100,19 @@ proc vfork_parent_follow_through_step {} {
    # any gdb_expected debugger output from a subsequent testpoint.
    #
    exec sleep 1
-}
+}}
 
 proc vfork_parent_follow_to_bp {} {
+  with_test_prefix "vfork parent follow, to bp" {
    global gdb_prompt
    global srcfile
 
-   gdb_test_no_output "set follow-fork parent" \
-       "set follow-fork parent, vfork to bp"
+   gdb_test_no_output "set follow-fork parent"
 
    set bp_location [gdb_get_line_number "printf (\"I'm the proud parent of child"]
    gdb_test "break ${srcfile}:${bp_location}" ".*" "break, vfork to bp"
 
-   set test "vfork parent follow, to bp"
+   set test "continue to bp"
    gdb_test_multiple "continue" $test {
        -re ".*Detaching after fork from child process.*Breakpoint.*${bp_location}.*$gdb_prompt " {
 	   pass $test
@@ -123,7 +123,7 @@ proc vfork_parent_follow_to_bp {} {
    # any expected debugger output from a subsequent testpoint.
    #
    exec sleep 1
-}
+}}
 
 # Kill child and reload symbols.
 proc kill_child {} {
@@ -153,16 +153,15 @@ proc kill_child {} {
 }
 
 proc vfork_and_exec_child_follow_to_main_bp {} {
+  with_test_prefix "vfork and exec child follow, to main bp" {
    global gdb_prompt
    global srcfile2
 
-   gdb_test_no_output \
-       "set follow-fork child" \
-       "set follow-fork child, vfork and exec to main bp"
+   gdb_test_no_output "set follow-fork child"
 
    set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
 
-   set test "vfork and exec child follow, to main bp"
+   set test "continue to bp"
    gdb_test_multiple "continue" $test {
       -re "Attaching after.* vfork to.*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " {
 	  pass $test
@@ -177,9 +176,10 @@ proc vfork_and_exec_child_follow_to_main_bp {} {
    # Explicitly kill this child, or a subsequent rerun actually runs
    # the exec'd child, not the original program...
    kill_child
-}
+}}
 
 proc vfork_and_exec_child_follow_through_step {} {
+  with_test_prefix "vfork and exec child follow, through step" {
    global gdb_prompt
    global srcfile2
 
@@ -197,11 +197,9 @@ proc vfork_and_exec_child_follow_through_step {} {
       return 0
    }
 
-   gdb_test_no_output \
-       "set follow-fork child" \
-       "set follow-fork child, vfork and exec through step"
+   gdb_test_no_output "set follow-fork child"
 
-   set test "vfork and exec child follow, through step"
+   set test "step over vfork"
    if { [istarget "hppa*-*-hpux*"]} {
        # Since the child cannot be debugged until after it has exec'd,
        # and since there's a bp on "main" in the parent, and since the
@@ -234,23 +232,20 @@ proc vfork_and_exec_child_follow_through_step {} {
    # Explicitly kill this child, or a subsequent rerun actually runs
    # the exec'd child, not the original program...
    kill_child
-}
+}}
 
 proc tcatch_vfork_then_parent_follow {} {
+  with_test_prefix "vfork parent follow, finish after tcatch vfork" {
    global gdb_prompt
    global srcfile
 
-   gdb_test_no_output \
-       "set follow-fork parent" \
-       "set follow-fork parent, tcatch vfork"
+   gdb_test_no_output "set follow-fork parent"
 
-   gdb_test "tcatch vfork" \
-       "Catchpoint .*(vfork).*" \
-       "vfork parent follow, set tcatch vfork"
+   gdb_test "tcatch vfork" "Catchpoint .*(vfork).*"
 
    # HP-UX 10.20 seems to stop you in "vfork", while more recent
    # HP-UXs stop you in "_vfork".
-   set test "vfork parent follow, tcatch vfork"
+   set test "continue to vfork"
    gdb_test_multiple "continue" $test {
       -re "0x\[0-9a-fA-F\]*.*(vfork|__kernel_v?syscall).*$gdb_prompt " {
 	  pass $test
@@ -261,7 +256,7 @@ proc tcatch_vfork_then_parent_follow {} {
    }
 
    set linenum [gdb_get_line_number "pid = vfork ();"]
-   set test "vfork parent follow, finish after tcatch vfork"
+   set test "finish"
    gdb_test_multiple "finish" $test {
       -re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:${linenum}.*$gdb_prompt " {
 	  pass $test
@@ -276,24 +271,21 @@ proc tcatch_vfork_then_parent_follow {} {
    # any expected debugger output from a subsequent testpoint.
    #
    exec sleep 1
-}
+}}
 
 proc tcatch_vfork_then_child_follow {} {
+  with_test_prefix "vfork child follow, finish after tcatch vfork" {
    global gdb_prompt
    global srcfile
    global srcfile2
 
-   gdb_test_no_output \
-       "set follow-fork child" \
-       "set follow-fork child, tcatch vfork"
+   gdb_test_no_output "set follow-fork child"
 
-   gdb_test "tcatch vfork" \
-       "Catchpoint .*(vfork).*" \
-       "vfork child follow, set tcatch vfork"
+   gdb_test "tcatch vfork" "Catchpoint .*(vfork).*"
 
    # HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
    # stop you in "_vfork".
-   set test "vfork child follow, tcatch vfork"
+   set test "continue to vfork"
    gdb_test_multiple "continue" $test {
       -re "vfork \\(\\) at .*$gdb_prompt $" {
 	  pass $test
@@ -306,7 +298,7 @@ proc tcatch_vfork_then_child_follow {} {
    set linenum1 [gdb_get_line_number "pid = vfork ();"]
    set linenum2 [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
 
-   set test "vfork child follow, finish after tcatch vfork"
+   set test "finish"
    gdb_test_multiple "finish" $test {
       -re "Run till exit from.*vfork.*${srcfile}:${linenum1}.*$gdb_prompt " {
 	  pass $test
@@ -324,7 +316,7 @@ proc tcatch_vfork_then_child_follow {} {
    # any expected debugger output from a subsequent testpoint.
    #
    exec sleep 1
-}
+}}
 
 proc do_vfork_and_exec_tests {} {
    global gdb_prompt


  parent reply	other threads:[~2012-10-25 17:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 17:42 [PATCH 0/8] Fix PR gdb/14766; cleanup foll-vfork.exp and extend it Pedro Alves
2012-10-25 17:42 ` [PATCH 6/8] foll-vfork.exp: Clean restart gdb before each test procedure Pedro Alves
2012-11-02 18:18   ` Pedro Alves
2012-10-25 17:42 ` [PATCH 2/8] foll-vfork.exp: Don't hard code line numbers Pedro Alves
2012-10-25 17:42 ` [PATCH 7/8] foll-vfork.exp: Also test following vfork when the child exits Pedro Alves
2012-10-25 17:42 ` [PATCH 8/8] Fix PR gdb/14766 - vfork child exit with "set follow-fork-mode child" broken Pedro Alves
2012-10-25 17:49   ` Pedro Alves
2012-10-25 17:42 ` Pedro Alves [this message]
2012-10-25 17:42 ` [PATCH 3/8] foll-vfork.exp: Expose more testing on non-HP/UX targets Pedro Alves
2012-10-25 17:42 ` [PATCH 4/8] foll-vfork.c/vforked-prog.c: Add copyright headers Pedro Alves
2012-10-25 17:42 ` [PATCH 1/8] foll-vfork.exp: Modernize Pedro Alves
2012-10-30 20:50 ` [PATCH 0/8] Fix PR gdb/14766; cleanup foll-vfork.exp and extend it Tom Tromey
2012-11-02 18:15   ` Pedro Alves

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=20121025174226.13324.29918.stgit@brno.lan \
    --to=palves@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