public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Przemysław Pawełczyk" <przemyslaw@pawelczyk.it>
To: Josh Stone <jistone@redhat.com>
Cc: systemtap@sourceware.org
Subject: Re: [PATCH 2/2] Add test for target_set tapset.
Date: Fri, 19 Jun 2009 21:26:00 -0000	[thread overview]
Message-ID: <40e92d5b0906191426x386bb7e9t79297596ba438789@mail.gmail.com> (raw)
In-Reply-To: <4A3AF02A.4070008@redhat.com>

On Fri, Jun 19, 2009 at 03:55, Josh Stone<jistone@redhat.com> wrote:
> On 06/18/2009 03:33 PM, Przemyslaw Pawelczyk wrote:
>> +proc abort {} {
>> +     global test
>> +     fail $test
>> +     exit
>> +}
>
> exit should not be used, because that will stop the entire testing
> session.  We don't want failure here to prevent other tests from running.

At the time I was unaware of this.

>> +     set pid_it $stp_pid
>> +     while {[info exists pid_array($pid_it)]} {
>> +             if {[exec pgrep -P $pid_it] != $pid_array($pid_it)} {
>> +                     abort
>> +             }
>> +             set pid_it $pid_array($pid_it)
>> +     }
>
> There's a race here that the sleep process might finish before pgrep
> sees it.  Most of the time, one second will probably be plenty of time,
> but on a slow and/or loaded system we could have false failures.
>
> What if you just used an absurdly long timeout for sleep, and then "kill
> -INT" it after you've verified the chain?

Great idea. Thanks.

>> +probe nd_syscall.nanosleep
>> +{
>> +     if (target_set_pid(pid()) && @cast(req_uaddr, "timespec", "<linux/time.h>")->tv_sec == $1)
>> +             target_set_report()
>> +}
>
> Some systems have a 32-bit userspace with a 64-bit kernel, and in that
> case you would need to catch nd_syscall.compat_nanosleep as well.

Ok.

> I feel like you're going through somewhat heroic efforts to validate
> this in tcl, and you're not able to use any of the common infrastructure
> we have for other tests.  Maybe it would easier to check results within
> the script?  We couldn't check the report() that way, but
> target_set_pid() is what we really care about anyway, right?
>
> I'm imagining that in the nanosleep probe, you could recursively walk up
> task_parent() until you hit stp_pid() or 1 (init).  Then as the
> recursion unwinds, make sure that target_set_pid() matches.  You can use
> system() to also launch a sleep that's outside of the target_set.  Does
> that make sense?

IMO tested systemtap script should do as little as possible and the
testing is duty of the tester, here: expect/tcl script. Easiness of
implementing tester is secondary thing.

I'll send v2 of the patch right away.

> Josh

Regards.

-- 
Przemysław Pawełczyk

  reply	other threads:[~2009-06-19 21:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 23:46 [PATCH] Fix " Przemyslaw Pawelczyk
2009-06-15 19:11 ` Josh Stone
2009-06-16 23:13   ` Przemysław Pawełczyk
2009-06-17  1:19     ` Josh Stone
2009-06-17 19:02       ` Frank Ch. Eigler
2009-06-17 19:05       ` Przemysław Pawełczyk
2009-06-17 21:47         ` Josh Stone
2009-06-18 22:58 ` [PATCH 1/2] " Przemyslaw Pawelczyk
2009-06-19  1:01   ` Josh Stone
     [not found]     ` <076001c9f07e$e4a73a40$adf5aec0$@ac.cn>
     [not found]       ` <4A3AF41B.7090804@redhat.com>
2009-07-09  1:04         ` how to get one process's resource usage by systemtap tgh
2009-06-18 22:58 ` [PATCH 2/2] Add test for target_set tapset Przemyslaw Pawelczyk
2009-06-19  1:56   ` Josh Stone
2009-06-19 21:26     ` Przemysław Pawełczyk [this message]
2009-06-19 21:27 ` [PATCH v2] " Przemyslaw Pawelczyk
2009-06-20  1:00   ` Przemysław Pawełczyk
2009-06-20  0:33 ` [PATCH v2.5][DRAFT] " Przemyslaw Pawelczyk
2009-06-20 13:43 ` [PATCH v3] " Przemyslaw Pawelczyk
2009-06-22 21:06   ` Josh Stone

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=40e92d5b0906191426x386bb7e9t79297596ba438789@mail.gmail.com \
    --to=przemyslaw@pawelczyk.it \
    --cc=jistone@redhat.com \
    --cc=systemtap@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).