From: Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it>
To: systemtap@sourceware.org
Subject: [PATCH 2/2] Add test for target_set tapset.
Date: Thu, 18 Jun 2009 22:58:00 -0000 [thread overview]
Message-ID: <1245365912.847583.942@debian> (raw)
In-Reply-To: <1244936781.212635.16785@debian>
---
testsuite/systemtap.base/target_set.exp | 63 +++++++++++++++++++++++++++++++
testsuite/systemtap.base/target_set.stp | 16 ++++++++
2 files changed, 79 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..1b80839
--- /dev/null
+++ b/testsuite/systemtap.base/target_set.exp
@@ -0,0 +1,63 @@
+# Test for target_set tapset
+
+set test target_set
+
+if {![installtest_p]} { untested $test; continue }
+
+set file $srcdir/$subdir/target_set.stp
+set time 1
+set stap_cmd "( ( /bin/sleep $time ) && ( /bin/sleep $time ) )"
+set stap_cmd_child_level 3
+
+proc abort {} {
+ global test
+ fail $test
+ exit
+}
+
+proc expect_target_set generations {
+ expect {
+ "^target set:\r\n" { expect_target_set_pids $generations }
+ timeout { abort }
+ }
+}
+
+proc expect_target_set_pids generations {
+ global test
+ global stp_pid
+ for {set i 0} {$i < $generations} {incr i} {
+ expect {
+ -timeout 0
+ -re {^([0-9]+) begat ([0-9]+)\r\n} { set pid_array($expect_out(1,string)) $expect_out(2,string) }
+ timeout { abort }
+ }
+ }
+ 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)
+ }
+}
+
+spawn stap $file $time -c "$stap_cmd"
+
+expect {
+ -re {^(\d+)\r\n} { set stp_pid $expect_out(1,string) }
+ timeout { abort }
+}
+
+set timeout [expr $time + 1]
+
+expect_target_set_pids 1
+expect_target_set $stap_cmd_child_level
+expect_target_set $stap_cmd_child_level
+expect_target_set 0
+
+expect {
+ eof {}
+ timeout { abort }
+}
+
+pass $test
diff --git a/testsuite/systemtap.base/target_set.stp b/testsuite/systemtap.base/target_set.stp
new file mode 100644
index 0000000..c48040b
--- /dev/null
+++ b/testsuite/systemtap.base/target_set.stp
@@ -0,0 +1,16 @@
+probe begin
+{
+ println(stp_pid())
+ printf("%d begat %d\n", stp_pid(), target())
+}
+
+probe nd_syscall.nanosleep
+{
+ if (target_set_pid(pid()) && @cast(req_uaddr, "timespec", "<linux/time.h>")->tv_sec == $1)
+ target_set_report()
+}
+
+probe end
+{
+ target_set_report()
+}
--
1.5.6.5
next prev parent reply other threads:[~2009-06-18 22:58 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 ` Przemyslaw Pawelczyk [this message]
2009-06-19 1:56 ` [PATCH 2/2] Add test for target_set tapset Josh Stone
2009-06-19 21:26 ` Przemysław Pawełczyk
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=1245365912.847583.942@debian \
--to=przemyslaw@pawelczyk.it \
--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).