public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Breazeal, Don" <donb@codesourcery.com>,
	lgustavo@codesourcery.com,        gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix for follow-fork: followed child doesn't stop
Date: Fri, 06 Jun 2014 11:34:00 -0000	[thread overview]
Message-ID: <5391A73A.6000107@redhat.com> (raw)
In-Reply-To: <5390E4D1.2050108@codesourcery.com>

On 06/05/2014 10:44 PM, Breazeal, Don wrote:
> +proc test_follow_fork { who detach cmd } {
>      global gdb_prompt
> +    global srcfile
> +    global testfile
> 
> -    gdb_test "show follow-fork" \
> -	"Debugger response to a program call of fork or vfork is \"parent\".*" \
> -	"default show parent follow, no catchpoints"
> +    set test_name "follow $who, detach $detach, command \"$cmd\""


Instead of explicitly prepending "$test_name: " to tests,
please use with_test_prefix to make test messages unique.
Below, runto_main, the untested line, this "set verbose", all
these look like they'll print the same message in gdb.sum.

> 
> -    gdb_test "next 2" \
> -	"Detaching after fork from.*" \
> -	"default parent follow, no catchpoints"
> +    # Start a new debugger session each time so defaults are legitimate.
> +    clean_restart $testfile
> 
> -    # The child has been detached; allow time for any output it might
> -    # generate to arrive, so that output doesn't get confused with
> -    # any expected debugger output from a subsequent testpoint.
> -    #
> -    exec sleep 1
> -}
> +    if ![runto_main] {
> +	untested "could not run to main"
> +	return -1
> +    }
> 
> -proc explicit_fork_parent_follow {} {
> -    global gdb_prompt
> +    # The "Detaching..." and "Attaching..." messages may be hidden by
> +    # default.
> +    gdb_test_no_output "set verbose"



> +    # Set up the output we expect to see after we run.
> +    set expected_re ""
> +    if {$who == "child"} {
> +        set expected_re "Attaching after.* fork to.*set breakpoint here.*"
> +    } elseif {$who == "parent" && $detach == "on"} {
> +	set expected_re "Detaching after fork from .*set breakpoint here.*"

Something odd with indentation here.

> +    } else {
> +        set expected_re ".*set breakpoint here.*"
> +    }



> +    # The first two tests should be sufficient to test the defaults.
> +    # There is no need to test using the defaults in other permutations
> +    # (e.g. "default" "on", "parent" "default", etc.).
> +    set cases [list [list "default" "default" "next 2"]   \
> +                    [list "default" "default" "continue"] \
> +                    [list "parent"  "on"      "next 2"]   \
> +                    [list "parent"  "on"      "continue"] \
> +                    [list "child"   "on"      "next 2"]   \
> +                    [list "child"   "on"      "continue"] \
> +                    [list "parent"  "off"     "next 2"]   \
> +                    [list "parent"  "off"     "continue"] \
> +                    [list "child"   "off"     "next 2"]   \
> +                    [list "child"   "off"     "continue"]]
> +    foreach args $cases {
> +        test_follow_fork [lindex $args 0] [lindex $args 1] [lindex $args 2]
> +    }

This is still quite manual.  Please write:

    foreach cmd {"next 2" "continue"} {
      test_follow_fork "default" "default" $cmd
    }

    # Now test all explicit permutations.
    foreach who {"parent" "child"} {
      foreach detach {"on" "off"} {
	foreach cmd {"next 2" "continue"} {
	  test_follow_fork $who $detach $cmd
        }
      }
    }

-- 
Pedro Alves


-- 
Pedro Alves

  reply	other threads:[~2014-06-06 11:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 22:19 Don Breazeal
2014-06-05 12:52 ` Pedro Alves
2014-06-05 18:34   ` Breazeal, Don
2014-06-06 11:12     ` Pedro Alves
2014-06-06 11:42       ` Pedro Alves
2014-06-05 13:14 ` Luis Machado
2014-06-05 21:45   ` Breazeal, Don
2014-06-06 11:34     ` Pedro Alves [this message]
2014-06-13  1:07       ` Breazeal, Don
2014-06-16 13:19         ` Pedro Alves
2014-06-06 12:27     ` Luis Machado

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=5391A73A.6000107@redhat.com \
    --to=palves@redhat.com \
    --cc=donb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /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).