* Re: [PATCH v2.5][DRAFT] Add test for target_set tapset.
[not found] <1540131125.403201245477347883.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com>
@ 2009-06-20 5:57 ` Josh Stone
2009-06-20 13:51 ` Przemysław Pawełczyk
0 siblings, 1 reply; 3+ messages in thread
From: Josh Stone @ 2009-06-20 5:57 UTC (permalink / raw)
To: Przemyslaw Pawelczyk; +Cc: systemtap
----- "Przemyslaw Pawelczyk" <przemyslaw@pawelczyk.it> wrote:
> +probe nd_syscall.nanosleep
> +{
> + if (target_set_pid(pid()) && @cast(req_uaddr, "timespec",
> "kernel<linux/time.h>")->tv_sec == $1)
> + target_set_report()
> +}
> +
> +%( arch == "x86_64" || arch == "ppc64" || arch == "ia64" %?
> +probe nd_syscall.compat_nanosleep
> +{
> + if (target_set_pid(pid()) && @cast(req_uaddr, "compat_timespec",
> "kernel<linux/compat.h>")->tv_sec == $1)
> + target_set_report()
> +}
> +%)
I just realized that this gets a LOT easier with the syscall tapset instead:
probe syscall.nanosleep, syscall.compat_nanosleep ?
{
if (target_set_pid(pid()) && $rqtp->tv_sec == $1)
target_set_report()
}
We generally assume that debuginfo is installed for running the testsuite, so let's not focus anymore on problems that aren't related to the thing we're trying to test...
Josh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2.5][DRAFT] Add test for target_set tapset.
2009-06-20 5:57 ` [PATCH v2.5][DRAFT] Add test for target_set tapset Josh Stone
@ 2009-06-20 13:51 ` Przemysław Pawełczyk
0 siblings, 0 replies; 3+ messages in thread
From: Przemysław Pawełczyk @ 2009-06-20 13:51 UTC (permalink / raw)
To: Josh Stone; +Cc: systemtap
On Sat, Jun 20, 2009 at 07:57, Josh Stone<jistone@redhat.com> wrote:
> ----- "Przemyslaw Pawelczyk" <przemyslaw@pawelczyk.it> wrote:
>> +probe nd_syscall.nanosleep
>> +{
>> + if (target_set_pid(pid()) && @cast(req_uaddr, "timespec",
>> "kernel<linux/time.h>")->tv_sec == $1)
>> + target_set_report()
>> +}
>> +
>> +%( arch == "x86_64" || arch == "ppc64" || arch == "ia64" %?
>> +probe nd_syscall.compat_nanosleep
>> +{
>> + if (target_set_pid(pid()) && @cast(req_uaddr, "compat_timespec",
>> "kernel<linux/compat.h>")->tv_sec == $1)
>> + target_set_report()
>> +}
>> +%)
>
> I just realized that this gets a LOT easier with the syscall tapset instead:
>
> probe syscall.nanosleep, syscall.compat_nanosleep ?
> {
> if (target_set_pid(pid()) && $rqtp->tv_sec == $1)
> target_set_report()
> }
Indeed. New patch is already sent.
> We generally assume that debuginfo is installed for running the testsuite, so let's not focus anymore on problems that aren't related to the thing we're trying to test...
Right. Thanks!
> Josh
Regards.
--
Przemysław Pawełczyk
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2.5][DRAFT] Add test for target_set tapset.
2009-06-13 23:46 [PATCH] Fix " Przemyslaw Pawelczyk
@ 2009-06-20 0:33 ` Przemyslaw Pawelczyk
0 siblings, 0 replies; 3+ messages in thread
From: Przemyslaw Pawelczyk @ 2009-06-20 0:33 UTC (permalink / raw)
To: systemtap
Requires: Support OR (using ||) in preprocessor's conditions.
---
testsuite/systemtap.base/target_set.exp | 67 +++++++++++++++++++++++++++++++
testsuite/systemtap.base/target_set.stp | 24 +++++++++++
2 files changed, 91 insertions(+), 0 deletions(-)
create mode 100644 testsuite/systemtap.base/target_set.exp
create mode 100644 testsuite/systemtap.base/target_set.stp
diff --git a/testsuite/systemtap.base/target_set.exp b/testsuite/systemtap.base/target_set.exp
new file mode 100644
index 0000000..998fd4a
--- /dev/null
+++ b/testsuite/systemtap.base/target_set.exp
@@ -0,0 +1,67 @@
+# Test for target_set tapset
+
+set test target_set
+
+if {![installtest_p]} { untested $test; continue }
+
+set file $srcdir/$subdir/target_set.stp
+set time 12345
+set stap_cmd "( ( /bin/sleep $time ) ; ( /bin/sleep $time ) ; ( /bin/sleep $time ) )"
+set stap_cmd_sleep_count 3
+set stap_cmd_child_level 3
+
+proc failtest {} {
+ global test
+ fail $test
+}
+
+proc expect_target_set_string {} {
+ expect {
+ "^target set:\r\n" { }
+ timeout { failtest; return -code return }
+ }
+}
+
+proc expect_target_set_pids generations {
+ global test
+ global stp_pid
+ for {set i 0} {$i < $generations} {incr i} {
+ expect {
+ -re {^([0-9]+) begat ([0-9]+)\r\n} { set pid_array($expect_out(1,string)) $expect_out(2,string) }
+ timeout { failtest; return -code return }
+ }
+ }
+ set pid_it $stp_pid
+ while {[info exists pid_array($pid_it)]} {
+ if {[exec pgrep -P $pid_it] != $pid_array($pid_it)} {
+ failtest; return -code return
+ }
+ set pid_it $pid_array($pid_it)
+ }
+ if {$generations > 1} {
+ exec kill -INT $pid_it
+ }
+}
+
+spawn stap $file $time -c "$stap_cmd"
+
+expect {
+ -re {^(\d+)\r\n} { set stp_pid $expect_out(1,string) }
+ timeout { failtest; return }
+}
+
+expect_target_set_pids 1
+for {set i 0} {$i < $stap_cmd_sleep_count} {incr i} {
+ expect_target_set_string
+ expect_target_set_pids $stap_cmd_child_level
+}
+expect_target_set_string
+expect_target_set_pids 0
+
+expect {
+ eof {}
+ timeout { failtest; return }
+}
+
+wait
+pass $test
diff --git a/testsuite/systemtap.base/target_set.stp b/testsuite/systemtap.base/target_set.stp
new file mode 100644
index 0000000..4d87114
--- /dev/null
+++ b/testsuite/systemtap.base/target_set.stp
@@ -0,0 +1,24 @@
+probe begin
+{
+ stp_pid = stp_pid()
+ printf("%d\n%d begat %d\n", stp_pid, stp_pid, target())
+}
+
+probe nd_syscall.nanosleep
+{
+ if (target_set_pid(pid()) && @cast(req_uaddr, "timespec", "kernel<linux/time.h>")->tv_sec == $1)
+ target_set_report()
+}
+
+%( arch == "x86_64" || arch == "ppc64" || arch == "ia64" %?
+probe nd_syscall.compat_nanosleep
+{
+ if (target_set_pid(pid()) && @cast(req_uaddr, "compat_timespec", "kernel<linux/compat.h>")->tv_sec == $1)
+ target_set_report()
+}
+%)
+
+probe end
+{
+ target_set_report()
+}
--
1.5.6.5
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-20 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1540131125.403201245477347883.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com>
2009-06-20 5:57 ` [PATCH v2.5][DRAFT] Add test for target_set tapset Josh Stone
2009-06-20 13:51 ` Przemysław Pawełczyk
2009-06-13 23:46 [PATCH] Fix " Przemyslaw Pawelczyk
2009-06-20 0:33 ` [PATCH v2.5][DRAFT] Add test for " Przemyslaw Pawelczyk
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).