From d94d159d9524a9b705c2704ca15b5014a24c923e Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 15 Jan 2008 03:34:56 +0000 Subject: PR 4935. * systemtap.base/onoffprobe.*: Toughen test. --- testsuite/ChangeLog | 5 +++ testsuite/systemtap.base/onoffprobe.exp | 67 ++++++++++++--------------------- testsuite/systemtap.base/onoffprobe.stp | 23 ++++++++--- 3 files changed, 47 insertions(+), 48 deletions(-) (limited to 'testsuite') diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index d8439450..87d31c96 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-14 Frank Ch. Eigler + + PR 4935. + * systemtap.base/onoffprobe.*: Toughen test. + 2008-01-12 Frank Ch. Eigler * lib/systemtap.exp (get_system_info): Look for $builddir/SNAPSHOT too. diff --git a/testsuite/systemtap.base/onoffprobe.exp b/testsuite/systemtap.base/onoffprobe.exp index 41e107d7..b86de4ea 100644 --- a/testsuite/systemtap.base/onoffprobe.exp +++ b/testsuite/systemtap.base/onoffprobe.exp @@ -4,54 +4,37 @@ if {![installtest_p]} { untested $test; return } spawn stap $srcdir/$subdir/$test.stp -m $test set pid $spawn_id set ok 0 + +proc advance {} { + global test + global expect_out + global ok + pass "$test $expect_out(1,string)" + incr ok + exec echo $ok > /proc/systemtap/$test/switch + exec echo dummy > /dev/null + exp_continue +} + expect { -timeout 240 - "begin probed\r\n" { - if {$ok == 0} { - incr ok - pass "conditional begin probe" - exec echo 1 > /proc/systemtap/$test/switch - exec echo "dummy" > /dev/null - exp_continue; - } - } - "function return probed\r\n" { - if {$ok == 1} { - incr ok - pass "conditional dwarf probe (return)" - exec echo 2 > /proc/systemtap/$test/switch - exec echo "dummy" > /dev/null - exp_continue; - } - } - "function entry probed\r\n" { - if {$ok == 2} { - incr ok - pass "conditional dwarf probe (entry)" - exec echo 3 > /proc/systemtap/$test/switch - exp_continue; - } - } - "timer probed\r\n" { - if {$ok == 3} { - incr ok - pass "conditional timer probe" - exec echo 4 > /proc/systemtap/$test/switch - exp_continue; - } - } - "profile probed\r\n" { - if {$ok == 4} { - incr ok - pass "conditional profile probe" - } + -re "(begin1 probed)\r\n" { advance } + -re "^(function return probed)\r\n" { advance } + -re "^(function entry probed)\r\n" { advance } + -re "^(timer probed)\r\n" { advance } + -re "^(profile probed)\r\n" { advance } + -re "^(alias\.one\.a and alias\.one and alias\.\* probed)\r\n" { advance } + -re "^(alias\.one\.b and alias\.one and alias\.\* probed)\r\n" { advance } + -re "^(alias\.two and alias\.\* probed)\r\n" { + pass "$test $expect_out(1,string)" + incr ok } - timeout { fail "$test (timeout)" } - eof { } + timeout { fail "$test (timeout)" } + eof { } } send "\003" #FIXME does not handle case of hanging pfaults.stp correctly wait exec rm -f $test.ko -if {$ok != 5} {fail "conditional probes ($ok)"} +if {$ok != 8} {fail "conditional probes ($ok)"} diff --git a/testsuite/systemtap.base/onoffprobe.stp b/testsuite/systemtap.base/onoffprobe.stp index 11968540..f7169039 100644 --- a/testsuite/systemtap.base/onoffprobe.stp +++ b/testsuite/systemtap.base/onoffprobe.stp @@ -1,34 +1,45 @@ -global switch=0 +global switch=-1 #begin probe +probe begin if (switch==-1) { + log("begin1 probed"); +} + probe begin if (switch==0) { - log("begin probed\n"); + log("begin2 probed"); } #dwarf probe (return) probe kernel.function("sys_write").return if (switch == 1) { - log("function return probed\n") + log("function return probed") switch = 0 } #dwarf probe (entry) probe kernel.function("sys_write") if (switch == 2) { - log("function entry probed\n") + log("function entry probed") switch = 0 } #timer probe probe timer.s(1) if (switch == 3) { - log("timer probed\n") + log("timer probed") switch = 0 } #profile probe probe timer.profile if (switch == 4) { - log("profile probed\n") + log("profile probed") switch = 0 } +# aliasess +probe alias.one.a = timer.s(2) if (switch == 5) { print("alias.one.a and") } +probe alias.one.b = timer.s(3) if (switch == 6) { print("alias.one.b and") } +probe alias.one = alias.one.* if (switch >= 5 && switch < 7) { print(" alias.one and") } +probe alias.two = timer.s(4) if (switch == 7) { print("alias.two and") } +probe alias.* if (switch) { log(" alias.* probed") } + probe procfs("switch").write { switch = strtol($value, 10) } -- cgit From ed22941d3e10e5723ead8381d79b55ba8a36981c Mon Sep 17 00:00:00 2001 From: eteo Date: Wed, 16 Jan 2008 15:41:28 +0000 Subject: 2008-01-16 Eugene Teo * stapfuncs.5.in: Document signal.stp tapset functions. 2008-01-16 Eugene Teo * signal.stp (get_sa_flags, get_sa_handler): New functions to return addresses of sa_flags and sa_handler of struct k_sigaction. (sigset_mask_str): New function. Returns a string containing the set of signals to be blocked when executing the signal handler. (is_sig_blocked): New function. Checks task_struct->blocked signal mask for signals that are currently blocked. (signal_str): New function. Translates a signal number. (sa_flags_str): New function. Translates the sa_flags. (sa_handler_str): New function. Returns the signal action or handler associated to the signal. 2008-01-16 Eugene Teo * buildok/signal-embedded.stp: Add all new embedded C functions in signal. --- testsuite/ChangeLog | 5 +++++ testsuite/buildok/signal-embedded.stp | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'testsuite') diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 87d31c96..55c2a8d9 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-16 Eugene Teo + + * buildok/signal-embedded.stp: Add all new embedded C functions + in signal. + 2008-01-14 Frank Ch. Eigler PR 4935. diff --git a/testsuite/buildok/signal-embedded.stp b/testsuite/buildok/signal-embedded.stp index 5a0d9d8b..24e218e9 100755 --- a/testsuite/buildok/signal-embedded.stp +++ b/testsuite/buildok/signal-embedded.stp @@ -2,5 +2,10 @@ probe begin { print (get_sigset(0)) + print (get_sa_flags(0)) + print (get_sa_handler(0)) + print (sigset_mask_str(0)) + print (is_sig_blocked(0, 0)) + print (sa_flags_str(0)) } -- cgit From 350bff3f8c5ee61cc8e88956e6dbfa269d4ee3ee Mon Sep 17 00:00:00 2001 From: dsmith Date: Wed, 16 Jan 2008 17:08:51 +0000 Subject: 2008-01-16 David Smith PR 5608. * systemtap.base/marker.exp: Added 2 tests for treating marker arguments incorrectly. --- testsuite/ChangeLog | 6 ++++++ testsuite/systemtap.base/marker.exp | 40 +++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'testsuite') diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 55c2a8d9..97180d2c 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-01-16 David Smith + + PR 5608. + * systemtap.base/marker.exp: Added 2 tests for treating marker + arguments incorrectly. + 2008-01-16 Eugene Teo * buildok/signal-embedded.stp: Add all new embedded C functions diff --git a/testsuite/systemtap.base/marker.exp b/testsuite/systemtap.base/marker.exp index 01d1ed54..bfa3b02d 100644 --- a/testsuite/systemtap.base/marker.exp +++ b/testsuite/systemtap.base/marker.exp @@ -11,7 +11,7 @@ proc stap_compile { TEST_NAME compile script args } { set cmd [concat {stap -v -p4 -e} $script $args] - #puts "running $cmd" + puts "running $cmd" eval spawn $cmd set compile_errors 0 expect { @@ -47,9 +47,13 @@ proc stap_compile { TEST_NAME compile script args } { set kernel_markers_found 0 set kernel_marker_names {} +set num_marker_found 0 +set num_marker_name "" + set kernel_script {"probe kernel.mark(\"%s\") { }"} set kernel_script_arg {"probe kernel.mark(\"%s\") { print(%s) }"} set kernel_script_arg2 {"probe kernel.mark(\"%s\") { %s = 0 }"} +set kernel_script_arg3 {"probe kernel.mark(\"%s\") { print(\$arg1%s) }"} # Try to read in the marker list from the Module.markers file. set uname [exec /bin/uname -r] @@ -59,9 +63,17 @@ if {! [catch {open $path RDONLY} fl]} { while {[gets $fl s] >= 0} { # This regexp only picks up markers that contain arguments. # This helps ensure that K_MARKER04 passes correctly. - if [regexp {^([^ \t]+)\t[^ \t]+.*%.+$} $s match name] { + if [regexp {^([^ \t]+)\t[^ \t]+.*(%.+)$} $s match name fmt] { set kernel_markers_found 1 lappend kernel_marker_names $name + + # Look for a marker whose first argument is numeric + # (either '%d', '%u', or '%p'). If we find such a marker, + # we can run K_MARKER09 and K_MARKER10. + if {$num_marker_found == 0 && [regexp {^%[dup]} $fmt]} { + set num_marker_found 1 + set num_marker_name $name + } } } catch {close $fl} @@ -156,3 +168,27 @@ if {$kernel_markers_found == 0} { [lindex $kernel_marker_names 0] {\$arg1}] stap_compile $TEST_NAME 0 $script } + +set TEST_NAME "K_MARKER09" +if {$kernel_markers_found == 0} { + untested "$TEST_NAME : no kernel markers present" +} elseif {$num_marker_found == 0} { + untested "$TEST_NAME : no kernel marker found with a numeric first argument" +} else { + # Try compiling a script that treats its first marker argument + # as a structure (which isn't allowed). + set script [format $kernel_script_arg3 $num_marker_name "->foo"] + stap_compile $TEST_NAME 0 $script +} + +set TEST_NAME "K_MARKER10" +if {$kernel_markers_found == 0} { + untested "$TEST_NAME : no kernel markers present" +} elseif {$num_marker_found == 0} { + untested "$TEST_NAME : no kernel marker found with a numeric first argument" +} else { + # Try compiling a script that treats its first marker argument + # like an array (which isn't allowed). + set script [format $kernel_script_arg3 $num_marker_name {\[0\]}] + stap_compile $TEST_NAME 0 $script +} -- cgit From c326a713647c9d356b9cf9a4a3a8da8370fa7a87 Mon Sep 17 00:00:00 2001 From: dsmith Date: Thu, 17 Jan 2008 20:29:56 +0000 Subject: 2008-01-17 David Smith * semko/procfs11.stp: Added test for invalid use of procfs probe '$value' target variable. * semko/procfs12.stp: Ditto. --- testsuite/ChangeLog | 6 ++++++ testsuite/semko/procfs11.stp | 4 ++++ testsuite/semko/procfs12.stp | 4 ++++ 3 files changed, 14 insertions(+) create mode 100755 testsuite/semko/procfs11.stp create mode 100755 testsuite/semko/procfs12.stp (limited to 'testsuite') diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 97180d2c..6dd0d8de 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-01-17 David Smith + + * semko/procfs11.stp: Added test for invalid use of procfs probe + '$value' target variable. + * semko/procfs12.stp: Ditto. + 2008-01-16 David Smith PR 5608. diff --git a/testsuite/semko/procfs11.stp b/testsuite/semko/procfs11.stp new file mode 100755 index 00000000..719346fb --- /dev/null +++ b/testsuite/semko/procfs11.stp @@ -0,0 +1,4 @@ +#! stap -p2 + +# use $value as a structure pointer in a procfs probe +probe procfs.write { print($value->foo) } diff --git a/testsuite/semko/procfs12.stp b/testsuite/semko/procfs12.stp new file mode 100755 index 00000000..c8af619b --- /dev/null +++ b/testsuite/semko/procfs12.stp @@ -0,0 +1,4 @@ +#! stap -p2 + +# use $value as an array in a procfs probe +probe procfs.write { print($value[0]) } -- cgit