From a972819ab1954fe33500079d19dcb29c786a1976 Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 20 Feb 2009 11:09:13 -0600 Subject: Better testcase cleanup. 2009-02-20 David Smith * systemtap.base/cache.exp (stap_compile): Better cleanup. * static_uprobes.exp: Ditto. --- testsuite/systemtap.base/cache.exp | 1 + testsuite/systemtap.base/static_uprobes.exp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/cache.exp b/testsuite/systemtap.base/cache.exp index 390af054..b10a4f28 100644 --- a/testsuite/systemtap.base/cache.exp +++ b/testsuite/systemtap.base/cache.exp @@ -116,6 +116,7 @@ set env(SYSTEMTAP_DIR) /dev/null stap_compile DISABLED1 [F_UNCACHED_COMPILE] $basic_script1 stap_compile DISABLED2 [F_UNCACHED_COMPILE] $basic_script1 set env(SYSTEMTAP_DIR) $local_systemtap_dir +eval [list exec /bin/rm -f] [glob "stap_*.ko"] # Disable the cache with '-m' stap_compile MODNAM1 [F_UNCACHED_COMPILE] $basic_script1 -m modnam diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 11fec9b1..c76d4805 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -88,6 +88,7 @@ if {[installtest_p]} { if {[catch {exec $dtrace -h -s $sup_dpath} res]} { verbose -log "unable to run $dtrace: $res" } +catch {exec rm -f $sup_dpath} if {[file exists $sup_hpath]} then { pass "$test generating header" } else { @@ -96,8 +97,6 @@ if {[file exists $sup_hpath]} then { return } -catch {exec rm -f $sup_dpath} - if {[installtest_p]} { set sdtdir $env(SYSTEMTAP_INCLUDES) } else { @@ -186,4 +185,4 @@ 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 +# one needs to diagnose a test failure. -- cgit From 9e67aff9f4c269e0a56524c3f2fafaf8e038bda7 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 23 Feb 2009 17:14:52 -0500 Subject: Improve static probe: c++ navigation, -l output. * tapsets.cxx (dwflpp::build): Improve c+ method navigation. Use .label for listing mode. * systemtap.base/static_uprobes.exp: Test multiple invocations of the same probe per block. (SW9770) --- testsuite/systemtap.base/static_uprobes.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index c76d4805..a4bd5e2c 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -14,6 +14,7 @@ puts $fp " void bar (int i) { + STATIC_UPROBES_TEST_PROBE_2(i); if (i == 0) i = 1000; STAP_PROBE1(static_uprobes,test_probe_2,i); @@ -158,7 +159,7 @@ expect { wait -if {$ok == 4} { pass "$test C" } { fail "$test C ($ok)" } +if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" } set ok 0 @@ -169,7 +170,6 @@ 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 } -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 } @@ -180,7 +180,7 @@ expect { wait -if {$ok == 4} { pass "$test C++" } { fail "$test C++ ($ok)" } +if {$ok == 5} { pass "$test C++" } { fail "$test C++ ($ok)" } # catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} -- cgit From bf2a0399419306bf26cd57236822c51be893dfb0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 23 Feb 2009 15:08:02 -0800 Subject: Add a testcase for gtod init/kill This test simply checks that _gettimeofday_init and _gettimeofday_kill are pulled in when gettimeofday is used, and also that they are NOT pulled in when gettimeofday is not used. --- testsuite/systemtap.base/gtod_init.exp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 testsuite/systemtap.base/gtod_init.exp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/gtod_init.exp b/testsuite/systemtap.base/gtod_init.exp new file mode 100644 index 00000000..48616b1f --- /dev/null +++ b/testsuite/systemtap.base/gtod_init.exp @@ -0,0 +1,29 @@ +# test for checking initialization of the time subsystem +set test "gtod_init" + +# check that init and kill are both present with a gettimeofday +set time_init 0 +set time_kill 0 +spawn stap -p2 -e {probe begin { println(gettimeofday_s()) }} +expect { + -timeout 120 + -re {\n_gettimeofday_init:} { incr time_init; exp_continue } + -re {\n_gettimeofday_kill:} { incr time_kill; exp_continue } + timeout { fail "$test (timeout)" } + eof { + if {$time_init == 1} { pass "$test (init)" } { fail "$test (init $time_init)" } + if {$time_kill == 1} { pass "$test (kill)" } { fail "$test (kill $time_kill)" } + } +} +wait + +# check that init and kill are both NOT present without a gettimeofday +spawn stap -p2 -e {probe begin { println(get_cycles()) }} +expect { + -timeout 120 + -re {\n_gettimeofday_init:} { fail "$test (bad init)" } + -re {\n_gettimeofday_kill:} { fail "$test (bad kill)" } + timeout { fail "$test (timeout)" } + eof { pass "$test (no init/kill)" } +} +wait -- cgit From cd1db1dd034141535648a66d9896db6c5e74dd9e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 4 Mar 2009 11:55:56 +0100 Subject: PR9919: Set last_stmt for array (scalar or statistical) assignments. * translate.cxx (visit_arrayindex): Update last_stmt. --- testsuite/systemtap.base/overflow_error.exp | 32 +++++++++++++++++++++++++++++ testsuite/systemtap.base/overflow_error.stp | 22 ++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 testsuite/systemtap.base/overflow_error.exp create mode 100644 testsuite/systemtap.base/overflow_error.stp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/overflow_error.exp b/testsuite/systemtap.base/overflow_error.exp new file mode 100644 index 00000000..33be90a7 --- /dev/null +++ b/testsuite/systemtap.base/overflow_error.exp @@ -0,0 +1,32 @@ +# Test overflow errors point to the correct thing. + +set test "overflow_error" +if {![installtest_p]} { untested $test; return } + +set error_msg1 "ERROR: Array overflow, check size limit (3) near identifier 'overflow1' at $srcdir/$subdir/$test.stp" +set error_msg2 "ERROR: Array overflow, check size limit (5) near identifier 'overflow2' at $srcdir/$subdir/$test.stp" +set exit_warning "WARNING: Number of errors: 2, skipped probes: 0" + +set pass 0 + +spawn stap -DMAXERRORS=1 $srcdir/$subdir/$test.stp +expect { + $error_msg1 {incr pass; exp_continue} + $error_msg2 {incr pass; exp_continue} + $exit_warning {incr pass; exp_continue} + timeout { + exec kill -INT -[exp_pid] + fail "$test timed out" + } + eof {} +} +catch { close } +wait + +if {$pass == 3} { + pass $test +} else { + fail "$test ($pass)" +} + + diff --git a/testsuite/systemtap.base/overflow_error.stp b/testsuite/systemtap.base/overflow_error.stp new file mode 100644 index 00000000..f5a3e917 --- /dev/null +++ b/testsuite/systemtap.base/overflow_error.stp @@ -0,0 +1,22 @@ +# overflow some stuff to see if error message point to the correct thing. +global count; +global overflow1[3]; +global overflow2[5]; + +probe timer.ms(10) +{ + if (count <= 3) + { + overflow1[count++] = gettimeofday_ns(); + } + else + { + overflow2[count++] <<< gettimeofday_ns(); + } +} + +probe timer.s(3) +{ + exit(); +} + -- cgit From 9b692b91ee25c33281c32c7ba86f5f0734e46be9 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Sun, 8 Mar 2009 19:55:05 -0400 Subject: Fix and add tests for function(".so").statement(N) * tapsets.cxx (query_dwarf_func): die_has_pc (dwarf_haspc) does not expect a module_start for shared objects so don't call module_address_to_global for the statement address. * testsuite/systemtap.base/labels.exp: Add tests for executable .statement(N), shared object .label("L") and so .statement(N). --- testsuite/systemtap.base/labels.exp | 86 +++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 9c92d69c..54640268 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -13,6 +13,7 @@ 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_sopath "[pwd]/labels.so" set label_flags "additional_flags=-g" set fp [open $label_srcpath "w"] puts $fp " @@ -54,9 +55,12 @@ if { $res != "" } { pass "compiling labels.c -g" } +# label in an executable + verbose -log "spawn stap -c $label_exepath $label_stppath" spawn stap -c $label_exepath $label_stppath +wait 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 } @@ -64,7 +68,83 @@ expect { eof { } } -wait +if {$ok == 1} { pass "$test exe .label" } { fail "$test exe .label" } + +# address of label in an executable + +set label_shpath "[pwd]/label.sh" +set fp [open $label_shpath "w"] +puts $fp " +readelf --debug-dump $label_exepath | awk \" +/init_another_int/ {have_label=1} +/DW_AT_low_pc/ {if (have_label) {print \$3;exit;}} +\" +" +close $fp +spawn sh $label_shpath +expect { + -re {0x[0-9a-f]*} +} +set ok 0 +spawn stap -p2 -l "process\(\"$label_exepath\"\).statement($expect_out(0,string))" +expect { + -timeout 180 + -re {no match} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if {$ok == 0} { pass "$test exe .statement" } { xfail "$test exe .statement" } + +set ok 0 + +set label_flags "additional_flags=-g additional_flags=-shared additional_flags=-fPIC" +set res [target_compile $label_srcpath $label_sopath 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" +} + +# label in a shared object + +spawn stap -p2 -l "process\(\"$label_sopath\"\).function\(\"\*\"\).label\(\"init_another_int\"\)" +expect { + -timeout 180 + -re {process.*function} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if {$ok == 1} { pass "$test so .label" } { fail "$test so .label" } + +# address of label in a shared object + +set label_shpath "[pwd]/label.sh" +set fp [open $label_shpath "w"] +puts $fp " +readelf --debug-dump $label_sopath | awk \" +/init_another_int/ {have_label=1} +/DW_AT_low_pc/ {if (have_label) {print \$3;exit;}} +\" +" +close $fp +spawn sh $label_shpath +expect { + -re {0x[0-9a-f]*} +} +set ok 0 +spawn stap -p2 -l "process\(\"$label_sopath\"\).statement($expect_out(0,string))" +expect { + -timeout 180 + -re {no match} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if {$ok == 0} { pass "$test so .statement" } { xfail "$test so .statement" } -if {$ok == 1} { pass "$test" } { fail "$test ($ok)" } -catch {exec rm -f $label_srcpath $label_stppath $label_exepath} +# catch {exec rm -f $label_srcpath $label_stppath $label_exepath} -- cgit From 4be9af07213db548443da4ae7ed365e98ed2b29c Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Sun, 8 Mar 2009 20:17:10 -0400 Subject: Minor changes to labels.exp. --- testsuite/systemtap.base/labels.exp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 54640268..1b538dbb 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -85,16 +85,16 @@ spawn sh $label_shpath expect { -re {0x[0-9a-f]*} } -set ok 0 +set nomatch 0 spawn stap -p2 -l "process\(\"$label_exepath\"\).statement($expect_out(0,string))" expect { -timeout 180 - -re {no match} { incr ok; exp_continue } + -re {semantic error: no match} { incr nomatch; exp_continue } timeout { fail "$test (timeout)" } eof { } } -if {$ok == 0} { pass "$test exe .statement" } { xfail "$test exe .statement" } +if {$nomatch == 0} { pass "$test exe .statement" } { fail "$test exe .statement" } set ok 0 @@ -136,15 +136,15 @@ spawn sh $label_shpath expect { -re {0x[0-9a-f]*} } -set ok 0 +set nomatch 0 spawn stap -p2 -l "process\(\"$label_sopath\"\).statement($expect_out(0,string))" expect { -timeout 180 - -re {no match} { incr ok; exp_continue } + -re {semantic error: no match} { incr nomatch; exp_continue } timeout { fail "$test (timeout)" } eof { } } -if {$ok == 0} { pass "$test so .statement" } { xfail "$test so .statement" } +if {$nomatch == 0} { pass "$test so .statement" } { fail "$test so .statement" } # catch {exec rm -f $label_srcpath $label_stppath $label_exepath} -- cgit From 1d4cb9b5f957bd3825fd1f0cfa1df1c24a07164d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 8 Mar 2009 23:23:35 +0100 Subject: Make stap_run2 count exact number of lines. * testsuite/lib/stap_run2.exp: Compare found and expected number of lines. * testsuite/systemtap.*/*.exp (result_string): Make number of lines exact. --- testsuite/systemtap.base/ctime.exp | 3 +-- testsuite/systemtap.base/limits.exp | 3 +-- testsuite/systemtap.base/stmt_rel.exp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/ctime.exp b/testsuite/systemtap.base/ctime.exp index f6db096a..d5ae07d5 100644 --- a/testsuite/systemtap.base/ctime.exp +++ b/testsuite/systemtap.base/ctime.exp @@ -13,6 +13,5 @@ a long, long time ago... Tue Jan 19 03:14:07 2038 far far in the future... a long, long time ago... -far far in the future... -} +far far in the future...} stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.base/limits.exp b/testsuite/systemtap.base/limits.exp index c5328e8f..c04d507d 100644 --- a/testsuite/systemtap.base/limits.exp +++ b/testsuite/systemtap.base/limits.exp @@ -32,7 +32,6 @@ Minimum signed 64-bit number -9223372036854775808 0x8000000000000000 -9223372036854775808 0x8000000000000000 -9223372036854775808 0x8000000000000000 --9223372036854775808 0x8000000000000000 -} +-9223372036854775808 0x8000000000000000} stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.base/stmt_rel.exp b/testsuite/systemtap.base/stmt_rel.exp index 25156d9b..be51fef9 100644 --- a/testsuite/systemtap.base/stmt_rel.exp +++ b/testsuite/systemtap.base/stmt_rel.exp @@ -3,7 +3,6 @@ set test "stmt_rel" set ::result_string {PASS bio_init PASS line number -PASS wildcard -} +PASS wildcard} stap_run2 $srcdir/$subdir/$test.stp -- cgit From c18b2f69080486db2b2591308ace672bdb1fe123 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Mar 2009 11:03:55 +0100 Subject: Add new sdt.exp testcase. * testsuite/systemtap.base/sdt.exp: New test file. * testsuite/systemtap.base/sdt.stp: Likewise. * testsuite/systemtap.base/sdt.c: Likewise. --- testsuite/systemtap.base/sdt.c | 69 ++++++++++++++++++++++++++++++++++++++++ testsuite/systemtap.base/sdt.exp | 36 +++++++++++++++++++++ testsuite/systemtap.base/sdt.stp | 49 ++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 testsuite/systemtap.base/sdt.c create mode 100644 testsuite/systemtap.base/sdt.exp create mode 100644 testsuite/systemtap.base/sdt.stp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.c b/testsuite/systemtap.base/sdt.c new file mode 100644 index 00000000..46f68664 --- /dev/null +++ b/testsuite/systemtap.base/sdt.c @@ -0,0 +1,69 @@ +#include "sdt.h" /* Really , but pick current source version. */ + +static void call1(int a) +{ + STAP_PROBE1(test, mark_a, a); +} + +static void call2(int a, int b) +{ + STAP_PROBE2(test, mark_b, a, b); +} + +static void call3(int a, int b, int c) +{ + STAP_PROBE3(test, mark_c, a, b, c); +} + +static void call4(int a, int b, int c, int d) +{ + STAP_PROBE4(test, mark_d, a, b, c, d); +} + +static void call5(int a, int b, int c, int d, int e) +{ + STAP_PROBE5(test, mark_e, a, b, c, d, e); +} + +static void call6(int a, int b, int c, int d, int e, int f) +{ + STAP_PROBE6(test, mark_f, a, b, c, d, e, f); +} + +static void call7(int a, int b, int c, int d, int e, int f, int g) +{ + STAP_PROBE7(test, mark_g, a, b, c, d, e, f, g); +} + +static void call8(int a, int b, int c, int d, int e, int f, int g, int h) +{ + STAP_PROBE8(test, mark_h, a, b, c, d, e, f, g, h); +} + +static void call9(int a, int b, int c, int d, int e, int f, int g, int h, int i) +{ + STAP_PROBE9(test, mark_i, a, b, c, d, e, f, g, h, i); +} + +static void call10(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) +{ + STAP_PROBE10(test, mark_j, a, b, c, d, e, f, g, h, i, j); +} + +int +main (int argc, char **argv) +{ + int a, b, c, d, e, f, g, h, i, j; + a = 1; b = 2; c = 3; d = 4; e = 5; f = 6; g = 7; h = 8; i = 9; j = 10; + call1(a); + call2(a, b); + call3(a, b, c); + call4(a, b, c, d); + call5(a, b, c, d, e); + call6(a, b, c, d, e, f); + call7(a, b, c, d, e, f, g); + 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); + return 0; +} diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp new file mode 100644 index 00000000..ce6b9a71 --- /dev/null +++ b/testsuite/systemtap.base/sdt.exp @@ -0,0 +1,36 @@ +set test "sdt" +set ::result_string {1 +1 2 +1 2 3 +1 2 3 4 +1 2 3 4 5 +1 2 3 4 5 6 +1 2 3 4 5 6 7 +1 2 3 4 5 6 7 8 +1 2 3 4 5 6 7 8 9 +1 2 3 4 5 6 7 8 9 10} + +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=-Werror" +set res [target_compile $srcdir/$subdir/$test.c $test.prog executable $test_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling $test.c" + return +} else { + pass "compiling $test.c" +} + +# Currently fails for any mark probe with more than 4 arguments. +# FIXME - PR s/false/{![installtest_p]/ +if (0) { + stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog +} else { + untested "$test" +} + +catch {exec rm -f $test.prog} diff --git a/testsuite/systemtap.base/sdt.stp b/testsuite/systemtap.base/sdt.stp new file mode 100644 index 00000000..d2deb557 --- /dev/null +++ b/testsuite/systemtap.base/sdt.stp @@ -0,0 +1,49 @@ +probe process("sdt.prog").mark("mark_a") +{ + printf("%d\n", $arg1); +} + +probe process("sdt.prog").mark("mark_b") +{ + printf("%d %d\n", $arg1, $arg2); +} + +probe process("sdt.prog").mark("mark_c") +{ + printf("%d %d %d\n", $arg1, $arg2, $arg3); +} + +probe process("sdt.prog").mark("mark_d") +{ + printf("%d %d %d %d\n", $arg1, $arg2, $arg3, $arg4); +} + +probe process("sdt.prog").mark("mark_e") +{ + printf("%d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5); +} + +probe process("sdt.prog").mark("mark_f") +{ + printf("%d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6); +} + +probe process("sdt.prog").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") +{ + 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") +{ + 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") +{ + printf("%d %d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8, arg9, arg10); +} -- cgit From df5d1ba4cd009ba39f1bbe9466ae0f1a4e250a67 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Mar 2009 12:55:46 +0100 Subject: Add PR9935 number to sdt.exp disabled test. --- testsuite/systemtap.base/sdt.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index ce6b9a71..71fe9dac 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -26,7 +26,7 @@ if { $res != "" } { } # Currently fails for any mark probe with more than 4 arguments. -# FIXME - PR s/false/{![installtest_p]/ +# FIXME - PR9935 s/(0)/{![installtest_p]}/ if (0) { stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog } else { -- cgit From fd0143174d30451c99fde61d719d2eaa53730ff6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Mar 2009 16:48:13 +0100 Subject: PR9935. Fixed stap script typos. arg[5-10] -> $arg[5-10]. * testsuite/systemtap.base/sdt.exp: Enable stap_run2 when installtest_p. * testsuite/systemtap.base/sdt.stp: Fixed all arg to $arg typos. --- testsuite/systemtap.base/sdt.exp | 4 +--- testsuite/systemtap.base/sdt.stp | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 71fe9dac..9c40bf4d 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -25,9 +25,7 @@ if { $res != "" } { pass "compiling $test.c" } -# Currently fails for any mark probe with more than 4 arguments. -# FIXME - PR9935 s/(0)/{![installtest_p]}/ -if (0) { +if {[installtest_p]} { stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog } else { untested "$test" diff --git a/testsuite/systemtap.base/sdt.stp b/testsuite/systemtap.base/sdt.stp index d2deb557..1f075bca 100644 --- a/testsuite/systemtap.base/sdt.stp +++ b/testsuite/systemtap.base/sdt.stp @@ -20,30 +20,30 @@ probe process("sdt.prog").mark("mark_d") probe process("sdt.prog").mark("mark_e") { - printf("%d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5); + printf("%d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5); } probe process("sdt.prog").mark("mark_f") { - printf("%d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6); + printf("%d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6); } probe process("sdt.prog").mark("mark_g") { - printf("%d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7); + printf("%d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); } probe process("sdt.prog").mark("mark_h") { - printf("%d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8); + 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") { - printf("%d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8, arg9); + 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") { - printf("%d %d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8, arg9, arg10); + printf("%d %d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9, $arg10); } -- cgit From d82227a838a0ac11827a4047dc33b9e38eefc3b7 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 9 Mar 2009 21:27:30 -0400 Subject: Use alternate keywords for sdt.h * include/sys/sdt.h: Initialize args when declaring. Use alternate keywords. --- testsuite/systemtap.base/labels.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 1b538dbb..6db81c54 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -147,4 +147,4 @@ expect { if {$nomatch == 0} { pass "$test so .statement" } { fail "$test so .statement" } -# catch {exec rm -f $label_srcpath $label_stppath $label_exepath} +catch {exec rm -f $label_srcpath $label_stppath $label_exepath $label_shpath $label_sopath} -- cgit From e248aea9a04dd0d3c4e066afdca52176aaf9a536 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Wed, 11 Mar 2009 17:37:09 -0400 Subject: Run the tests for each member of a list of extra options. * testsuite/systemtap.base/sdt.h: Add extra_flags and g++ as a test language. --- testsuite/systemtap.base/sdt.exp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 9c40bf4d..09aaaf8d 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -10,13 +10,41 @@ 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}} + +# Iterate extra_flags, trying each with C and C++ +for {set i 0} {$i < [llength $extra_flags]} {incr 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=-Werror" -set res [target_compile $srcdir/$subdir/$test.c $test.prog executable $test_flags] + +set res [target_compile $srcdir/$subdir/$test.c $test.prog executable [concat $test_flags " " [lindex $extra_flags $i]]] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling $test.c" + return +} else { + pass "compiling $test.c" +} + +if {[installtest_p]} { + stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog +} else { + untested "$test" +} + +# 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=-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]]] if { $res != "" } { verbose "target_compile failed: $res" 2 fail "compiling $test.c" @@ -30,5 +58,6 @@ if {[installtest_p]} { } else { untested "$test" } +} catch {exec rm -f $test.prog} -- cgit From ec80b3969d33e4d54e97ead4286bdb018e2f1f97 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 11 Mar 2009 22:11:09 -0400 Subject: improve sdt.h compatibility and test suite Replaced cpp VA_ARGS in sdt.h with explicit enumeration of arguments (since with -pedantic, cpp has no varargs), and added a few more cflags variants to the sdt.exp test case. --- testsuite/systemtap.base/sdt.c | 2 ++ testsuite/systemtap.base/sdt.exp | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'testsuite/systemtap.base') 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..74818beb 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -10,31 +10,33 @@ 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}} # 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] + # 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 res [target_compile $srcdir/$subdir/$test.c $test.prog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c" + fail "compiling $test.c $extra_flag" return } else { - pass "compiling $test.c" + pass "compiling $test.c $extra_flag" } if {[installtest_p]} { +# XXX: we need distinct test names for these stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog } else { - untested "$test" + untested "$test $extra_flag" } # C++ @@ -44,19 +46,20 @@ 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 $test.prog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c" + fail "compiling $test.c c++ $extra_flag" return } else { - pass "compiling $test.c" + pass "compiling $test.c c++ $extra_flag" } if {[installtest_p]} { +# XXX: we need distinct test names for these stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog } else { - untested "$test" + untested "$test c++ $extra_flag" } } -- cgit From 49462d1bcec68365e3ac96fc5c11c83ab7a8abd6 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 11 Mar 2009 20:07:07 -0700 Subject: Add simple testcases for @cast --- testsuite/systemtap.base/cast.exp | 4 ++++ testsuite/systemtap.base/cast.stp | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 testsuite/systemtap.base/cast.exp create mode 100644 testsuite/systemtap.base/cast.stp (limited to 'testsuite/systemtap.base') 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() +} -- cgit From 6769e48794cfbeda3957f691077fb9d65f3e87bc Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 11 Mar 2009 20:30:58 -0700 Subject: Add test to compile and run all tracepoints This checks that kernel.trace("*") will compile, with all context variables accessed as well. For kernels without tracepoints, it will just hit a "begin" and quit. This doesn't ensure that kernel.trace("*") will always find something when it should, though... --- testsuite/systemtap.base/tracepoints.exp | 3 +++ testsuite/systemtap.base/tracepoints.stp | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 testsuite/systemtap.base/tracepoints.exp create mode 100644 testsuite/systemtap.base/tracepoints.stp (limited to 'testsuite/systemtap.base') 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++ } -- cgit From fafd79e3a65854c8e7b3c0048e044af9741a0fff Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 13 Mar 2009 14:44:54 +0100 Subject: Introduce stap_run3 for distinct test names. * testsuite/lib/stap_run2.exp: Add stap_run3, called from stap_run2. * testsuite/systemtap.base/sdt.exp: Use stap_run3, for distinct test names. --- testsuite/systemtap.base/sdt.exp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 74818beb..9e5dfc37 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -33,8 +33,7 @@ if { $res != "" } { } if {[installtest_p]} { -# XXX: we need distinct test names for these - stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog + stap_run3 "$test $extra_flag" $srcdir/$subdir/$test.stp -c ./$test.prog } else { untested "$test $extra_flag" } @@ -56,8 +55,7 @@ if { $res != "" } { } if {[installtest_p]} { -# XXX: we need distinct test names for these - stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog + stap_run3 "$test c++ $extra_flag" $srcdir/$subdir/$test.stp -c ./$test.prog } else { untested "$test c++ $extra_flag" } -- cgit From b16858f1452b4f111beb80875a5967dc8dff30fe Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 13 Mar 2009 14:49:55 +0100 Subject: Add -O2 and -O3 as extra test flags to sdt. * testsuite/systemtap.base/sdt.exp: Add -O2, -O3. --- testsuite/systemtap.base/sdt.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 9e5dfc37..a0220202 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -10,7 +10,7 @@ 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=-std=gnu89} {additional_flags=-ansi} {additional_flags=-pedantic}} +set extra_flags {{""} {additional_flags=-std=gnu89} {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} { -- cgit From 2497c78e8aa704366683dad56fc8d749a5e92f52 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 13 Mar 2009 14:54:26 +0100 Subject: Add -ansi -pedantic pair to sdt test. * testsuite/systemtap.base/sdt.exp: Add additional_flags -ansi together with -pedantic. --- testsuite/systemtap.base/sdt.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index a0220202..21b94810 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -10,7 +10,7 @@ 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=-std=gnu89} {additional_flags=-ansi} {additional_flags=-pedantic} {additional_flags=-O2} {additional_flags="-O3"}} +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} { -- cgit