From 9fbda39bf7687ceeee28813f30f6e3ec5c72fc5d Mon Sep 17 00:00:00 2001 From: William Cohen Date: Thu, 29 Jan 2009 16:55:06 -0500 Subject: Move some systemtap.sample tests to systemtap.base. --- testsuite/systemtap.base/arith.exp | 14 +++++ testsuite/systemtap.base/arith.stp | 79 ++++++++++++++++++++++++++++ testsuite/systemtap.base/arith_limits.exp | 13 +++++ testsuite/systemtap.base/arith_limits.stp | 80 +++++++++++++++++++++++++++++ testsuite/systemtap.base/control_limits.exp | 46 +++++++++++++++++ testsuite/systemtap.base/control_limits.stp | 24 +++++++++ testsuite/systemtap.base/gtod.c | 26 ++++++++++ testsuite/systemtap.base/gtod.exp | 40 +++++++++++++++ testsuite/systemtap.base/gtod.sh | 4 ++ testsuite/systemtap.base/gtod.stp | 8 +++ testsuite/systemtap.base/system_func.exp | 22 ++++++++ testsuite/systemtap.base/system_func.stp | 35 +++++++++++++ 12 files changed, 391 insertions(+) create mode 100644 testsuite/systemtap.base/arith.exp create mode 100644 testsuite/systemtap.base/arith.stp create mode 100644 testsuite/systemtap.base/arith_limits.exp create mode 100644 testsuite/systemtap.base/arith_limits.stp create mode 100644 testsuite/systemtap.base/control_limits.exp create mode 100644 testsuite/systemtap.base/control_limits.stp create mode 100644 testsuite/systemtap.base/gtod.c create mode 100644 testsuite/systemtap.base/gtod.exp create mode 100755 testsuite/systemtap.base/gtod.sh create mode 100644 testsuite/systemtap.base/gtod.stp create mode 100644 testsuite/systemtap.base/system_func.exp create mode 100644 testsuite/systemtap.base/system_func.stp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/arith.exp b/testsuite/systemtap.base/arith.exp new file mode 100644 index 00000000..c4f72793 --- /dev/null +++ b/testsuite/systemtap.base/arith.exp @@ -0,0 +1,14 @@ +set test "arith" +if {![installtest_p]} { untested $test; return } + +spawn stap -DMAXNESTING=5 $srcdir/$subdir/arith.stp +set ok 0 +expect { + -timeout 150 + -re {passes: [0-9]* failures: 0} { incr ok } + timeout { fail "$test (timeout)" } + eof { } +} +close +wait +if {$ok == 1} { pass "$test" } { fail "$test" } diff --git a/testsuite/systemtap.base/arith.stp b/testsuite/systemtap.base/arith.stp new file mode 100644 index 00000000..59016dcb --- /dev/null +++ b/testsuite/systemtap.base/arith.stp @@ -0,0 +1,79 @@ +global testno, passes, failures + +function test (v,n1,n2) { + if (n1 == n2) { + passes ++ + result = "pass" + } else { + failures ++ + result = "fail" + } + println ("test " . (sprint (++testno)) . " [" . v . "]\t" . result) +} + +function stest (v,n1,n2) { + if (n1 == n2) { + passes ++ + result = "pass" + } else { + failures ++ + result = "fail" + } + println ("test " . (sprint (++testno)) . " [" . v . "]\t" . result) +} + + +probe begin { + test ("+", 0, 0+0) + test ("+", 33339999, 33330000+9999) + test ("-", -1, 2-3) + test ("==", 1, -1==-1) + test ("!=", 1, -1!=1) + test ("== s", 1, "foobar"=="foobar") + test ("<= s", 1, "fooban"<="foobar") + test ("> s", 1, "xxx">"aaa") + test ("<", 1, -1<0) + test ("<", 1, 85723838<8273823892) + test ("*", 100300400500, 1003004005 * 100) + test ("*", -1*-500, 500) + test ("/", 1003004005/1000, 1003004) + test ("%", 1003004005%1000, 5) + test ("/", -1/-1, 1) + test ("%", -1%-1, 0) + test ("/", 0/-100, 0) + test ("%", 0%-100, 0) + test ("/", (-2147483647-1)/-1, 2147483648) + test ("%", (-2147483647-1)%-1, 0) + # but (-9223372036854775807-1)/-1 may overflow + test ("%", (-9223372036854775807-1)%-1, 0) + test ("&", 0x555&0xaaa, 0) + test ("|", 0x555|0xaaa, 0xfff) + test ("^", 0x55f^0xaaf, 0xff0) + test ("&&", 0x555&&0xaaa, 1) + test ("||", 0x555||0xaaa, 1) + test ("<<", 0<<5, 0) + test ("<<", 1<<8, 0x100) + test ("<<", 120<<-2, 120) + test ("<<", 120<<0, 120) + test ("<<", -4096<<-3, -4096) + test (">>", -4096>>3, -512) + test (">>", -4096>>-3, -4096) + test (">>", 120>>-2, 120) + test (">>", 120>>0, 120) + i=1; test ("--i", --i, 0) + i=1; test ("++i", ++i, 2) + i=1; test ("i--", i--, 1) + i=1; test ("i++", i++, 1) + i=1; test ("+=", i+=4, 5) test ("after +=", i, 5) + i=5; test ("/=", i/=2, 2) test ("after /=", i, 2) + a="1" b="2"; stest (".=", a .= b, "12") stest ("after .=", a, "12") +} + + +probe timer.jiffies(1) { # some time after all the begin probes + exit () +} + +probe end { + printf ("passes: %d failures: %d\n", passes, failures) +} diff --git a/testsuite/systemtap.base/arith_limits.exp b/testsuite/systemtap.base/arith_limits.exp new file mode 100644 index 00000000..93794c8e --- /dev/null +++ b/testsuite/systemtap.base/arith_limits.exp @@ -0,0 +1,13 @@ +set test "arith_limits" +if {![installtest_p]} { untested $test; return } + +spawn stap -DMAXNESTING=5 $srcdir/$subdir/arith_limits.stp +set ok 0 +expect { + -timeout 150 + -re {passes: [0-9]* failures: 0} { incr ok } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$ok == 1} { pass "$test" } { fail "$test" } diff --git a/testsuite/systemtap.base/arith_limits.stp b/testsuite/systemtap.base/arith_limits.stp new file mode 100644 index 00000000..6c620830 --- /dev/null +++ b/testsuite/systemtap.base/arith_limits.stp @@ -0,0 +1,80 @@ +global testno, passes, failures + +function test (v,n1,n2) { + if (n1 == n2) { + passes ++ + result = "pass" + } else { + failures ++ + result = "fail" + } + printf ("test %d [%s]\t\t%s\n", testno++, v, result) +} + +# Exactly the same as test() except it will magically work for strings. +# Wouldn't it be nice if we didn't have to do this? + +function teststr (v,n1,n2) { + if (n1 == n2) { + passes ++ + result = "pass" + } else { + failures ++ + result = "fail" + } + printf ("test %d [%s]\t\t%s\n", testno++, v, result) +} + + + +probe begin { + # max/minimum signed 32-bit values. + # these could cause problems for 32-bit cpus when overflows + # occur into 64-but values + lmax = 0x7fffffff + lmin = -0x80000000 + + # max/minimum signed 64-bit values + llmax = 0x7fffffffffffffff + llmin = -0x7fffffffffffffff-1 + + # 32-bit limit tests + teststr ("string lmax", sprint(lmax), "2147483647") + teststr ("hex lmax", sprintf("0x%x", lmax), "0x7fffffff") + teststr ("string lmin", sprint(lmin), "-2147483648") + teststr ("hex lmin", sprintf("0x%x", lmin), "0xffffffff80000000") + test ("lmax/-1", lmax/-1, -2147483647); + test ("lmin/-1", lmin/-1, 2147483648); + test ("lmax +1", lmax+1, 2147483648); + test ("lmin -1", lmin-1, -2147483649); + + # 64-bit limits + teststr ("string llmax", sprint(llmax), "9223372036854775807") + teststr ("hex llmax", sprintf("0x%x", llmax), "0x7fffffffffffffff") + teststr ("string llmin", sprint(llmin), "-9223372036854775808") + teststr ("hex llmin", sprintf("0x%x", llmin), "0x8000000000000000") + test ("llmax/-1", llmax/-1, -llmax) + test ("llmax*-1", llmax*-1, -llmax) + + # the next three overflow and produce predictable, although + # wrong results + test ("llmin/-1", llmin/-1, llmin) + test ("llmin*-1", llmin*-1, llmin) + test ("llmax +1", llmax+1, llmin) + test ("llmin -1", llmin-1, llmax) + + # modulo tests + test ("llmax%1", llmax%1, 0) + test ("llmin%1", llmin%1, 0) + test ("0%1 ", 0%1, 0) + test ("0%lmax", 0%lmax, 0) + test ("1%lmax", 1%lmax, 1) + test ("0%lmin", 0%lmin, 0) + test ("1%lmin", 1%lmin, 1) + + exit() +} + +probe end { + printf ("passes: %d failures: %d\n", passes, failures) +} diff --git a/testsuite/systemtap.base/control_limits.exp b/testsuite/systemtap.base/control_limits.exp new file mode 100644 index 00000000..513b2c4d --- /dev/null +++ b/testsuite/systemtap.base/control_limits.exp @@ -0,0 +1,46 @@ +set test "control_limits MAXNESTING" +if {![installtest_p]} { untested $test; return } + +spawn stap -u -DMAXNESTING=5 $srcdir/$subdir/control_limits.stp +set ok 0 +expect { + -timeout 150 + -re {ERROR.*MAXNESTING} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } + +set test "control_limits MAXACTION" +spawn stap -u -DMAXACTION_INTERRUPTIBLE=500 $srcdir/$subdir/control_limits.stp +set ok 0 +expect { + -timeout 150 + -re {ERROR.*MAXACTION} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } + +set test "control_limits MAXSTRINGLEN small" +spawn stap -u -DMAXSTRINGLEN=50 $srcdir/$subdir/control_limits.stp +set ok 0 +expect { + -timeout 150 + -re {ERROR.*MAXSTRINGLEN reduced} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } + +set test "control_limits MAXSTRINGLEN large" +spawn stap -u -DMAXSTRINGLEN=500 $srcdir/$subdir/control_limits.stp +set ok 0 +expect { + -timeout 150 + -re {ERROR.*MAXSTRINGLEN enlarged} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } + diff --git a/testsuite/systemtap.base/control_limits.stp b/testsuite/systemtap.base/control_limits.stp new file mode 100644 index 00000000..89b0bae4 --- /dev/null +++ b/testsuite/systemtap.base/control_limits.stp @@ -0,0 +1,24 @@ + +# for MAXNESTING testing +function recurse (n) { + if (n > 0) recurse (n-1) +} +probe begin { + recurse (7) +} + +# for MAXACTION testing +probe begin { + for (i=0; i<498; i++) {} +} + +# for MAXSTRINGLEN testing +probe begin { + s = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" # last 8 will be \0'd + if (strlen(s) < 127) error ("MAXSTRINGLEN reduced") + if (strlen(s) > 127) error ("MAXSTRINGLEN enlarged") +} + + +probe begin { exit () } + diff --git a/testsuite/systemtap.base/gtod.c b/testsuite/systemtap.base/gtod.c new file mode 100644 index 00000000..abc08543 --- /dev/null +++ b/testsuite/systemtap.base/gtod.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + int i; + struct timeval tv[100][2]; + int us = 0; + if (argc == 2) us = atoi(argv[1]); + for (i=0; i<100; i++) { + gettimeofday(&tv[i][0], NULL); + setsid(); + gettimeofday(&tv[i][1], NULL); + if (us) usleep(us); + } + for (i=0; i<100; i++) { + // change last 4 chars for correctly sorting even if the + // time stamps are completely same. + printf("%8d%06d :%02d appl\n", tv[i][0].tv_sec, tv[i][0].tv_usec, i); + printf("%8d%06d :%02d prog\n", tv[i][1].tv_sec, tv[i][1].tv_usec, i); + } + return 0; +} + diff --git a/testsuite/systemtap.base/gtod.exp b/testsuite/systemtap.base/gtod.exp new file mode 100644 index 00000000..a8f3c9d6 --- /dev/null +++ b/testsuite/systemtap.base/gtod.exp @@ -0,0 +1,40 @@ +# test for checking monotonic timer (PR3916) +set test "gtod" +if {![installtest_p]} { untested $test; continue } + +set wd [pwd] +set filename "$srcdir/$subdir/gtod.c" + +target_compile $filename $wd/gtod executable "" + +# non interval (check timer drift in short range) +spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod +set ok 0 +expect { + -timeout 120 + -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +#10ms interval (check timer drift in middle range) +spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod 10000 +expect { + -timeout 120 + -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +#100ms interval (calm down processors and CPU freq might be changed) +spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod 100000 +expect { + -timeout 120 + -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +exec rm -f $wd/gtod +if {$ok == 300} { pass "$test ($ok)" } { fail "$test ($ok)" } + diff --git a/testsuite/systemtap.base/gtod.sh b/testsuite/systemtap.base/gtod.sh new file mode 100755 index 00000000..4d4a28c2 --- /dev/null +++ b/testsuite/systemtap.base/gtod.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +stap $1 -c "$2 $3" | sort + diff --git a/testsuite/systemtap.base/gtod.stp b/testsuite/systemtap.base/gtod.stp new file mode 100644 index 00000000..f252dc0a --- /dev/null +++ b/testsuite/systemtap.base/gtod.stp @@ -0,0 +1,8 @@ +global count = 0 + +probe syscall.setsid { + if (pid() == target()) { + printf("%014d :%02d kern\n", gettimeofday_us(), count); + count ++; + } +} diff --git a/testsuite/systemtap.base/system_func.exp b/testsuite/systemtap.base/system_func.exp new file mode 100644 index 00000000..ec935783 --- /dev/null +++ b/testsuite/systemtap.base/system_func.exp @@ -0,0 +1,22 @@ +set test "system_func" +if {![installtest_p]} { untested $test; return } +spawn stap $srcdir/$subdir/system_func.stp +set open 0 +set done 0 +set saw_user 0 +set user [exec whoami] +expect { + -timeout 30 + -re "($user|sys_open|DONE)\r" { + switch $expect_out(1,string) { + sys_open {incr open} + DONE {incr done} + default {incr saw_user} + } + exp_continue + } + timeout { fail "$test (timeout)" } + eof { } +} +catch {close}; wait +if {$open == 1 && $saw_user == 1 && $done == 1 } { pass "$test" } { fail "$test ($open,$saw_user,$done)" } diff --git a/testsuite/systemtap.base/system_func.stp b/testsuite/systemtap.base/system_func.stp new file mode 100644 index 00000000..d14fb25b --- /dev/null +++ b/testsuite/systemtap.base/system_func.stp @@ -0,0 +1,35 @@ +#! stap + +# test the system() function + +global saw_echo, did_cat + +probe kernel.function("sys_open") { + if (!saw_echo) { + # very inefficient. Testing only. DO NOT DO THIS + msg="echo sys_open" + system(msg) + saw_echo = 1 + } +} + +probe timer.ms(100) { + # should fail + system("cat __xyzzy123ABC__") + did_cat = 1 +} + +probe timer.ms(150) { + if (saw_echo && did_cat) + exit() +} + +probe begin { + # should succeed + system("whoami") +} + +probe end { + # should succeed + system("echo DONE") +} -- cgit From d44d3f7f73e2ef22694e9d2f6c48f77ba2204a59 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Sun, 1 Feb 2009 21:34:52 -0500 Subject: Add test for .label("label") --- testsuite/systemtap.base/labels.exp | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 testsuite/systemtap.base/labels.exp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp new file mode 100644 index 00000000..6c62d576 --- /dev/null +++ b/testsuite/systemtap.base/labels.exp @@ -0,0 +1,67 @@ +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 } + +# Compile a C program to use as the user-space probing target +set label_srcpath "[pwd]/labels.c" +set label_exepath "[pwd]/labels.x" +set label_flags "additional_flags=-g" +set fp [open $label_srcpath "w"] +puts $fp " +int +main () +{ + sleep(5); + int a = 0; + int b = 0; + char *c; +init_an_int: + a = 2; +init_another_int: + b = 3; + c = \"abc\"; +ptr_inited: + return 1; +} +" +close $fp + +set fp [open "[pwd]/labels.stp" "w"] +puts $fp " +probe process(\"labels.x\").function(\"main*@labels.c\").label(\"init_*\") {printf (\"VARS %s\\n\",\$\$vars)} +probe process(\"labels.x\").function(\"main*@labels.c\").label(\"ptr_inited\") {printf (\"VARS %s\\n\",\$\$vars)} +" +close $fp + +set ok 0 + +set res [target_compile $label_srcpath $label_exepath executable $label_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling labels.c -g" + return +} else { + pass "compiling labels.c -g" +} + +verbose -log "spawn stap -c $label_exepath [pwd]/labels.stp" +spawn stap -c $label_exepath [pwd]/labels.stp + +expect { + -timeout 180 + -re {VARS a=0x0 b=0x0.*VARS a=0x2 b=0x0.*VARS a=0x2 b=0x3 c=0x[a-f01-9]} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +wait + +if {$ok == 1} { pass "$test" } { fail "$test ($ok)" } -- cgit From 890cb11e7e87596423ec8dcc67bcb7444b6b5b90 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 9 Feb 2009 10:38:10 -0500 Subject: Move poll_map.exp and poll_map.stp to systemtap.base directory. --- testsuite/systemtap.base/poll_map.exp | 14 ++++++++++++++ testsuite/systemtap.base/poll_map.stp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 testsuite/systemtap.base/poll_map.exp create mode 100755 testsuite/systemtap.base/poll_map.stp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/poll_map.exp b/testsuite/systemtap.base/poll_map.exp new file mode 100644 index 00000000..5ade48e6 --- /dev/null +++ b/testsuite/systemtap.base/poll_map.exp @@ -0,0 +1,14 @@ +set test "poll_map" +if {![installtest_p]} { untested $test; return } + +spawn stap -g $srcdir/$subdir/poll_map.stp +set ok 0 +expect { + -timeout 400 + -ex "SUCCESS" { incr ok } + timeout { fail "$test (timeout)" } + eof { } +} +close +wait +if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.base/poll_map.stp b/testsuite/systemtap.base/poll_map.stp new file mode 100755 index 00000000..cd39b433 --- /dev/null +++ b/testsuite/systemtap.base/poll_map.stp @@ -0,0 +1,33 @@ +#! stap + +# test that polling loops do not exit when conflicts happen +# see PR 1379 + +global called, num_polls + +probe kernel.function( "sys_*" ).call { + called[execname(),probefunc()]++ +} + +probe timer.ms(1000) +{ + print("\n\n") + num_to_do = 10 + foreach ([n,f] in called-) { + printf("%s called %s\t%d times\n", n, f, called[n,f]) + num_to_do-- + if (num_to_do <= 0) + break + } + delete called + num_polls++ + if (num_polls > 30) + exit() +} + +probe end { + if (num_polls <= 30) + print ("FAIL\n") + else + print ("SUCCESS\n") +} -- cgit From a70a69bd47f2b0c7e8e4e99b7a630ebbedc5f264 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 10 Feb 2009 16:18:29 -0500 Subject: Move crash.exp and crash.sh to systemtap.base directory. --- testsuite/systemtap.base/crash.exp | 45 ++++++++++++++++++++++++++++++++++++++ testsuite/systemtap.base/crash.sh | 8 +++++++ 2 files changed, 53 insertions(+) create mode 100644 testsuite/systemtap.base/crash.exp create mode 100755 testsuite/systemtap.base/crash.sh (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/crash.exp b/testsuite/systemtap.base/crash.exp new file mode 100644 index 00000000..9c3e5e05 --- /dev/null +++ b/testsuite/systemtap.base/crash.exp @@ -0,0 +1,45 @@ +# Simple test for staplog.so crash(8) extension +set test "crash" + +if {![installtest_p]} { untested $test; return } +if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return } + +# Load a test script +spawn stap $srcdir/$subdir/testlog.stp -m testlog +expect { + -timeout 120 + "HelloWorld\r\n" { + pass "$test - testlog.stp" + # Need to run crash(8) while this script is still running. + # Since crash(8) needs /dev/mem access, need it run as_root too. + # This [ eval ... \{ \} ] business is necessary because as_root + # evals the given list/variables in its own scope. + eval as_root \{ $srcdir/$subdir/crash.sh $env(CRASH_LIBDIR) \} + } + timeout { fail "$test - testlog.stp timeout" } + timeout { fail "$test - testlog.stp eof" } +} +catch { exec kill -INT -[exp_pid]; close ; wait } + +# The crash(8) script creates testlog/global or testlog/cpu +as_root { chmod -R a+rX testlog } + +set ok 0 +foreach f [glob -nocomplain testlog/*] { + pass "$test - crash(8) generated $f" + set fp [open $f] + set chars [read $fp] + close $fp + if [string match "HelloWorld*" $chars] { + incr ok + pass "$test - crash(8) data" + } else { + fail "$test - crash(8) data $chars" + } +} +if {$ok == 0} { + fail "$test - crash(8) data" +} + +as_root { rm -rf testlog testlog.ko } + diff --git a/testsuite/systemtap.base/crash.sh b/testsuite/systemtap.base/crash.sh new file mode 100755 index 00000000..06aa414e --- /dev/null +++ b/testsuite/systemtap.base/crash.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +crash --readnow << END +mod -s testlog testlog.ko +extend $1/staplog.so +staplog testlog +exit +END -- cgit From 7b534f489ed3567d8a59e00eb4ba954697a97059 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Sun, 15 Feb 2009 22:23:54 -0500 Subject: Handle c++ static user probes via .probe, c via .label. --- testsuite/systemtap.base/static_uprobes.exp | 114 ++++++++++------------------ 1 file changed, 40 insertions(+), 74 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index eb0d1c6e..34e230ac 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,21 +1,17 @@ + set test "sduprobes" if {![installtest_p]} {untested $test; return} # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" set sup_exepath "[pwd]/static_uprobes.x" -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-L$env(CRASH_LIBDIR) additional_flags=-lsduprobes" set fp [open $sup_srcpath "w"] puts $fp " #include #define USE_STAP_PROBE 1 #include \"static_uprobes.h\" -foo () -{ - STAP_PROBE(static_uprobes,test_probe_1); -} - +void bar (int i) { if (i == 0) @@ -23,6 +19,7 @@ bar (int i) STAP_PROBE1(static_uprobes,test_probe_2,i); } +void baz (int i, char* s) { STAP_PROBE1(static_uprobes,test_probe_0,i); @@ -31,51 +28,24 @@ baz (int i, char* s) STATIC_UPROBES_TEST_PROBE_3(i,s); } +void buz (int parm) { + if (parm == 0) + parm = 1000; + DTRACE_PROBE1(static_uprobes,test_probe_4,parm); } +int main () { - sleep(5); - foo(); bar(2); - baz(3,\"abc\"); + baz(3,(char*)\"abc\"); buz(4); } " close $fp -# set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] -# if { $res != "" } { -# verbose "target_compile failed: $res" 2 -# fail "compiling static_uprobes.c" -# return -# } else { -# pass "compiling static_uprobes.c" -# } - -set fp [open "[pwd]/static_uprobes.stp" "w"] -puts $fp " -probe process(\"static_uprobes.x\").mark(\"test_probe_0\") -{ - printf(\"In test_probe_0 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_1\") -{ - printf(\"In test_probe_1 probe\\n\") -} -probe process(\"static_uprobes.x\").mark(\"test_probe_2\") -{ - printf(\"In test_probe_2 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_3\") -{ - printf(\"In test_probe_3 probe %#x %#x\\n\", \$arg1, \$arg2) -} -" -close $fp - # Try to find utrace_attach symbol in /proc/kallsyms # copy from utrace_p5.exp set utrace_support_found 0 @@ -86,36 +56,6 @@ if {! [catch {exec grep -q utrace_attach $path} dummy]} { if {$utrace_support_found == 0} { untested "$test"; return } set ok 0 -# verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -# spawn stap -c $sup_exepath [pwd]/static_uprobes.stp -# expect { -# -timeout 180 -# -re {In test_probe_1 probe} { incr ok; exp_continue } -# -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } -# -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } -# -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } -# timeout { fail "$test (timeout)" } -# eof { } -# } - -# if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -set ok 0 - -# Now do a debuginfo style probe of the above test - -set fp [open "[pwd]/static_uprobes.sh" "w"] -puts $fp " -ed $sup_srcpath < Date: Mon, 16 Feb 2009 14:58:40 -0600 Subject: Improved cleanup in tests. --- testsuite/systemtap.base/bz5274.exp | 13 ++++++-- testsuite/systemtap.base/bz6850.exp | 13 ++++++-- testsuite/systemtap.base/static_uprobes.exp | 47 ++++++++++++++++++++--------- testsuite/systemtap.base/uprobes.exp | 14 +++++++-- 4 files changed, 65 insertions(+), 22 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index db0e0a46..92441e9e 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -8,11 +8,14 @@ if {$arch == "ppc64"} { catch {exec gcc -o $test -g $srcdir/$subdir/$test.c} err } - if {$err == "" && [file exists $test]} then { pass "$test compile" } else {fail "$test compile"} -if {! [installtest_p]} { untested "$test -p5"; return } +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Try to find utrace_attach symbol in /proc/kallsyms # copy from utrace_p5.exp @@ -21,7 +24,11 @@ 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 -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p5" + return +} if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} { untested "$test longjmp to a uretprobed function" diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp index 73fedc8a..b96ed95c 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -10,12 +10,21 @@ 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 -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p4" + untested "$test -p5" + return +} set rc [stap_run_batch $srcdir/$subdir/bz6850.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; return } +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 34e230ac..d86fef85 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -53,11 +53,16 @@ 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_support_found == 0} { + untested "$test" + catch {exec rm -f $sup_srcpath} + return +} set ok 0 -set fp [open "[pwd]/static_uprobes.stp" "w"] +set sup_stppath "[pwd]/static_uprobes.stp" +set fp [open $sup_stppath "w"] puts $fp " probe process(\"static_uprobes.x\").mark(\"test_probe_0\") { @@ -78,7 +83,9 @@ probe process(\"static_uprobes.x\").mark(\"test_probe_4\") " close $fp -set fp [open "[pwd]/static_uprobes.d" "w"] +set sup_dpath "[pwd]/static_uprobes.d" +set sup_hpath "[pwd]/static_uprobes.h" +set fp [open $sup_dpath "w"] puts $fp " provider static_uprobes { probe test_probe_1 (); @@ -88,20 +95,30 @@ provider static_uprobes { }; " close $fp -spawn dtrace -h -s [pwd]/static_uprobes.d +exec dtrace -h -s $sup_dpath +if {[file exists $sup_hpath]} then { + pass "generating $sup_hpath" +} else { + fail "generating $sup_hpath" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + return +} + +catch {exec rm -f $sup_dpath} set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=-I." set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling sduprobes.c -g" + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} return } else { - pass "compiling sduprobes.c -g" + pass "compiling $sup_srcpath -g" } -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath expect { -timeout 180 -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } @@ -117,20 +134,22 @@ wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" +set sup_srcpath "[pwd]/static_uprobes.cc" set sup_flags "$sup_flags c++" -set res [target_compile "[pwd]/static_uprobes.cc" $sup_exepath executable $sup_flags] +set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling sduprobes.c -g" + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} return } else { - pass "compiling sduprobes.c -g" + pass "compiling $sup_srcpath -g" } set ok 0 -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath expect { -timeout 180 -re {In test_probe_1 probe} { incr ok; exp_continue } @@ -145,4 +164,4 @@ expect { wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } - +catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index e8318586..89250e7b 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -25,12 +25,20 @@ 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 -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + untested "$test -p4"; untested "$test -p5" + catch {exec rm -f jennie.c jennie} + return +} set rc [stap_run_batch $srcdir/$subdir/uprobes.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; exec rm -f jennie.c jennie; return } +if {! [installtest_p]} { + untested "$test -p5"; + catch {exec rm -f jennie.c jennie} + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] @@ -46,4 +54,4 @@ expect { if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" } catch {wait; close} -exec rm -f jennie.c jennie +catch {exec rm -f jennie.c jennie} -- cgit From 818ba2bc05fc60bf33179e2be44c6745eb181a01 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 17 Feb 2009 16:49:12 +0100 Subject: Move sdt.h to includes/sys and use in tests. --- testsuite/systemtap.base/static_uprobes.exp | 63 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index d86fef85..95a36384 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,6 +1,5 @@ set test "sduprobes" -if {![installtest_p]} {untested $test; return} # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" @@ -46,21 +45,6 @@ main () " close $fp -# 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" - catch {exec rm -f $sup_srcpath} - return -} - -set ok 0 - set sup_stppath "[pwd]/static_uprobes.stp" set fp [open $sup_stppath "w"] puts $fp " @@ -95,7 +79,7 @@ provider static_uprobes { }; " close $fp -exec dtrace -h -s $sup_dpath +exec $env(SYSTEMTAP_PATH)/dtrace -h -s $sup_dpath if {[file exists $sup_hpath]} then { pass "generating $sup_hpath" } else { @@ -106,7 +90,7 @@ if {[file exists $sup_hpath]} then { catch {exec rm -f $sup_dpath} -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=-I." +set sup_flags "additional_flags=-I$env(SYSTEMTAP_INCLUDES) additional_flags=-g additional_flags=-O additional_flags=-I." set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -117,6 +101,36 @@ if { $res != "" } { pass "compiling $sup_srcpath -g" } +spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" +set sup_srcpath "[pwd]/static_uprobes.cc" +set sup_flags "$sup_flags c++" +set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} + return +} else { + pass "compiling $sup_srcpath -g" +} + +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" + catch {exec rm -f $sup_srcpath} + return +} + +set ok 0 + verbose -log "spawn stap -c $sup_exepath $sup_stppath" spawn stap -c $sup_exepath $sup_stppath expect { @@ -133,19 +147,6 @@ wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" -set sup_srcpath "[pwd]/static_uprobes.cc" -set sup_flags "$sup_flags c++" -set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] -if { $res != "" } { - verbose "target_compile failed: $res" 2 - fail "compiling $sup_srcpath -g" - catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} - return -} else { - pass "compiling $sup_srcpath -g" -} - set ok 0 verbose -log "spawn stap -c $sup_exepath $sup_stppath" -- cgit From c14341d2b7f06e6e95bb24cd4cad28ea1862dc16 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 17 Feb 2009 14:19:53 -0500 Subject: fix sdt.h test case for $srcdir != $builddir --- testsuite/systemtap.base/static_uprobes.exp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 95a36384..6c0f83a8 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -79,7 +79,12 @@ provider static_uprobes { }; " close $fp -exec $env(SYSTEMTAP_PATH)/dtrace -h -s $sup_dpath +if {[installtest_p]} { + set dtrace $env(SYSTEMTAP_PATH)/dtrace +} else { + set dtrace $srcdir/../dtrace +} +exec $dtrace -h -s $sup_dpath if {[file exists $sup_hpath]} then { pass "generating $sup_hpath" } else { @@ -90,7 +95,13 @@ if {[file exists $sup_hpath]} then { catch {exec rm -f $sup_dpath} -set sup_flags "additional_flags=-I$env(SYSTEMTAP_INCLUDES) additional_flags=-g additional_flags=-O additional_flags=-I." +if {[installtest_p]} { + set sdtdir $env(SYSTEMTAP_INCLUDES) +} else { + set sdtdir $srcdir/../includes +} + +set sup_flags "additional_flags=-I$sdtdir additional_flags=-g additional_flags=-O additional_flags=-I." set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 -- cgit From fed285ce2dbd2f5fc38a80771216247ca4e26227 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Feb 2009 14:34:46 -0600 Subject: Better testcase cleanup. 2009-02-18 David Smith * systemtap.base/labels.exp: Better cleanup. --- testsuite/systemtap.base/labels.exp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 6c62d576..9c92d69c 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -34,7 +34,8 @@ ptr_inited: " close $fp -set fp [open "[pwd]/labels.stp" "w"] +set label_stppath "[pwd]/labels.stp" +set fp [open $label_stppath "w"] puts $fp " probe process(\"labels.x\").function(\"main*@labels.c\").label(\"init_*\") {printf (\"VARS %s\\n\",\$\$vars)} probe process(\"labels.x\").function(\"main*@labels.c\").label(\"ptr_inited\") {printf (\"VARS %s\\n\",\$\$vars)} @@ -47,13 +48,14 @@ set res [target_compile $label_srcpath $label_exepath executable $label_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 fail "compiling labels.c -g" + catch {exec rm -f $label_srcpath $label_stppath} return } else { pass "compiling labels.c -g" } -verbose -log "spawn stap -c $label_exepath [pwd]/labels.stp" -spawn stap -c $label_exepath [pwd]/labels.stp +verbose -log "spawn stap -c $label_exepath $label_stppath" +spawn stap -c $label_exepath $label_stppath expect { -timeout 180 @@ -65,3 +67,4 @@ expect { wait if {$ok == 1} { pass "$test" } { fail "$test ($ok)" } +catch {exec rm -f $label_srcpath $label_stppath $label_exepath} -- cgit From 9b9b56ea063b6eea422a6d772bd49469e3eec649 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Feb 2009 15:35:53 -0600 Subject: Handles errors better. 2009-02-18 David Smith * systemtap.base/static_uprobes.exp: Handles errors from running 'dtrace' python script better. --- testsuite/systemtap.base/static_uprobes.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 6c0f83a8..64cb6434 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -84,7 +84,9 @@ if {[installtest_p]} { } else { set dtrace $srcdir/../dtrace } -exec $dtrace -h -s $sup_dpath +if {[catch {exec $dtrace -h -s $sup_dpath} res]} { + verbose -log "unable to run $dtrace: $res" +} if {[file exists $sup_hpath]} then { pass "generating $sup_hpath" } else { -- cgit From 59b2ec52534f90cf22a741cfb482b36f9dcb6a78 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Wed, 18 Feb 2009 18:00:42 -0500 Subject: Always emit .probes section; use .label method as a backup strategy --- testsuite/systemtap.base/static_uprobes.exp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 64cb6434..d80bd0c4 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -4,6 +4,7 @@ set test "sduprobes" # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" set sup_exepath "[pwd]/static_uprobes.x" +set supcplus_exepath "[pwd]/static_uprobes_cplus.x" set fp [open $sup_srcpath "w"] puts $fp " #include @@ -117,7 +118,7 @@ if { $res != "" } { spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" set sup_srcpath "[pwd]/static_uprobes.cc" set sup_flags "$sup_flags c++" -set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] +set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 fail "compiling $sup_srcpath -g" @@ -162,6 +163,7 @@ if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } set ok 0 +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 { @@ -178,4 +180,4 @@ expect { wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} +catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} -- cgit From 4c2d0ab0b24baeb500b68cadcf4063eb324c0a27 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 19 Feb 2009 21:57:12 -0500 Subject: static_uprobes test case cleanup --- testsuite/systemtap.base/static_uprobes.exp | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index d80bd0c4..11fec9b1 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -89,9 +89,9 @@ if {[catch {exec $dtrace -h -s $sup_dpath} res]} { verbose -log "unable to run $dtrace: $res" } if {[file exists $sup_hpath]} then { - pass "generating $sup_hpath" + pass "$test generating header" } else { - fail "generating $sup_hpath" + fail "$test generating header" catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} return } @@ -108,11 +108,11 @@ set sup_flags "additional_flags=-I$sdtdir additional_flags=-g additional_flags=- set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $sup_srcpath -g" + fail "$test compiling C -g" catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} return } else { - pass "compiling $sup_srcpath -g" + pass "$test compiling C -g" } spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" @@ -121,11 +121,11 @@ set sup_flags "$sup_flags c++" set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $sup_srcpath -g" + fail "$test compiling C++ -g" catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} return } else { - pass "compiling $sup_srcpath -g" + pass "$test compiling C++ -g" } if {![installtest_p]} {untested $test; return} @@ -153,17 +153,19 @@ expect { -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } -re {In test_probe_4 dtrace probe 0x4} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } + timeout { fail "$test C (timeout)" } eof { } } wait -if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } +if {$ok == 4} { pass "$test C" } { fail "$test C ($ok)" } set ok 0 -spawn objcopy -R .probes $supcplus_exepath $sup_exepath +# spawn objcopy -R .probes $supcplus_exepath $sup_exepath +verbose -log "cp $supcplus_exepath $sup_exepath" +spawn cp $supcplus_exepath $sup_exepath verbose -log "spawn stap -c $sup_exepath $sup_stppath" spawn stap -c $sup_exepath $sup_stppath expect { @@ -173,11 +175,15 @@ expect { -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } -re {In test_probe_4 dtrace probe 0x4} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } + timeout { fail "$test C++ (timeout)" } eof { } } wait -if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} +if {$ok == 4} { pass "$test C++" } { fail "$test C++ ($ok)" } + +# catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} + +# It's not so important to clean up, and it's unhelpful if +# one needs to diagnose a test failure. \ No newline at end of file -- cgit