diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-06-12 22:37:11 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-06-12 22:45:48 +0200 |
commit | 6a7dc7d9c3df7d5d722f0702a0a0c8d55591006e (patch) | |
tree | af60884dfc31a84e4dc32b7379f2e5c72ed43656 /testsuite/systemtap.base | |
parent | 8fb430a7eeb394d759fe792198d28aeab348f048 (diff) | |
download | systemtap-steved-6a7dc7d9c3df7d5d722f0702a0a0c8d55591006e.tar.gz systemtap-steved-6a7dc7d9c3df7d5d722f0702a0a0c8d55591006e.tar.xz systemtap-steved-6a7dc7d9c3df7d5d722f0702a0a0c8d55591006e.zip |
Add exelib uprobes test framework.
Tests uprobes placed in executables and shared libraries on different
arches (32-on-64 currently disabled), gcc/g++, optimizations (currently
disabled), prelinked libs (currently disabled), seperate libs/exe debuginfo
and pie executables.
* testsuite/systemtap.base/uprobes_exe.c: Moved to...
* testsuite/systemtap.exelib/uprobes_exe.c: From systemtap.base.
* testsuite/systemtap.base/uprobes_lib.c: Moved to...
* testsuite/systemtap.exelib/uprobes_lib.c: From systemtap.base.
* testsuite/systemtap.base/uprobes_lib.exp: Rewritten as...
* testsuite/systemtap.exelib/lib.tcl: From uprobes_lib.exp.
* testsuite/systemtap.base/uprobes_lib.stp: Rewritten as...
* testsuite/systemtap.exelib/lib.stp: From uprobes_lib.stp.
* testsuite/systemtap.base/uprobes_uname.exp: Rewritten as...
* testsuite/systemtap.exelib/uname.tcl: From uprobes_uname.exp.
* testsuite/systemtap.base/uprobes_uname.stp: Rewritten as...
* testsuite/systemtap.exelib/uname.stp: From uprobes_uname.stp.
* testsuite/systemtap.base/uprobes_ustack.exp: Rewritten as...
* testsuite/systemtap.exelib/ustack.tcl: From uprobes_ustack.exp.
* testsuite/systemtap.base/uprobes_ustack.stp: Rewritten as...
* testsuite/systemtap.exelib/ustack.stp: From uprobes_ustack.stp.
* testsuite/systemtap.exelib/exelib.exp: New exelib uprobes framework.
* testsuite/systemtap.exelib/cleanup.tcl: New file.
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/uprobes_exe.c | 29 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_lib.c | 21 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_lib.exp | 46 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_lib.stp | 15 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_uname.exp | 46 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_uname.stp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_ustack.exp | 97 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes_ustack.stp | 35 |
8 files changed, 0 insertions, 296 deletions
diff --git a/testsuite/systemtap.base/uprobes_exe.c b/testsuite/systemtap.base/uprobes_exe.c deleted file mode 100644 index b4811335..00000000 --- a/testsuite/systemtap.base/uprobes_exe.c +++ /dev/null @@ -1,29 +0,0 @@ -/* uprobes_lib test case - * Copyright (C) 2009, 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. - */ - -#include <unistd.h> - -// function from our library -int lib_main (void); - -void -main_func (int foo) -{ - if (foo > 1) - main_func (foo - 1); - else - lib_main(); -} - -int -main (int argc, char *argv[], char *envp[]) -{ - main_func (3); - return 0; -} diff --git a/testsuite/systemtap.base/uprobes_lib.c b/testsuite/systemtap.base/uprobes_lib.c deleted file mode 100644 index 25297b6b..00000000 --- a/testsuite/systemtap.base/uprobes_lib.c +++ /dev/null @@ -1,21 +0,0 @@ -/* uprobes_lib test case - library helper - * Copyright (C) 2009, 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. - */ - -void -lib_func (int bar) -{ - if (bar > 1) - lib_func (bar - 1); -} - -void -lib_main () -{ - lib_func (3); -} diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp deleted file mode 100644 index 313c01b6..00000000 --- a/testsuite/systemtap.base/uprobes_lib.exp +++ /dev/null @@ -1,46 +0,0 @@ -set test "uprobes_lib" -set testpath "$srcdir/$subdir" -set testsrc "$testpath/uprobes_exe.c" -set testsrclib "$testpath/uprobes_lib.c" -set testexe "./uprobes_exe" -set testlibname "uprobes_lib" -set testlibdir "." -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" - -# 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 "$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 "$test compile $testsrc" - return -} else { - pass "$test compile $testsrc" -} - -set ::result_string {main -main_func -main_func -main_func -lib_main -lib_func -lib_func -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/uprobes_lib.stp b/testsuite/systemtap.base/uprobes_lib.stp deleted file mode 100644 index 459351a4..00000000 --- a/testsuite/systemtap.base/uprobes_lib.stp +++ /dev/null @@ -1,15 +0,0 @@ -probe process("uprobes_exe").function("main") { - printf("main\n"); -} - -probe process("uprobes_exe").function("main_func") { - printf("main_func\n"); -} - -probe process("libuprobes_lib.so").function("lib_main") { - printf("lib_main\n"); -} - -probe process("libuprobes_lib.so").function("lib_func") { - printf("lib_func\n"); -} diff --git a/testsuite/systemtap.base/uprobes_uname.exp b/testsuite/systemtap.base/uprobes_uname.exp deleted file mode 100644 index 65e1ff70..00000000 --- a/testsuite/systemtap.base/uprobes_uname.exp +++ /dev/null @@ -1,46 +0,0 @@ -set test "uprobes_uname" -set testpath "$srcdir/$subdir" -set testsrc "$testpath/uprobes_exe.c" -set testsrclib "$testpath/uprobes_lib.c" -set testexe "./uprobes_exe" -set testlibname "uprobes_lib" -set testlibdir "." -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" - -# 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 "$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 "$test compile $testsrc" - return -} else { - pass "$test compile $testsrc" -} - -set ::result_string {exe: main=main -exe: main_func=main_func -exe: main_func=main_func -exe: main_func=main_func -lib: lib_main=lib_main -lib: lib_func=lib_func -lib: lib_func=lib_func -lib: lib_func=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/uprobes_uname.stp b/testsuite/systemtap.base/uprobes_uname.stp deleted file mode 100644 index a44d78d3..00000000 --- a/testsuite/systemtap.base/uprobes_uname.stp +++ /dev/null @@ -1,7 +0,0 @@ -probe process("uprobes_exe").function("*") { - printf("exe: %s=%s\n",probefunc(), usymname(uaddr())); -} - -probe process("libuprobes_lib.so").function("*") { - printf("lib: %s=%s\n",probefunc(), usymname(uaddr())); -} diff --git a/testsuite/systemtap.base/uprobes_ustack.exp b/testsuite/systemtap.base/uprobes_ustack.exp deleted file mode 100644 index bfc435e9..00000000 --- a/testsuite/systemtap.base/uprobes_ustack.exp +++ /dev/null @@ -1,97 +0,0 @@ -set test "uprobes_ustack" -set testpath "$srcdir/$subdir" -set testsrc "$testpath/uprobes_exe.c" -set testsrclib "$testpath/uprobes_lib.c" -set testexe "./uprobes_exe" -set testlibname "uprobes_lib" -set testlibdir "." -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" - -# 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 "$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 "$test compile $testsrc" - return -} else { - pass "$test compile $testsrc" -} - -set ::result_string {exe: main=main -exe: main_func=main_func -exe: main_func=main_func -exe: main_func=main_func -lib: lib_main=lib_main -lib: lib_func=lib_func -lib: lib_func=lib_func -lib: lib_func=lib_func} - -# Only run on make installcheck -if {! [installtest_p]} { untested "$test"; return } -if {! [utrace_p]} { untested $test; return } - -# Output is: -#print_ubacktrace exe 0 -# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe] -# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] -#print_ustack exe 1 -# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe] -# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] -# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] -#print_ubacktrace lib 2 -# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so] -# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so] -# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe] -# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] -# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] -# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] -#print_ustack lib 3 -# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so] -# 0x00db2431 : lib_func+0x25/0x2b [.../libuprobes_lib.so] -# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so] -# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe] -# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] -# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] -# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] - -set print 0 -set main 0 -set main_func 0 -set lib_main 0 -set lib_func 0 -# Needs extra space since on 64bit the last ubacktrace string is -# 7 entries * (16 hex + 2 for 0x + 1 space) = 133 chars. -# Default MAXSTRINGLEN is 128 chars. -spawn stap -DMAXSTRINGLEN=133 $srcdir/$subdir/$test.stp -c $testexe - -wait -expect { - -timeout 60 - -re {^print_[^\r\n]+\r\n} {incr print; exp_continue} - -re {^ 0x[a-f0-9]+ : main\+0x[^\r\n]+\r\n} {incr main; exp_continue} - -re {^ 0x[a-f0-9]+ : main_func\+0x[^\r\n]+\r\n} {incr main_func; exp_continue} - -re {^ 0x[a-f0-9]+ : lib_main\+0x[^\r\n]+\r\n} {incr lib_main; exp_continue} - -re {^ 0x[a-f0-9]+ : lib_func\+0x[^\r\n]+\r\n} {incr lib_func; exp_continue} - timeout { fail "$test (timeout)" } - eof { } -} - -if {$print == 4} {pass "$test print"} {fail "$test print ($print)"} -if {$main == 4} {pass "$test main"} {fail "$test main ($main)"} -if {$main_func == 9} {pass "$test main_func"} {fail "$test main_func ($main_func)"} -if {$lib_main == 2} {pass "$test lib_main"} {fail "$test lib_main ($lib_main)"} -if {$lib_func == 3} {pass "$test lib_func"} {fail "$test lib_func ($lib_func)"} - -#exec rm -f $testexe $testso diff --git a/testsuite/systemtap.base/uprobes_ustack.stp b/testsuite/systemtap.base/uprobes_ustack.stp deleted file mode 100644 index 6de03b42..00000000 --- a/testsuite/systemtap.base/uprobes_ustack.stp +++ /dev/null @@ -1,35 +0,0 @@ -// Prints backtrace from lib through exe twice using diffent ustack functions. - -global hits = 0; - -probe process("uprobes_exe").function("main_func") -{ - if (hits == 0) - { - log("print_ubacktrace exe 0"); - print_ubacktrace(); - hits++; - } - else if (hits == 1) - { - log("print_ustack exe 1"); - print_ustack(ubacktrace()); - hits++; - } -} - -probe process("libuprobes_lib.so").function("lib_func") -{ - if (hits == 2) - { - log("print_ubacktrace lib 2"); - print_ubacktrace(); - hits++; - } - else if (hits == 3) - { - log("print_ustack lib 3"); - print_ustack(ubacktrace()); - hits++; - } -} |