diff options
Diffstat (limited to 'testsuite')
23 files changed, 239 insertions, 107 deletions
diff --git a/testsuite/buildok/twentysix.stp b/testsuite/buildok/twentysix.stp deleted file mode 100755 index 3fb7526f..00000000 --- a/testsuite/buildok/twentysix.stp +++ /dev/null @@ -1,7 +0,0 @@ -#! stap -up4 - -global a -probe begin -{ - a [1,2,3,4,5,6] = 0 -} diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp index a4beaa12..3043eeed 100644 --- a/testsuite/lib/stap_run.exp +++ b/testsuite/lib/stap_run.exp @@ -30,6 +30,7 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args } if [file readable $test_file_name] { lappend cmd $test_file_name } + send_log "executing: $cmd\n" eval spawn $cmd expect { -timeout 180 diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp index 554e88ed..5311be7b 100644 --- a/testsuite/lib/systemtap.exp +++ b/testsuite/lib/systemtap.exp @@ -16,6 +16,16 @@ proc use_server_p {} { } +proc utrace_p {} { + set path "/proc/kallsyms" + if {! [catch {exec grep -q utrace_attach $path} dummy]} { + return 1 + } else { + return 0 + } +} + + proc print_systemtap_version {} { set version [exec /bin/uname -r] set location "/boot/vmlinux-$version" diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index 92441e9e..2f76a43f 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -17,14 +17,7 @@ if {! [installtest_p]} { return } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { catch {exec rm -f $test} untested "$test -p5" return diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp index b96ed95c..32ecdaf5 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -3,14 +3,7 @@ set test bz6850 catch {exec gcc -g -o bz6850 $srcdir/$subdir/bz6850.c} err if {$err == "" && [file exists bz6850]} then { pass "$test compile" } else { fail "$test compile" } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { catch {exec rm -f $test} untested "$test -p4" untested "$test -p5" diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index e215bfe7..5da0dfaf 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -2,7 +2,6 @@ # Initialize variables -set utrace_support_found 0 set exepath "[pwd]/ls_[pid]" set itrace1_script { @@ -48,6 +47,26 @@ set itrace2_script { } set itrace2_script_output "itraced = 5\r\n" +set itrace3_script { + global branches = 0 + probe begin + { + printf("systemtap starting probe\n") + } + probe process("%s").insn.block + { + branches += 1 + if (branches == 5) + exit() + } + + + probe end { printf("systemtap ending probe\n") + printf("itraced block mode = %%d\n", branches) + } +} +set itrace3_script_output "itraced block mode = 5\r\n" + # Set up our own copy of /bin/ls, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating @@ -72,14 +91,8 @@ proc run_ls_5_sec {} { } -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - set TEST_NAME "itrace1" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested $TEST_NAME @@ -90,7 +103,7 @@ if {$utrace_support_found == 0} { set TEST_NAME "itrace2" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested $TEST_NAME @@ -99,5 +112,16 @@ if {$utrace_support_found == 0} { stap_run $TEST_NAME run_ls_5_sec $itrace2_script_output -e $script } +set TEST_NAME "itrace3" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} elseif {![installtest_p]} { + untested $TEST_NAME +} else { + send_log "ATTENTION: if arch_has_block_step is not defined for this arch, this testcase will fail\n" + set script [format $itrace3_script $exepath] + stap_run $TEST_NAME run_ls_5_sec $itrace3_script_output -e $script +} + # Cleanup exec rm -f $exepath diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 6db81c54..2f79a502 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -1,14 +1,6 @@ set test "labels" if {![installtest_p]} {untested $test; return} - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { untested "$test"; return } +if {![utrace_p]} { untested $test; return } # Compile a C program to use as the user-space probing target set label_srcpath "[pwd]/labels.c" diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 46fa5a28..c3aed91e 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -36,7 +36,7 @@ if { $res != "" } { pass "compiling $test.c $extra_flag" } -if {[installtest_p]} { +if {[installtest_p] && [utrace_p]} { stap_run3 "$test $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { untested "$test $extra_flag" @@ -61,7 +61,7 @@ if { $res != "" } { pass "compiling $test.c c++ $extra_flag" } -if {[installtest_p]} { +if {[installtest_p] && [utrace_p]} { stap_run3 "$test c++ $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { untested "$test c++ $extra_flag" diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 820626b8..07ff83e9 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -124,15 +124,7 @@ if { $res != "" } { } if {![installtest_p]} {untested $test; return} - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$test" catch {exec rm -f $sup_srcpath} return @@ -196,7 +188,7 @@ set ok 0 spawn stap -l "process(\"./sdt_types.x\").mark(\"*\")" expect { -timeout 180 - -re {mark\(\".*\"\)} { incr ok; exp_continue } + -re {mark\(\"[a-z_]+\"\)} { incr ok; exp_continue } timeout { fail "$test C (timeout)" } eof { } } diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index 89250e7b..6344cbf0 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -18,14 +18,7 @@ if [file exists $path] then { pass "$test prep" } else { fail "$test prep" } catch {exec gcc -g -o jennie jennie.c} err if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { fail "$test compile" } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$test -p4"; untested "$test -p5" catch {exec rm -f jennie.c jennie} return diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp index ae1b72e8..63ef957a 100644 --- a/testsuite/systemtap.base/uprobes_lib.exp +++ b/testsuite/systemtap.base/uprobes_lib.exp @@ -10,21 +10,23 @@ set testflags "additional_flags=-g additional_flags=-O" set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared" set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir" -# Only run on make installcheck -if {! [installtest_p]} { untested "$test"; return } - # Compile our test program and library. set res [target_compile $testsrclib $testso executable $testlibflags] if { $res != "" } { verbose "target_compile for $testso failed: $res" 2 - fail "unable to compile $testsrclib" + fail "$test compile $testsrclib" return +} else { + pass "$test compile $testsrclib" } + set res [target_compile $testsrc $testexe executable $maintestflags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "unable to compile $testsrc" + fail "$test compile $testsrc" return +} else { + pass "$test compile $testsrc" } # XXX main_func needs another/extra test. Disabled for now. @@ -33,6 +35,9 @@ if { $res != "" } { # lib_func} set ::result_string {lib_func} +# Only run on make installcheck +if {! [installtest_p]} { untested "$test"; return } +if {! [utrace_p]} { untested $test; return } stap_run2 $srcdir/$subdir/$test.stp -c $testexe #exec rm -f $testexe $testso diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 1467d9c8..8d323a8a 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -7,8 +7,6 @@ # utrace doesn't exist in the kernel, marks the tests as 'untested'. # Initialize variables -set utrace_support_found 0 - set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"} set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"} set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"} @@ -24,18 +22,12 @@ set pid_syscall_return_script {"probe process(123).syscall.return { printf(\"|%d set pid_thread_begin_script {"probe process(123).thread.begin { print(\"123 thread.begin\") }"} set pid_thread_end_script {"probe process(123).thread.end { print(\"123 thread.end\") }"} -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - # # Do some utrace compile tests. # set TEST_NAME "UTRACE_P4_01" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a begin script using a path @@ -43,7 +35,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_01_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a begin script using a pid @@ -51,7 +43,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_02" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a end script using a path @@ -59,7 +51,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_02_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a end script using a pid @@ -67,7 +59,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_03" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall script using a path @@ -75,7 +67,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_03_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall script using a pid @@ -83,7 +75,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_04" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall return script using a path @@ -91,7 +83,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_04_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall return script using a pid @@ -99,7 +91,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_05" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.begin script using a path @@ -107,7 +99,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_05_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.begin script using a pid @@ -115,7 +107,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_06" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.end script using a path @@ -123,7 +115,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_06_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.end script using a pid @@ -131,7 +123,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_07" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an system-wide begin script diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index 33281350..3d432dc3 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -1,7 +1,6 @@ # Utrace run (pass 5) tests. # Initialize variables -set utrace_support_found 0 set exepath "[pwd]/cat_[pid]" set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c" set multi_exepath "[pwd]/utrace_p5_multi_[pid]" @@ -90,12 +89,6 @@ set bz6841_script { } set bz6841_script_output ".+ issues syscall \\d+ times\r\n" -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - # Set up our own copy of /bin/cat, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating # a cross-device link. We can't use 'ln -s' here, since the kernel @@ -138,7 +131,7 @@ proc run_utrace_p5_multi {} { } set TEST_NAME "UTRACE_P5_01" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -148,7 +141,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_02" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -158,7 +151,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_03" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -168,7 +161,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_04" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -178,7 +171,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_05" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -189,7 +182,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_06" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -200,7 +193,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_07" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" diff --git a/testsuite/systemtap.context/args.tcl b/testsuite/systemtap.context/args.tcl index 7cb79cdf..cffaeaef 100644 --- a/testsuite/systemtap.context/args.tcl +++ b/testsuite/systemtap.context/args.tcl @@ -1,6 +1,6 @@ spawn stap $srcdir/$subdir/args.stp expect { - -timeout 240 + -timeout 60 "READY" { exec echo 1 > /proc/stap_test_cmd expect { diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl index ca60c369..6edda812 100644 --- a/testsuite/systemtap.context/backtrace.tcl +++ b/testsuite/systemtap.context/backtrace.tcl @@ -8,7 +8,7 @@ set m6 0 spawn stap -DMAXSTRINGLEN=256 $srcdir/$subdir/backtrace.stp #exp_internal 1 expect { - -timeout 240 + -timeout 60 "Systemtap probe: begin\r\n" { pass "backtrace of begin probe" exec echo 0 > /proc/stap_test_cmd diff --git a/testsuite/systemtap.context/context.exp b/testsuite/systemtap.context/context.exp index 010db445..cec09b29 100644 --- a/testsuite/systemtap.context/context.exp +++ b/testsuite/systemtap.context/context.exp @@ -80,6 +80,7 @@ if {[build_modules] == 0} { } foreach test $testlist { + send_log "sourcing: $srcdir/$subdir/$test.tcl\n" source $srcdir/$subdir/$test.tcl } diff --git a/testsuite/systemtap.context/num_args.tcl b/testsuite/systemtap.context/num_args.tcl index 7d12b433..62ac8dd3 100644 --- a/testsuite/systemtap.context/num_args.tcl +++ b/testsuite/systemtap.context/num_args.tcl @@ -3,7 +3,7 @@ foreach arglist $arglists { set tag [concat numeric $arglist] eval spawn stap $arglist $srcdir/$subdir/num_args.stp expect { - -timeout 240 + -timeout 60 "READY" { exec echo 1 > /proc/stap_test_cmd expect { diff --git a/testsuite/systemtap.context/pid.tcl b/testsuite/systemtap.context/pid.tcl index a2c091f1..70a87345 100644 --- a/testsuite/systemtap.context/pid.tcl +++ b/testsuite/systemtap.context/pid.tcl @@ -2,7 +2,7 @@ set tests [list execname pexecname pid ppid tid uid euid gid egid] spawn stap $srcdir/$subdir/pid.stp #exp_internal 1 expect { - -timeout 240 + -timeout 60 "READY" { set pid [exec echo 1 > /proc/stap_test_cmd &] set ppid {[0-9]*} diff --git a/testsuite/systemtap.context/usymbols.c b/testsuite/systemtap.context/usymbols.c new file mode 100644 index 00000000..7c590724 --- /dev/null +++ b/testsuite/systemtap.context/usymbols.c @@ -0,0 +1,39 @@ +/* usymbol test case + * Copyright (C) 2008, Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + * + * Uses signal to tranfer user space addresses into the kernel where a + * probe on sigaction will extract them and produce the symbols. To + * poke into the executable we get the sa_handler from the main executable, + * and then the library through calling signal. + * + * FIXME. We call into the library to get the right symbol. If we + * register the handler from the main executable. We need to handle + * @plt symbols (setting a handler in the main executable that is in a + * shared library will have the @plt address, not the address inside + * the shared library). + */ + +#include <signal.h> +typedef void (*sighandler_t)(int); + +// function from our library +int lib_main (void); + +void +main_handler (int signum) +{ + /* dummy handler, just used for the address... */ +} + +int +main (int argc, char *argv[], char *envp[]) +{ + // Use SIGFPE since we never expect that to be triggered. + signal(SIGFPE, main_handler); + lib_main(); +} diff --git a/testsuite/systemtap.context/usymbols.exp b/testsuite/systemtap.context/usymbols.exp new file mode 100644 index 00000000..82f68b67 --- /dev/null +++ b/testsuite/systemtap.context/usymbols.exp @@ -0,0 +1,83 @@ +set test "./usymbols" +set testpath "$srcdir/$subdir" +set testsrc "$testpath/usymbols.c" +set testsrclib "$testpath/usymbols_lib.c" +set testexe "[pwd]/usymbols" +set testlibname "usymbols" +set testlibdir "[pwd]" +set testso "$testlibdir/lib${testlibname}.so" +set testflags "additional_flags=-g additional_flags=-O" +set testlibflags "testflags additional_flags=-fPIC additional_flags=-shared" +set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir" + +# Only run on make installcheck and utrace present. +if {! [installtest_p]} { untested "$test"; return } +if {! [utrace_p]} { untested "$test"; return } + +# Compile our test program and library. +set res [target_compile $testsrclib $testso executable $testlibflags] +if { $res != "" } { + verbose "target_compile for $testso failed: $res" 2 + fail "unable to compile $testsrclib" + return +} +set res [target_compile $testsrc $testexe executable $maintestflags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "unable to compile $testsrc" + return +} + +# We need the execname() trick to work around (the workaround of) PR6964 +# otherwise we get also the rt_sigactions of stapio. Get the handler +# (comes from the executable or the library). +set testscript { + probe syscall.rt_sigaction { + if (pid() == target() && execname() == "%s") { + handler = $act->sa_handler; + printf("handler: %%s\n", symbolname(handler)); + } + } + /* track through uprobes, so as to make sure we have the symbols */ + probe process("%s").function("*") { printf(""); } +} + +set output {handler: main_handler +handler: lib_handler} + +# Got to run stap with both the exe and the libraries used as -d args. +# XXX Note how we need the fully resolved (absolute) path... +set script [format $testscript usymbols $testexe] +catch {eval exec [concat ldd $testexe | grep $testlibname]} libpath +set libpath [lindex [split $libpath " "] 2] +send_log "libpath: $libpath\n" +if {[string equal "link" [file type $libpath]]} { + set libpath [file join [file dirname $libpath] [file readlink $libpath]] +} +send_log "libpath: $libpath\n" + +# XXX Cheat, explicitly add STP_NEED_VMA_TRACKER +set cmd [concat stap -DSTP_NEED_VMA_TRACKER -d $libpath -d $testexe -c $testexe -e {$script}] +send_log "cmd: $cmd\n" +catch {eval exec $cmd} res +send_log "cmd output: $res\n" + +set n 0 +set m [llength [split $output "\n"]] +set expected [split $output "\n"] +foreach line [split $res "\n"] { + if {![string equal $line [lindex $expected $n]]} { + fail usymbols + send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\", " + send_log "Got \"$line\"\n" + return + } + incr n +} +if { $n != $m } { + fail usymbols + send_log "Got \"$n\" lines, expected \"$m\" lines\n" +} else { + pass usymbols +} +exec rm -f $testexe $testso diff --git a/testsuite/systemtap.context/usymbols_lib.c b/testsuite/systemtap.context/usymbols_lib.c new file mode 100644 index 00000000..faccb39b --- /dev/null +++ b/testsuite/systemtap.context/usymbols_lib.c @@ -0,0 +1,29 @@ +/* usymbol test case - library helper + * Copyright (C) 2008, Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + * + * Uses signal to tranfer user space addresses into the kernel where a + * probe on sigaction will extract them and produce the symbols. To + * poke into the executable we get the sa_handler set through signal + * from this library. + */ + +#include <signal.h> +typedef void (*sighandler_t)(int); + +void +lib_handler (int signum) +{ + /* dummy handler, just used for the address... */ +} + +void +lib_main () +{ + // Use SIGFPE since we never expect that to be triggered. + signal(SIGFPE, lib_handler); +} diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp index 08d50fb5..12275c1d 100644 --- a/testsuite/systemtap.pass1-4/buildok.exp +++ b/testsuite/systemtap.pass1-4/buildok.exp @@ -6,12 +6,12 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { # some tests are known to fail. switch $test { buildok/perfmon01.stp {setup_kfail 909 *-*-*} - buildok/twentysix.stp {setup_kfail 4105 *-*-*} buildok/twentyseven.stp {setup_kfail 4166 *-*-*} buildok/sched_test.stp {setup_kfail 1155 *-*-*} buildok/process_test.stp {setup_kfail 1155 *-*-*} buildok/rpc-all-probes.stp {setup_kfail 4413 *-*-*} buildok/nfs-all-probes.stp {setup_kfail 4413 *-*-*} + buildok/per-process-syscall.stp {if {![utrace_p]} { setup_kfail 9999 *-*-*} } } if {$rc == 0} { pass $test } else { fail $test } } diff --git a/testsuite/systemtap.server/server.exp b/testsuite/systemtap.server/server.exp index c2c60b97..d2dd0f16 100644 --- a/testsuite/systemtap.server/server.exp +++ b/testsuite/systemtap.server/server.exp @@ -16,7 +16,6 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { # some tests are known to fail. switch $test { "buildok/perfmon01.stp with server" {setup_kfail 909 *-*-*} - "buildok/twentysix.stp with server" {setup_kfail 4105 *-*-*} "buildok/twentyseven.stp with server" {setup_kfail 4166 *-*-*} "buildok/sched_test.stp with server" {setup_kfail 1155 *-*-*} "buildok/process_test.stp with server" {setup_kfail 1155 *-*-*} |