diff options
author | Dave Brolley <brolley@redhat.com> | 2009-06-23 11:07:15 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-06-23 11:07:15 -0400 |
commit | f75b6811dee35832309e55a9e3455c40d4c13437 (patch) | |
tree | a4b0c9bab84c84c863b99bb993fcbb7f5c19b339 /testsuite | |
parent | d6454850dd3c9d74b700924b56378c4c9ab9fa57 (diff) | |
parent | e89118955d1e9f6f442e9c0f2e918ce9bf9a8529 (diff) | |
download | systemtap-steved-f75b6811dee35832309e55a9e3455c40d4c13437.tar.gz systemtap-steved-f75b6811dee35832309e55a9e3455c40d4c13437.tar.xz systemtap-steved-f75b6811dee35832309e55a9e3455c40d4c13437.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.base/target_set.exp | 68 | ||||
-rw-r--r-- | testsuite/systemtap.base/target_set.stp | 16 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/forktracker.meta | 2 | ||||
-rw-r--r-- | testsuite/systemtap.string/str_replace.exp | 14 | ||||
-rw-r--r-- | testsuite/systemtap.string/str_replace.stp | 25 |
5 files changed, 124 insertions, 1 deletions
diff --git a/testsuite/systemtap.base/target_set.exp b/testsuite/systemtap.base/target_set.exp new file mode 100644 index 00000000..4b6e0a5d --- /dev/null +++ b/testsuite/systemtap.base/target_set.exp @@ -0,0 +1,68 @@ +# 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 { + -timeout 180 + -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 00000000..002ba897 --- /dev/null +++ b/testsuite/systemtap.base/target_set.stp @@ -0,0 +1,16 @@ +probe begin +{ + stp_pid = stp_pid() + printf("%d\n%d begat %d\n", stp_pid, stp_pid, target()) +} + +probe syscall.nanosleep, syscall.compat_nanosleep ? +{ + if (target_set_pid(pid()) && $rqtp->tv_sec == $1) + target_set_report() +} + +probe end +{ + target_set_report() +} diff --git a/testsuite/systemtap.examples/process/forktracker.meta b/testsuite/systemtap.examples/process/forktracker.meta index f3ef3709..87d43d7a 100644 --- a/testsuite/systemtap.examples/process/forktracker.meta +++ b/testsuite/systemtap.examples/process/forktracker.meta @@ -10,4 +10,4 @@ output: trace scope: system-wide description: The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes. test_check: stap -p4 forktracker.stp -test_installcheck: stap forkracker.stp -c "sleep 1" +test_installcheck: stap forktracker.stp -c "sleep 1" diff --git a/testsuite/systemtap.string/str_replace.exp b/testsuite/systemtap.string/str_replace.exp new file mode 100644 index 00000000..4eedf1c6 --- /dev/null +++ b/testsuite/systemtap.string/str_replace.exp @@ -0,0 +1,14 @@ +set test "str_replace" + +set ::result_string {Result = hello pointer tap +Result = pointer system tap +Result = hello system pointer +Result = Here I am, on the bored again. there I am, up on the stage, Here I go, playing star again. There I go, turn the page.- Bob Sege +Result = here I am, on the road again. there I am, up on the stage, here I go, playing star again. There I go, turn the page.- Bob Seger +Result = Here I am, on the road again. there I am, up on the stage, Here I go, playing star again. There I go, turn the page.- Metallica +Result = hello tap +Result = hello system tap +Result = +Result = } +stap_run2 $srcdir/$subdir/$test.stp + diff --git a/testsuite/systemtap.string/str_replace.stp b/testsuite/systemtap.string/str_replace.stp new file mode 100644 index 00000000..87e09353 --- /dev/null +++ b/testsuite/systemtap.string/str_replace.stp @@ -0,0 +1,25 @@ +# Test of str_replace() + +global long_str1 = "hello system tap" +global long_str2 = "Here I am, on the road again. there I am, up on the stage, Here I go, playing star again. There I go, turn the page.- Bob Seger" +global long_src_str1 = "system" +global long_src_str2 = "hello" +global long_src_str3 = "tap" +global long_rlpc_str = "pointer" + +probe begin { + printf("Result = %s\n",str_replace(long_str1, long_src_str1, long_rlpc_str)) + printf("Result = %s\n",str_replace(long_str1, long_src_str2, long_rlpc_str)) + printf("Result = %s\n",str_replace(long_str1, long_src_str3, long_rlpc_str)) + + printf("Result = %s\n",str_replace(long_str2, "road", "bored")) + printf("Result = %s\n",str_replace(long_str2, "Here", "here")) + printf("Result = %s\n",str_replace(long_str2, "Bob Seger", "Metallica")) + printf("Result = %s\n",str_replace(long_str1, long_src_str1, "\0")) + printf("Result = %s\n",str_replace(long_str1, "\0", long_rlpc_str)) + printf("Result = %s\n",str_replace("\0", "\0", long_rlpc_str)) + printf("Result = %s\n",str_replace("\0", "\0", "\0")) +} +probe begin { + exit() +} |