diff options
author | Dave Brolley <brolley@redhat.com> | 2009-04-30 11:45:09 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-04-30 11:45:09 -0400 |
commit | b03d329d5ad9d22d684b61859971a7b12b5e5104 (patch) | |
tree | c32105776a6c009ed96f5c1a2205849f8cda647d /testsuite | |
parent | 4c797c5eaeb10d8d22501c5ad82766b69d8cf988 (diff) | |
parent | 3ba2eb82cafa938c1c3f7ef9d2da06912a49d8e0 (diff) | |
download | systemtap-steved-b03d329d5ad9d22d684b61859971a7b12b5e5104.tar.gz systemtap-steved-b03d329d5ad9d22d684b61859971a7b12b5e5104.tar.xz systemtap-steved-b03d329d5ad9d22d684b61859971a7b12b5e5104.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite')
26 files changed, 98 insertions, 67 deletions
diff --git a/testsuite/buildok/maxactive01.stp b/testsuite/buildok/maxactive01.stp index afdb2cea..1cf893ef 100755 --- a/testsuite/buildok/maxactive01.stp +++ b/testsuite/buildok/maxactive01.stp @@ -1,6 +1,6 @@ #! stap -p4 -probe kernel.function("sys_read").return.maxactive(3) +probe kernel.function("vfs_read").return.maxactive(3) { printf("."); } diff --git a/testsuite/buildok/thirteen.stp b/testsuite/buildok/thirteen.stp index 4dffc4b9..32228e79 100755 --- a/testsuite/buildok/thirteen.stp +++ b/testsuite/buildok/thirteen.stp @@ -1,6 +1,6 @@ #! stap -p4 -probe kernel.function("sys_read") +probe kernel.function("vfs_read") { printf ("count=%d\n", $count) } diff --git a/testsuite/semko/forty.stp b/testsuite/semko/forty.stp index f7721a47..b7d1d139 100755 --- a/testsuite/semko/forty.stp +++ b/testsuite/semko/forty.stp @@ -1,4 +1,4 @@ #! stap -p2 global x -probe kernel.function("sys_open") if (x = 1) { } # bad side-effect +probe kernel.function("do_sys_open") if (x = 1) { } # bad side-effect diff --git a/testsuite/semko/fortyone.stp b/testsuite/semko/fortyone.stp index e9b986df..d3ba6205 100755 --- a/testsuite/semko/fortyone.stp +++ b/testsuite/semko/fortyone.stp @@ -1,3 +1,3 @@ #! stap -p2 -probe kernel.function("sys_open") if (x > 1) { } # not a global +probe kernel.function("vfs_read") if (x > 1) { } # not a global diff --git a/testsuite/semko/fortytwo.stp b/testsuite/semko/fortytwo.stp index 17dacb1c..09a04ea7 100755 --- a/testsuite/semko/fortytwo.stp +++ b/testsuite/semko/fortytwo.stp @@ -1,6 +1,6 @@ #! stap -p2 -probe kernel.function("sys_open") if (foo(2)) { } # must not call functions +probe kernel.function("vfs_read") if (foo(2)) { } # must not call functions function foo(x) { return x } diff --git a/testsuite/semko/maxactive04.stp b/testsuite/semko/maxactive04.stp index 9471fd21..25d63ef4 100755 --- a/testsuite/semko/maxactive04.stp +++ b/testsuite/semko/maxactive04.stp @@ -1,5 +1,5 @@ #! stap -p2 -probe kernel.function("sys_open").return.maxactive(-4) +probe kernel.function("vfs_read").return.maxactive(-4) { } diff --git a/testsuite/semko/maxactive05.stp b/testsuite/semko/maxactive05.stp index bdc8a101..3833ab6c 100755 --- a/testsuite/semko/maxactive05.stp +++ b/testsuite/semko/maxactive05.stp @@ -1,5 +1,5 @@ #! stap -p2 -probe kernel.function("sys_open").return.maxactive(99999999) +probe kernel.function("vfs_read").return.maxactive(99999999) { } diff --git a/testsuite/semko/return02.stp b/testsuite/semko/return02.stp index db4cd8c7..3d64f5dc 100755 --- a/testsuite/semko/return02.stp +++ b/testsuite/semko/return02.stp @@ -1,6 +1,6 @@ #! stap -p2 -probe kernel.function("sys_read") +probe kernel.function("vfs_read") { # this should fail - using $return not in a '.return' probe printf("in sys_read - return = %d\n", $return) diff --git a/testsuite/semko/thirtyfour.stp b/testsuite/semko/thirtyfour.stp index 515fcfbb..dca63722 100755 --- a/testsuite/semko/thirtyfour.stp +++ b/testsuite/semko/thirtyfour.stp @@ -2,9 +2,9 @@ # can't write to target variables in .return probes -probe kernel.function("sys_read").return +probe kernel.function("fget_light").return { $fd = 0 printf("fd is %d\n", $fd) } -probe kernel.function("sys_open").return { $filename } +probe kernel.function("do_sys_open").return { $filename } diff --git a/testsuite/semko/twentytwo.stp b/testsuite/semko/twentytwo.stp index 9321d5f6..ef04cd30 100755 --- a/testsuite/semko/twentytwo.stp +++ b/testsuite/semko/twentytwo.stp @@ -3,6 +3,6 @@ # tests that a non-inline function is *not* matched using # the inline() pattern -probe kernel.function("sys_recv").inline { +probe kernel.function("vfs_read").inline { log ("found a non-inline via inline()") } diff --git a/testsuite/semok/thirtytwo.stp b/testsuite/semok/thirtytwo.stp index 2a69b8cd..0f0334a1 100755 --- a/testsuite/semok/thirtytwo.stp +++ b/testsuite/semok/thirtytwo.stp @@ -2,4 +2,4 @@ # PR 6836 -probe kernel.function("sys_open").return { log($$return . $$parms) } +probe kernel.function("do_sys_open").return { log($$return . $$parms) } diff --git a/testsuite/semok/twentynine.stp b/testsuite/semok/twentynine.stp index 05e591ce..4b2e5056 100755 --- a/testsuite/semok/twentynine.stp +++ b/testsuite/semok/twentynine.stp @@ -5,7 +5,7 @@ function dummy:long () {return p;} # alias with a condition probe alias0 = begin if (3) {p=1} # alias with a kernel-variable condition -- not valid -probe alias1 = kernel.function("sys_read").return if (0) { if ($return) {p=0} } +probe alias1 = kernel.function("vfs_read").return if (0) { if ($return) {p=0} } # alias with a function-call condition probe blias0 = timer.s(1) if (1 /* dummy() */) {p=10} diff --git a/testsuite/systemtap.base/alternatives.exp b/testsuite/systemtap.base/alternatives.exp index deaf3bf8..fb263d7a 100644 --- a/testsuite/systemtap.base/alternatives.exp +++ b/testsuite/systemtap.base/alternatives.exp @@ -14,11 +14,11 @@ # listed, but that some alternatives are listed. set local1_script { - probe kernel.function("sys_getrlimit") { x = $z; } + probe kernel.funtion("vfs_write") { ret = $z; } } set struct1_script { - probe kernel.function("sys_getrlimit") { rlim_cur = $rlim->rlim_cud; } + probe kernel.function("vfs_write") { f_pos = $file->f_po; } } proc stap_run_alternatives {args} { @@ -38,8 +38,8 @@ proc stap_run_alternatives {args} { set test "LOCAL1" set rc [stap_run_alternatives stap -vu -p2 -e $local1_script] -if {$rc == 1} { pass $test } else { fail "$test ($rc)" } +if {$rc >= 1} { pass $test } else { fail "$test ($rc)" } set test "STRUCT1" set rc [stap_run_alternatives stap -vu -p2 -e $struct1_script] -if {$rc == 1} { pass $test } else { fail "$test ($rc)" } +if {$rc >= 1} { pass $test } else { fail "$test ($rc)" } diff --git a/testsuite/systemtap.base/cast.exp b/testsuite/systemtap.base/cast.exp index 74c4d72a..374132f0 100644 --- a/testsuite/systemtap.base/cast.exp +++ b/testsuite/systemtap.base/cast.exp @@ -2,5 +2,5 @@ set test "cast" set ::result_string {PID OK PID2 OK execname OK -tv_sec OK} +sa_data OK} stap_run2 $srcdir/$subdir/$test.stp -g diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp index 6298a06d..e2505000 100644 --- a/testsuite/systemtap.base/cast.stp +++ b/testsuite/systemtap.base/cast.stp @@ -25,19 +25,23 @@ probe begin else printf("execname \"%s\" != \"%s\"\n", name, cast_name) - // Compare tv_sec using a generated user module - sec = 42 - cast_sec = @cast(get_timeval(sec), "timeval", "<sys/time.h>")->tv_sec - if (sec == cast_sec) - println("tv_sec OK") + // Compare sa_data using a generated user module + data = 42 + cast_data = @cast(get_sockaddr(data), "sockaddr", "<sys/socket.h>")->sa_data[0] + if (data == cast_data) + println("sa_data OK") else - printf("tv_sec %d != %d\n", sec, cast_sec) + printf("sa_data %d != %d\n", data, cast_data) exit() } -function get_timeval:long(sec:long) %{ - static struct timeval mytime = {0}; - mytime.tv_sec = THIS->sec; - THIS->__retvalue = (long)&mytime; +%{ +#include <linux/socket.h> +%} + +function get_sockaddr:long(data:long) %{ + static struct sockaddr sa = {0}; + sa.sa_data[0] = THIS->data; + THIS->__retvalue = (long)&sa; %} diff --git a/testsuite/systemtap.base/flightrec2.exp b/testsuite/systemtap.base/flightrec2.exp index a22ef415..d4481db4 100644 --- a/testsuite/systemtap.base/flightrec2.exp +++ b/testsuite/systemtap.base/flightrec2.exp @@ -26,13 +26,12 @@ exec sleep 4 set scnt 0 set cnt1 0 # wait for log files -spawn ls -sk1 +eval spawn stat -c %s [glob flightlog.out.*] expect { -timeout 100 - -re {([0-9]+) flightlog\.out\.[0-9]+} { + -re {[0-9]+} { incr cnt1; - if {$expect_out(1,string) <= 1028} {incr scnt} - # 1024 + 4(for inode blocks?) + if {$expect_out(buffer) <= 1048576 } {incr scnt} exp_continue} timeout { fail "$test (logfile timeout)"} } @@ -40,12 +39,12 @@ wait exec sleep 3 set cnt2 0 # wait for log files -spawn ls -sk1 +eval spawn stat -c %s [glob flightlog.out.*] expect { -timeout 100 - -re {([0-9]+) flightlog\.out\.[0-9]+} { + -re {[0-9]+} { incr cnt2; - if {$expect_out(1,string) <= 1028} {incr scnt} + if {$expect_out(buffer) <= 1048576 } {incr scnt} exp_continue} timeout { fail "$test (logfile timeout)"} } @@ -57,10 +56,10 @@ if {$cnt1 == 3 && $cnt2 == 3} { fail "$test (log file numbers ($cnt1, $cnt2))" } # check logfile size -if {$scnt == 6} { +if {$scnt == $cnt1 + $cnt2 } { pass "$test (log file size limitation)" } else { - fail "$test (log file size ($scnt))" + fail "$test (log file size ($scnt != $cnt1 + $cnt2))" } exec kill -TERM $pid # wait for exiting... diff --git a/testsuite/systemtap.base/flightrec2.stp b/testsuite/systemtap.base/flightrec2.stp index 9d745f4b..f42c9b8e 100644 --- a/testsuite/systemtap.base/flightrec2.stp +++ b/testsuite/systemtap.base/flightrec2.stp @@ -1,5 +1,5 @@ -probe timer.ms(1) +probe timer.ms(10) { - for (j = 0; j < 100; j++) + for (j = 0; j < 1000; j++) printf("1234567890\n") } diff --git a/testsuite/systemtap.base/maxactive.exp b/testsuite/systemtap.base/maxactive.exp index 7c03a1bf..79ede897 100644 --- a/testsuite/systemtap.base/maxactive.exp +++ b/testsuite/systemtap.base/maxactive.exp @@ -10,12 +10,12 @@ proc sleep_five_sec {} { return 0; } -# Script1. For 5 seconds, probe the return of "sys_select" and -# "sys_read". See if we skip any probes. +# Script1. For 5 seconds, probe the return of "vfs_read" and +# "do_select". See if we skip any probes. set script1 { global foo - probe kernel.function("sys_select").return, - kernel.function("sys_read").return { foo++ } + probe kernel.function("vfs_read").return, + kernel.function("do_select").return { foo++ } probe timer.ms(5000) { exit(); } probe begin { log("systemtap starting probe"); log("systemtap ending probe");} @@ -26,13 +26,13 @@ set script1 { stap_run "MAXACTIVE01" sleep_five_sec "" -e $script1 set skipped1 $skipped_probes -# Script2. For 5 seconds, probe the return of "sys_select" and -# "sys_read", with a limit of 1 probe active at a time. See if we +# Script2. For 5 seconds, probe the return of "vfs_read" and +# "do_select", with a limit of 1 probe active at a time. See if we # skip any probes. set script2 { global foo - probe kernel.function("sys_select").return.maxactive(1), - kernel.function("sys_read").return.maxactive(1) { foo++ } + probe kernel.function("vfs_read").return.maxactive(1), + kernel.function("do_select").return.maxactive(1) { foo++ } probe timer.ms(5000) { exit(); } probe begin { log("systemtap starting probe"); log("systemtap ending probe");} diff --git a/testsuite/systemtap.base/onoffprobe.stp b/testsuite/systemtap.base/onoffprobe.stp index f7169039..79c41a3c 100644 --- a/testsuite/systemtap.base/onoffprobe.stp +++ b/testsuite/systemtap.base/onoffprobe.stp @@ -10,13 +10,13 @@ probe begin if (switch==0) { } #dwarf probe (return) -probe kernel.function("sys_write").return if (switch == 1) { +probe kernel.function("vfs_write").return if (switch == 1) { log("function return probed") switch = 0 } #dwarf probe (entry) -probe kernel.function("sys_write") if (switch == 2) { +probe kernel.function("vfs_write").return if (switch == 2) { log("function entry probed") switch = 0 } diff --git a/testsuite/systemtap.base/optionalprobe.exp b/testsuite/systemtap.base/optionalprobe.exp new file mode 100644 index 00000000..5484003c --- /dev/null +++ b/testsuite/systemtap.base/optionalprobe.exp @@ -0,0 +1,9 @@ +set test "optionalprobe" +spawn stap -p2 -w $srcdir/$subdir/$test.stp +expect { + -timeout 60 + -re "# probes\r\n" { exp_continue } + -re "^begin" { pass $test } + eof { fail $test } + timeout { fail "$test unexpected timeout" } +} diff --git a/testsuite/systemtap.base/optionalprobe.stp b/testsuite/systemtap.base/optionalprobe.stp new file mode 100644 index 00000000..239cf6e3 --- /dev/null +++ b/testsuite/systemtap.base/optionalprobe.stp @@ -0,0 +1,6 @@ +#! stap + +# test optional probe + +probe foo ?, bar !, foo* ?, bar* !, begin { +} diff --git a/testsuite/systemtap.base/overload.exp b/testsuite/systemtap.base/overload.exp index cbcbe817..ac9ceb24 100644 --- a/testsuite/systemtap.base/overload.exp +++ b/testsuite/systemtap.base/overload.exp @@ -8,7 +8,7 @@ set script { k["foo"] = 0 } - probe kernel.function("sys_read"), kernel.function("sys_write") { + probe kernel.function("vfs_read"), kernel.function("vfs_write") { k["foo"]++ } probe end { diff --git a/testsuite/systemtap.base/stmtvars.exp b/testsuite/systemtap.base/stmtvars.exp index 822e0d7e..c0099f2d 100644 --- a/testsuite/systemtap.base/stmtvars.exp +++ b/testsuite/systemtap.base/stmtvars.exp @@ -3,9 +3,9 @@ set test "stmtvars" set pc 0 set vars "" -spawn stap -e "probe kernel.function(\"sys_open\") {\$foo}" -p4 -vv -u +spawn stap -e "probe kernel.function(\"do_sys_open\") {\$foo}" -p4 -vv -u expect { - -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue } + -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue } -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars $expect_out(1,string); exp_continue } timeout { fail "$test (timeout)" } eof @@ -18,7 +18,7 @@ set pc2 0 set vars2 "" spawn stap -e "probe kernel.statement($pc) {\$foo}" -p4 -vv -u expect { - -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue } + -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue } -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars2 $expect_out(1,string); exp_continue } timeout { fail "$test (timeout)" } eof diff --git a/testsuite/systemtap.base/system_func.stp b/testsuite/systemtap.base/system_func.stp index d14fb25b..6a6bb04a 100644 --- a/testsuite/systemtap.base/system_func.stp +++ b/testsuite/systemtap.base/system_func.stp @@ -4,10 +4,10 @@ global saw_echo, did_cat -probe kernel.function("sys_open") { +probe kernel.function("do_sys_open") { if (!saw_echo) { # very inefficient. Testing only. DO NOT DO THIS - msg="echo sys_open" + msg="echo do_sys_open" system(msg) saw_echo = 1 } diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 87af07cf..84d1c93f 100644 --- a/testsuite/systemtap.examples/general/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta @@ -3,5 +3,5 @@ name: para-callgraph.stp keywords: trace callgraph subsystem: general description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger. -test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -c "cat /proc/sys/vm/*" +test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") +test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") -c "cat /proc/sys/vm/*" diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index 9e2deec6..875000cb 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -1,6 +1,9 @@ #! /usr/bin/env stap # traceio.stp # Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com> +# Copyright (C) 2009 Kai Meyer <kai@unixlords.com> +# Fixed a bug that allows this to run longer +# And added the humanreadable function # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -10,22 +13,32 @@ global reads, writes, total_io probe vfs.read.return { - reads[execname()] += $return + reads[pid(),execname()] += $return + total_io[pid(),execname()] += $return } probe vfs.write.return { - writes[execname()] += $return + writes[pid(),execname()] += $return + total_io[pid(),execname()] += $return +} + +function humanreadable(bytes) { + if (bytes > 1024*1024*1024) { + return sprintf("%d GiB", bytes/1024/1024/1024) + } else if (bytes > 1024*1024) { + return sprintf("%d MiB", bytes/1024/1024) + } else if (bytes > 1024) { + return sprintf("%d KiB", bytes/1024) + } else { + return sprintf("%d B", bytes) + } } probe timer.s(1) { - foreach (p in reads) - total_io[p] += reads[p] - foreach (p in writes) - total_io[p] += writes[p] - foreach(p in total_io- limit 10) - printf("%15s r: %8d KiB w: %8d KiB\n", - p, reads[p]/1024, - writes[p]/1024) + foreach([p,e] in total_io- limit 10) + printf("%8d %15s r: %12s w: %12s\n", + p, e, humanreadable(reads[p,e]), + humanreadable(writes[p,e])) printf("\n") # Note we don't zero out reads, writes and total_io, # so the values are cumulative since the script started. |