diff options
author | Jim Keniston <jkenisto@us.ibm.com> | 2009-03-23 15:51:58 -0700 |
---|---|---|
committer | Jim Keniston <jkenisto@us.ibm.com> | 2009-03-23 15:51:58 -0700 |
commit | 1cd9c3ad40595180123083109e5b7d1230095f54 (patch) | |
tree | d1226de1275b40803f3e1c9d446232612b9a61a9 /testsuite/systemtap.base | |
parent | d8b7418ba4cf2bf2571f66a42517b9bced1b9132 (diff) | |
parent | d4db5608dbc31868a2041f20ea3f473eef3e61fd (diff) | |
download | systemtap-steved-1cd9c3ad40595180123083109e5b7d1230095f54.tar.gz systemtap-steved-1cd9c3ad40595180123083109e5b7d1230095f54.tar.xz systemtap-steved-1cd9c3ad40595180123083109e5b7d1230095f54.zip |
Merge branch 'master' of ssh://kenistoj@sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/cast.exp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/cast.stp | 22 | ||||
-rw-r--r-- | testsuite/systemtap.base/itrace.exp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/sdt.c | 2 | ||||
-rw-r--r-- | testsuite/systemtap.base/sdt.exp | 39 | ||||
-rw-r--r-- | testsuite/systemtap.base/sdt.stp | 20 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 28 | ||||
-rw-r--r-- | testsuite/systemtap.base/tracepoints.exp | 3 | ||||
-rw-r--r-- | testsuite/systemtap.base/tracepoints.stp | 23 |
9 files changed, 104 insertions, 44 deletions
diff --git a/testsuite/systemtap.base/cast.exp b/testsuite/systemtap.base/cast.exp new file mode 100644 index 00000000..df3246e8 --- /dev/null +++ b/testsuite/systemtap.base/cast.exp @@ -0,0 +1,4 @@ +set test "cast" +set ::result_string {PID OK +execname OK} +stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp new file mode 100644 index 00000000..bec0cc9b --- /dev/null +++ b/testsuite/systemtap.base/cast.stp @@ -0,0 +1,22 @@ +probe begin +{ + curr = task_current() + + // Compare PIDs + pid = pid() + cast_pid = @cast(curr, "task_struct")->tgid + if (pid == cast_pid) + println("PID OK") + else + printf("PID %d != %d\n", pid, cast_pid) + + // Compare execnames + name = execname() + cast_name = kernel_string(@cast(curr, "task_struct")->comm) + if (name == cast_name) + println("execname OK") + else + printf("execname \"%s\" != \"%s\"\n", name, cast_name) + + exit() +} diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index f19af977..e215bfe7 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -1,8 +1,5 @@ # itrace test -# temporarily disabled -return - # Initialize variables set utrace_support_found 0 @@ -11,7 +8,7 @@ set exepath "[pwd]/ls_[pid]" set itrace1_script { global instrs = 0 probe begin { printf("systemtap starting probe\n") } - probe process("%s").itrace + probe process("%s").insn { instrs += 1 if (instrs == 5) @@ -28,7 +25,7 @@ set itrace1_script_output "itraced = 5\r\n" set itrace2_script { global instrs = 0, itrace_on = 0, start_timer = 0 probe begin { start_timer = 1; printf("systemtap starting probe\n") } - probe process("%s").itrace if (itrace_on) + probe process("%s").insn if (itrace_on) { instrs += 1 if (instrs == 5) diff --git a/testsuite/systemtap.base/sdt.c b/testsuite/systemtap.base/sdt.c index 46f68664..7c7398e5 100644 --- a/testsuite/systemtap.base/sdt.c +++ b/testsuite/systemtap.base/sdt.c @@ -65,5 +65,7 @@ main (int argc, char **argv) call8(a, b, c, d, e, f, g, h); call9(a, b, c, d, e, f, g, h, i); call10(a, b, c, d, e, f, g, h, i, j); + (void) argv; + (void) argc; return 0; } diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 09aaaf8d..46fa5a28 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -10,54 +10,61 @@ set ::result_string {1 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10} -set extra_flags {{""} {additional_flags=-ansi}} +set extra_flags {{""} {additional_flags=-std=gnu89} {additional_flags=-ansi} {additional_flags=-pedantic} {additional_flags=-ansi additional_flags=-pedantic} {additional_flags=-O2} {additional_flags="-O3"}} # Iterate extra_flags, trying each with C and C++ for {set i 0} {$i < [llength $extra_flags]} {incr i} { +set extra_flag [lindex $extra_flags $i] +set testprog "sdt.c.exe.$i" + # C set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-I$srcdir/../includes/sys" -set test_flags "$test_flags additional_flags=-std=gnu89" set test_flags "$test_flags additional_flags=-Wall" -set test_flags "$test_flags additional_flags=-Wdeclaration-after-statement" +set test_flags "$test_flags additional_flags=-Wextra" set test_flags "$test_flags additional_flags=-Werror" -set res [target_compile $srcdir/$subdir/$test.c $test.prog executable [concat $test_flags " " [lindex $extra_flags $i]]] +set saveidx 0 + +set res [target_compile $srcdir/$subdir/$test.c $testprog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c" - return + fail "compiling $test.c $extra_flag" + untested "$test $extra_flag" + continue } else { - pass "compiling $test.c" + pass "compiling $test.c $extra_flag" } if {[installtest_p]} { - stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog + stap_run3 "$test $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { - untested "$test" + untested "$test $extra_flag" } # C++ +set testprog "sdt.cxx.exe.$i" + set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-I$srcdir/../includes/sys" set test_flags "$test_flags additional_flags=-Wall" set test_flags "$test_flags additional_flags=-Werror" set test_flags "$test_flags additional_flags=-x additional_flags=c++" -set res [target_compile $srcdir/$subdir/$test.c $test.prog executable [concat $test_flags [lindex $extra_flags $i]]] +set res [target_compile $srcdir/$subdir/$test.c $testprog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c" - return + fail "compiling $test.c c++ $extra_flag" + untested "$test $extra_flag" + continue } else { - pass "compiling $test.c" + pass "compiling $test.c c++ $extra_flag" } if {[installtest_p]} { - stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog + stap_run3 "$test c++ $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { - untested "$test" + untested "$test c++ $extra_flag" } } -catch {exec rm -f $test.prog} diff --git a/testsuite/systemtap.base/sdt.stp b/testsuite/systemtap.base/sdt.stp index 1f075bca..5df1fdc9 100644 --- a/testsuite/systemtap.base/sdt.stp +++ b/testsuite/systemtap.base/sdt.stp @@ -1,49 +1,49 @@ -probe process("sdt.prog").mark("mark_a") +probe process(@1).mark("mark_a") { printf("%d\n", $arg1); } -probe process("sdt.prog").mark("mark_b") +probe process(@1).mark("mark_b") { printf("%d %d\n", $arg1, $arg2); } -probe process("sdt.prog").mark("mark_c") +probe process(@1).mark("mark_c") { printf("%d %d %d\n", $arg1, $arg2, $arg3); } -probe process("sdt.prog").mark("mark_d") +probe process(@1).mark("mark_d") { printf("%d %d %d %d\n", $arg1, $arg2, $arg3, $arg4); } -probe process("sdt.prog").mark("mark_e") +probe process(@1).mark("mark_e") { printf("%d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5); } -probe process("sdt.prog").mark("mark_f") +probe process(@1).mark("mark_f") { printf("%d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6); } -probe process("sdt.prog").mark("mark_g") +probe process(@1).mark("mark_g") { printf("%d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); } -probe process("sdt.prog").mark("mark_h") +probe process(@1).mark("mark_h") { printf("%d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8); } -probe process("sdt.prog").mark("mark_i") +probe process(@1).mark("mark_i") { printf("%d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9); } -probe process("sdt.prog").mark("mark_j") +probe process(@1).mark("mark_j") { printf("%d %d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9, $arg10); } diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index a4bd5e2c..e407440e 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,5 +1,4 @@ - -set test "sduprobes" +set test "static_uprobes" # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" @@ -104,7 +103,11 @@ if {[installtest_p]} { set sdtdir $srcdir/../includes } -set sup_flags "additional_flags=-I$sdtdir additional_flags=-g additional_flags=-O additional_flags=-I." +set sup_flags "additional_flags=-I$srcdir/../includes/sys" +set sup_flags "$sup_flags additional_flags=-I$sdtdir" +set sup_flags "$sup_flags additional_flags=-g" +set sup_flags "$sup_flags additional_flags=-O" +set sup_flags "$sup_flags additional_flags=-I." set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -115,9 +118,7 @@ if { $res != "" } { pass "$test compiling C -g" } -spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" -set sup_srcpath "[pwd]/static_uprobes.cc" -set sup_flags "$sup_flags c++" +set sup_flags "$sup_flags additional_flags=-x additional_flags=c++" set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -163,9 +164,9 @@ if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" } set ok 0 -# spawn objcopy -R .probes $supcplus_exepath $sup_exepath -verbose -log "cp $supcplus_exepath $sup_exepath" -spawn cp $supcplus_exepath $sup_exepath +# Test setting a probe without .probes using only dwarf label info +verbose -log "objcopy -R .probes $supcplus_exepath $sup_exepath" +spawn objcopy -R .probes $supcplus_exepath $sup_exepath verbose -log "spawn stap -c $sup_exepath $sup_stppath" spawn stap -c $sup_exepath $sup_stppath expect { @@ -180,9 +181,10 @@ expect { wait -if {$ok == 5} { pass "$test C++" } { fail "$test C++ ($ok)" } +# we now generate the probes via asm so there is no label debug info +if {$ok == 5} { pass "$test C++" } { xfail "$test C++ ($ok)" } -# catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} +if { $verbose == 0 } { +catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_dpath $sup_hpath $sup_stppath} +} -# It's not so important to clean up, and it's unhelpful if -# one needs to diagnose a test failure. diff --git a/testsuite/systemtap.base/tracepoints.exp b/testsuite/systemtap.base/tracepoints.exp new file mode 100644 index 00000000..bea461c4 --- /dev/null +++ b/testsuite/systemtap.base/tracepoints.exp @@ -0,0 +1,3 @@ +set test "tracepoints" +set ::result_string {tracepoints OK} +stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.base/tracepoints.stp b/testsuite/systemtap.base/tracepoints.stp new file mode 100644 index 00000000..bdb4d730 --- /dev/null +++ b/testsuite/systemtap.base/tracepoints.stp @@ -0,0 +1,23 @@ +// This checks that we can compile and register every tracepoint +// we can find, along with all of their context variables. +global hits +probe all_tracepoints = kernel.trace("*") +{ + if ($$name . $$vars . $$parms == "") + next + + // Allow it to quit once we hit our hundredth tracepoint + if (++hits < 100) + next +} + +// If there aren't any tracepoints in the kernel, +// we use "begin" instead to quit right away. +probe all_tracepoints!, begin { + println("tracepoints OK") + exit() +} + +// give hits a use so there's no warning +// when we don't have tracepoints +probe never { hits++ } |