summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/cache.exp5
-rw-r--r--testsuite/systemtap.base/cmd_parse.exp37
-rw-r--r--testsuite/systemtap.base/debugpath.exp3
-rw-r--r--testsuite/systemtap.base/error_fn.exp7
-rw-r--r--testsuite/systemtap.base/error_fn.stp17
-rw-r--r--testsuite/systemtap.base/optim_arridx.exp2
-rw-r--r--testsuite/systemtap.base/optim_arridx.stp2
-rw-r--r--testsuite/systemtap.base/optim_voidstmt.exp5
-rw-r--r--testsuite/systemtap.base/optim_voidstmt.stp95
-rw-r--r--testsuite/systemtap.base/stmt_rel.exp9
-rw-r--r--testsuite/systemtap.base/stmt_rel.stp71
-rw-r--r--testsuite/systemtap.base/stmtvars.exp10
-rw-r--r--testsuite/systemtap.base/utrace_p4.exp27
-rw-r--r--testsuite/systemtap.base/utrace_p5.exp92
-rw-r--r--testsuite/systemtap.base/utrace_p5_multi.c45
-rw-r--r--testsuite/systemtap.base/warnings.exp2
-rw-r--r--testsuite/systemtap.base/warnings.stp11
17 files changed, 395 insertions, 45 deletions
diff --git a/testsuite/systemtap.base/cache.exp b/testsuite/systemtap.base/cache.exp
index 26d7b0ef..f7ed2786 100644
--- a/testsuite/systemtap.base/cache.exp
+++ b/testsuite/systemtap.base/cache.exp
@@ -65,8 +65,9 @@ proc stap_compile { TEST_NAME flags script args } {
}
# Since we need a clean cache directory, we'll use a temporary
-# systemtap directory and cache
-set local_systemtap_dir [exec pwd]/.cache_test
+# systemtap directory and cache (add user name so make check and
+# sudo make installcheck don't clobber each others)
+set local_systemtap_dir [exec pwd]/.cache_test-[exec whoami]
exec /bin/rm -rf $local_systemtap_dir
if [info exists env(SYSTEMTAP_DIR)] {
set old_systemtap_dir $env(SYSTEMTAP_DIR)
diff --git a/testsuite/systemtap.base/cmd_parse.exp b/testsuite/systemtap.base/cmd_parse.exp
index cbce0455..e33bfa85 100644
--- a/testsuite/systemtap.base/cmd_parse.exp
+++ b/testsuite/systemtap.base/cmd_parse.exp
@@ -84,3 +84,40 @@ expect {
eof {fail "cmd_parse8: unexpected EOF"}
}
wait
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1
+expect {
+ -timeout 60
+ "1 1" { pass cmd_parse9 }
+ timeout { fail "cmd_parse9 timeout" }
+ eof { fail "cmd_parse9 eof" }
+}
+wait
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d
+expect {
+ -timeout 60
+ "5 d" { pass cmd_parse10 }
+ timeout { fail "cmd_parse10 timeout" }
+ eof { fail "cmd_parse10 eof" }
+}
+wait
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d
+expect {
+ -timeout 60
+ "5 " { pass cmd_parse11 }
+ timeout { fail "cmd_parse11 timeout" }
+ eof { fail "cmd_parse11 eof" }
+}
+wait
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }}
+expect {
+ -timeout 60
+ "0 " { pass cmd_parse12 }
+ timeout { fail "cmd_parse12 timeout" }
+ eof { fail "cmd_parse12 eof" }
+}
+wait
+
diff --git a/testsuite/systemtap.base/debugpath.exp b/testsuite/systemtap.base/debugpath.exp
index b0b12207..9c42295d 100644
--- a/testsuite/systemtap.base/debugpath.exp
+++ b/testsuite/systemtap.base/debugpath.exp
@@ -10,7 +10,8 @@ expect {
wait
set test "debugpath-good"
-spawn env SYSTEMTAP_DEBUGINFO_PATH=:/usr/lib/debug stap -e "probe kernel.function(\"sys_open\") {}" -p2
+set uname [exec /bin/uname -r]
+spawn env SYSTEMTAP_DEBUGINFO_PATH=/lib/modules/$uname/build stap -e "probe kernel.function(\"sys_open\") {}" -p2
expect {
-re {kernel.function.*pc=} { pass $test }
timeout { fail "$test (timeout2)" }
diff --git a/testsuite/systemtap.base/error_fn.exp b/testsuite/systemtap.base/error_fn.exp
new file mode 100644
index 00000000..c0de850f
--- /dev/null
+++ b/testsuite/systemtap.base/error_fn.exp
@@ -0,0 +1,7 @@
+# check that errors in nested functions are not lost on return
+# bugzilla 6529
+
+set test "error_fn"
+
+stap_run $srcdir/$subdir/$test.stp no_load ".*synthetic error.*"
+
diff --git a/testsuite/systemtap.base/error_fn.stp b/testsuite/systemtap.base/error_fn.stp
new file mode 100644
index 00000000..2e68026f
--- /dev/null
+++ b/testsuite/systemtap.base/error_fn.stp
@@ -0,0 +1,17 @@
+probe begin {
+ println("systemtap starting probe")
+ println("systemtap ending probe")
+}
+
+function generate_error:long() {
+ error("synthetic error")
+ return 1
+}
+
+function compute:long() {
+ return generate_error()
+}
+
+probe end {
+ compute()
+}
diff --git a/testsuite/systemtap.base/optim_arridx.exp b/testsuite/systemtap.base/optim_arridx.exp
index 0987dec6..f4308db5 100644
--- a/testsuite/systemtap.base/optim_arridx.exp
+++ b/testsuite/systemtap.base/optim_arridx.exp
@@ -9,7 +9,7 @@ arr3:long [long]
fna:long (a:long)
return a
fnb:long (a:long, b:long)
-return (a) + (b)
+return ((a) + (b)) + (printf(""))
exit:unknown ()
%{
atomic_set (&session_state, STAP_SESSION_STOPPING);
diff --git a/testsuite/systemtap.base/optim_arridx.stp b/testsuite/systemtap.base/optim_arridx.stp
index 20710c7f..3e4f8fd2 100644
--- a/testsuite/systemtap.base/optim_arridx.stp
+++ b/testsuite/systemtap.base/optim_arridx.stp
@@ -1,7 +1,7 @@
global arr1, arr2, arr3, elide_idx1, elide_global_a, elide_global_b
function fna(a:long) {return a}
-function fnb(a:long, b:long) {return a+b}
+function fnb(a:long, b:long) {return a+b+printf("")}
probe begin {
// array indices
diff --git a/testsuite/systemtap.base/optim_voidstmt.exp b/testsuite/systemtap.base/optim_voidstmt.exp
new file mode 100644
index 00000000..186dabad
--- /dev/null
+++ b/testsuite/systemtap.base/optim_voidstmt.exp
@@ -0,0 +1,5 @@
+# Make sure that optimization works with void statements
+
+set test "optim_voidstmt"
+
+stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string -g
diff --git a/testsuite/systemtap.base/optim_voidstmt.stp b/testsuite/systemtap.base/optim_voidstmt.stp
new file mode 100644
index 00000000..343f81b3
--- /dev/null
+++ b/testsuite/systemtap.base/optim_voidstmt.stp
@@ -0,0 +1,95 @@
+/*
+ * optim_voidstmt.stp
+ *
+ * Verify statement optimizations in void contexts.
+ */
+
+/* The printfs here force it not to be pure. */
+function goodL() { printf(""); return 1 }
+function goodS() { printf(""); return "1" }
+
+/* These two functions lie about being pure, so they should be optimized out.
+ * If they get called, you get an error, and the test fails.
+ */
+function badL:long() %{ /* pure */ CONTEXT->last_error = "NOSEE"; %}
+function badS:string() %{ /* pure */ CONTEXT->last_error = "NOSEE"; %}
+
+function fn1(x) { return x }
+function fn2(x, y) { return x * y }
+
+probe begin {
+ println("systemtap starting probe")
+}
+
+probe end {
+ println("systemtap ending probe")
+
+ // most of these wouldn't have been optimized before, because part of the
+ // expression has an apparant side-effect in the good* calls
+
+ // unary numeric operators
+ (+(goodL() + badL()))
+ (-(goodL() + badL()))
+ (!(goodL() + badL()))
+ (~(goodL() + badL()))
+
+ // binary numeric operators
+ goodL() * badL()
+ goodL() / badL()
+ goodL() % badL()
+ goodL() + badL()
+ goodL() - badL()
+ goodL() >> badL()
+ goodL() << badL()
+ goodL() & badL()
+ goodL() ^ badL()
+ goodL() | badL()
+ goodL() < badL()
+ goodL() > badL()
+ goodL() <= badL()
+ goodL() >= badL()
+ goodL() == badL()
+ goodL() != badL()
+
+ // logical operators
+ goodL() && badL()
+ badL() && badL()
+ goodL() || badL()
+ badL() || badL()
+
+ // ternary operator
+ goodL() ? badL() : goodL()
+ goodL() ? goodL() : badL()
+ badL() ? badL() : badL()
+
+ // binary string operators
+ goodS() . badS()
+ goodS() < badS()
+ goodS() > badS()
+ goodS() <= badS()
+ goodS() >= badS()
+ goodS() == badS()
+ goodS() != badS()
+
+ // string-printing
+ sprintf("%d\n", goodL() + badL())
+ sprintf("%d %d %s %s\n", goodL(), badL(), goodS(), badS())
+
+ // function calls
+ fn1(badL() + goodL())
+ fn2(badL(), goodL())
+
+ // something complex, but harmless enough that only
+ // the good* calls should survive
+ fn1(fn2(goodL() - strlen(badL() + badL() * badL() / strlen(goodS()) ?
+ badS() . badS() . sprint(badL())
+ : sprint(badL(), badS())),
+ badL() < badL() || badS() == badS()) +
+ goodL() % strlen(goodS()))
+
+ println("systemtap test success")
+}
+
+probe never {
+ print(goodL(), badL(), goodS(), badS(), fn1(1), fn2(1, 1))
+}
diff --git a/testsuite/systemtap.base/stmt_rel.exp b/testsuite/systemtap.base/stmt_rel.exp
new file mode 100644
index 00000000..25156d9b
--- /dev/null
+++ b/testsuite/systemtap.base/stmt_rel.exp
@@ -0,0 +1,9 @@
+# test integer limits. Set and print variables and print constants.
+
+set test "stmt_rel"
+set ::result_string {PASS bio_init
+PASS line number
+PASS wildcard
+}
+
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.base/stmt_rel.stp b/testsuite/systemtap.base/stmt_rel.stp
new file mode 100644
index 00000000..13066161
--- /dev/null
+++ b/testsuite/systemtap.base/stmt_rel.stp
@@ -0,0 +1,71 @@
+global stack2pp, stack2func, stack3pp, stack3func
+global wildcardpp, wild_count
+
+probe kernel.statement("bio_init@fs/bio.c+2") {
+ # stack2 = tokenize(backtrace(), " ")
+ stack2func = probefunc()
+ stack2pp = pp()
+}
+probe kernel.statement("bio_init@fs/bio.c+3") {
+ # stack3 = tokenize(backtrace(), " " )
+ stack3func = probefunc()
+ stack3pp = pp()
+}
+
+probe kernel.statement("bio_put@fs/bio.c:*") {
+ line = tokenize(pp(),":")
+ line = tokenize("",":")
+ line = substr(line,0,strlen(line)-2)
+ wildcardpp[strtol(line,10)]++
+
+ if (wild_count++ <= 10) {
+ next
+ }
+
+ stack2pp = tokenize(stack2pp,":")
+ stack2pp = tokenize("",":")
+ stack3pp = tokenize(stack3pp,":")
+ stack3pp = tokenize("",":")
+
+ stack2line = strtol (substr(stack2pp,0,strlen(stack2pp)-2), 10)
+ stack3line = strtol (substr(stack3pp,0,strlen(stack3pp)-2), 10)
+
+ # Did functions for both bio_init probes match?
+ if (stack2func == stack3func) {
+ printf ("PASS %s\n", stack2func)
+ }
+ else {
+ printf ("FAIL %s %s\n", stack2func, stack3func)
+ }
+
+ # Was line # for bio_init probe +2 < line # for bio_init probe +3?
+ if ((stack2line + 1) == stack3line) {
+ printf ("PASS line number\n")
+ }
+ else {
+ printf ("FAIL line number %d %d\n", stack2line, stack3line)
+ }
+
+ # This test does not take optimized code into account
+ # Was address for bio_init probe +2 < address for bio_init probe +3?
+ # if (stack2 < stack3) {
+ # printf ("PASS address\n")
+ # }
+ # else {
+ # printf ("FAIL address %s %s\n", stack2, stack3)
+ # }
+
+ # Did wildcard probe hit at least 5 different statements?
+ foreach ([i] in wildcardpp) {
+ statement_count += 1
+ }
+ if (statement_count >= 5) {
+ printf ("PASS wildcard\n")
+ }
+ else
+ {
+ printf ("FAIL wildcard %d\n", statement_count)
+ }
+
+ exit()
+}
diff --git a/testsuite/systemtap.base/stmtvars.exp b/testsuite/systemtap.base/stmtvars.exp
index 6e950ea0..822e0d7e 100644
--- a/testsuite/systemtap.base/stmtvars.exp
+++ b/testsuite/systemtap.base/stmtvars.exp
@@ -5,9 +5,8 @@ set pc 0
set vars ""
spawn stap -e "probe kernel.function(\"sys_open\") {\$foo}" -p4 -vv -u
expect {
- -re {probe sys_open.*pc=(0x.*)\r\n} { set pc $expect_out(1,string); exp_continue }
- -re {alternatives: ([^\r\n]*) identifier [^\r\n]*\r\n} { set vars $expect_out(1,string)
- exp_continue }
+ -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue }
+ -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars $expect_out(1,string); exp_continue }
timeout { fail "$test (timeout)" }
eof
}
@@ -19,9 +18,8 @@ set pc2 0
set vars2 ""
spawn stap -e "probe kernel.statement($pc) {\$foo}" -p4 -vv -u
expect {
- -re {probe sys_open.*pc=(0x.*)\r\n} { set pc2 $expect_out(1,string); exp_continue }
- -re {alternatives: ([^\r\n]*) identifier [^\r\n]*\r\n} { set vars2 $expect_out(1,string)
- exp_continue }
+ -re {probe sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue }
+ -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars2 $expect_out(1,string); exp_continue }
timeout { fail "$test (timeout)" }
eof
}
diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp
index eb6ea685..5544ee55 100644
--- a/testsuite/systemtap.base/utrace_p4.exp
+++ b/testsuite/systemtap.base/utrace_p4.exp
@@ -49,11 +49,12 @@ proc stap_compile { TEST_NAME compile script args } {
# Initialize variables
set utrace_support_found 0
-set clone_script {"probe process(\"/bin/ls\").clone { print(\"ls clone\") }"}
-set death_script {"probe process(\"/bin/ls\").death { print(\"ls death\") }"}
+set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"}
+set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"}
set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"}
set syscall_return_script {"probe process(\"/bin/ls\").syscall.return { printf(\"|%d\", \$syscall) }"}
-set exec_script {"probe process(\"/bin/ls\").exec { print(\"ls exec\") }"}
+set thread_begin_script {"probe process(\"/bin/ls\").thread.begin { print(\"ls thread.begin\") }"}
+set thread_end_script {"probe process(\"/bin/ls\").thread.end { print(\"ls thread.end\") }"}
# Try to find utrace_attach symbol in /proc/kallsyms
set path "/proc/kallsyms"
@@ -69,16 +70,16 @@ set TEST_NAME "UTRACE_P4_01"
if {$utrace_support_found == 0} {
untested "$TEST_NAME : no kernel utrace support found"
} else {
- # Try compiling a clone script
- stap_compile $TEST_NAME 1 $clone_script
+ # Try compiling a begin script
+ stap_compile $TEST_NAME 1 $begin_script
}
set TEST_NAME "UTRACE_P4_02"
if {$utrace_support_found == 0} {
untested "$TEST_NAME : no kernel utrace support found"
} else {
- # Try compiling a death script
- stap_compile $TEST_NAME 1 $death_script
+ # Try compiling a end script
+ stap_compile $TEST_NAME 1 $end_script
}
set TEST_NAME "UTRACE_P4_03"
@@ -101,6 +102,14 @@ set TEST_NAME "UTRACE_P4_05"
if {$utrace_support_found == 0} {
untested "$TEST_NAME : no kernel utrace support found"
} else {
- # Try compiling an exec script
- stap_compile $TEST_NAME 1 $exec_script
+ # Try compiling an thread.begin script
+ stap_compile $TEST_NAME 1 $thread_begin_script
+}
+
+set TEST_NAME "UTRACE_P4_06"
+if {$utrace_support_found == 0} {
+ untested "$TEST_NAME : no kernel utrace support found"
+} else {
+ # Try compiling an thread.end script
+ stap_compile $TEST_NAME 1 $thread_end_script
}
diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp
index cbb867d1..fcd617fe 100644
--- a/testsuite/systemtap.base/utrace_p5.exp
+++ b/testsuite/systemtap.base/utrace_p5.exp
@@ -3,24 +3,27 @@
# Initialize variables
set utrace_support_found 0
set exepath "[pwd]/cat_[pid]"
+set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c"
+set multi_exepath "[pwd]/utrace_p5_multi_[pid]"
+set multi_flags "libs=-lpthread"
-set death_script {
- global death_probes_fired = 0
+set end_script {
+ global end_probes_fired = 0
probe begin { printf("systemtap starting probe\n") }
- probe process("%s").death { death_probes_fired++ }
+ probe process("%s").end { end_probes_fired++ }
probe end { printf("systemtap ending probe\n")
- printf("deaths = %%d\n", death_probes_fired) }
+ printf("end probes = %%d\n", end_probes_fired) }
}
-set death_script_output "deaths = 1\r\n"
+set end_script_output "end probes = 1\r\n"
-set exec_script {
- global exec_probes_fired = 0
+set begin_script {
+ global begin_probes_fired = 0
probe begin { printf("systemtap starting probe\n") }
- probe process("%s").exec { exec_probes_fired++ }
+ probe process("%s").begin { begin_probes_fired++ }
probe end { printf("systemtap ending probe\n")
- printf("execs = %%d\n", exec_probes_fired) }
+ printf("begin probes = %%d\n", begin_probes_fired) }
}
-set exec_script_output "execs = 1\r\n"
+set begin_script_output "begin probes = 1\r\n"
set syscall_script {
global syscall_probes_fired = 0
@@ -46,17 +49,29 @@ set syscall_return_script {
}
set syscall_return_script_output "syscall_returns = \\d+\r\n"
-set clone_script {
- global clone_probes_fired = 0
+set thread_begin_script {
+ global thread_begin_probes_fired = 0
probe begin { printf("systemtap starting probe\n") }
- probe process(%d).clone { clone_probes_fired++ }
+ probe process("%s").thread.begin { thread_begin_probes_fired++ }
probe end { printf("systemtap ending probe\n")
- if (clone_probes_fired > 0) {
- printf("clones = %%d\n", clone_probes_fired)
+ if (thread_begin_probes_fired > 0) {
+ printf("thread_begins = %%d\n", thread_begin_probes_fired)
}
}
}
-set clone_script_output "clones = \\d+\r\n"
+set thread_begin_script_output "thread_begins = \\d+\r\n"
+
+set thread_end_script {
+ global thread_end_probes_fired = 0
+ probe begin { printf("systemtap starting probe\n") }
+ probe process("%s").thread.end { thread_end_probes_fired++ }
+ probe end { printf("systemtap ending probe\n")
+ if (thread_end_probes_fired > 0) {
+ printf("thread_ends = %%d\n", thread_end_probes_fired)
+ }
+ }
+}
+set thread_end_script_output "thread_ends = \\d+\r\n"
# Try to find utrace_attach symbol in /proc/kallsyms
set path "/proc/kallsyms"
@@ -86,14 +101,33 @@ proc run_cat_5_sec {} {
return 0;
}
+# Compile our multi-threaded test program.
+set res [target_compile $multi_srcpath $multi_exepath executable $multi_flags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "unable to compile $multi_srcpath"
+ return
+}
+
+# "load" generation function for stap_run. It spawns our
+# multi-threaded test program and waits for it to finish.
+proc run_utrace_p5_multi {} {
+ global multi_exepath
+
+ if {[catch {exec $multi_exepath} res]} {
+ verbose "unable to run $multi_exepath: $res"
+ }
+ return 0;
+}
+
set TEST_NAME "UTRACE_P5_01"
if {$utrace_support_found == 0} {
untested "$TEST_NAME : no kernel utrace support found"
} elseif {![installtest_p]} {
untested "$TEST_NAME"
} else {
- set script [format $death_script $exepath]
- stap_run $TEST_NAME run_cat_5_sec $death_script_output -e $script
+ set script [format $end_script $exepath]
+ stap_run $TEST_NAME run_cat_5_sec $end_script_output -e $script
}
set TEST_NAME "UTRACE_P5_02"
@@ -102,8 +136,8 @@ if {$utrace_support_found == 0} {
} elseif {![installtest_p]} {
untested "$TEST_NAME"
} else {
- set script [format $exec_script $exepath]
- stap_run $TEST_NAME run_cat_5_sec $exec_script_output -e $script
+ set script [format $begin_script $exepath]
+ stap_run $TEST_NAME run_cat_5_sec $begin_script_output -e $script
}
set TEST_NAME "UTRACE_P5_03"
@@ -132,9 +166,21 @@ if {$utrace_support_found == 0} {
} elseif {![installtest_p]} {
untested "$TEST_NAME"
} else {
- set script [format $clone_script [pid]]
- stap_run $TEST_NAME run_cat_5_sec $clone_script_output -e $script
+ set script [format $thread_begin_script $multi_exepath]
+ stap_run $TEST_NAME run_utrace_p5_multi $thread_begin_script_output \
+ -e $script
+}
+
+set TEST_NAME "UTRACE_P5_06"
+if {$utrace_support_found == 0} {
+ untested "$TEST_NAME : no kernel utrace support found"
+} elseif {![installtest_p]} {
+ untested "$TEST_NAME"
+} else {
+ set script [format $thread_end_script $multi_exepath]
+ stap_run $TEST_NAME run_utrace_p5_multi $thread_end_script_output \
+ -e $script
}
# Cleanup
-exec rm -f $exepath
+exec rm -f $exepath $multi_exepath
diff --git a/testsuite/systemtap.base/utrace_p5_multi.c b/testsuite/systemtap.base/utrace_p5_multi.c
new file mode 100644
index 00000000..153243d0
--- /dev/null
+++ b/testsuite/systemtap.base/utrace_p5_multi.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+void *thread_function( void *ptr );
+
+struct thread_data {
+ int tnum;
+};
+
+int
+main()
+{
+ pthread_t thread1, thread2;
+ int iret1, iret2;
+
+ /* Create independent threads each of which will execute function */
+ struct thread_data t1 = { 1 };
+ struct thread_data t2 = { 2 };
+ iret1 = pthread_create(&thread1, NULL, thread_function, (void*) &t1);
+ iret2 = pthread_create(&thread2, NULL, thread_function, (void*) &t2);
+
+ /* Wait till threads are complete before main continues. Unless we
+ * wait we run the risk of executing an exit which will terminate
+ * the process and all threads before the threads have
+ * completed. */
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
+
+ printf("Thread 1 returns: %d\n", iret1);
+ printf("Thread 2 returns: %d\n", iret2);
+ exit(0);
+}
+
+void *thread_function(void *ptr)
+{
+ struct thread_data *td = ptr;
+ if (td->tnum == 1) {
+ int fd = open("/dev/null", O_RDONLY);
+ close(fd);
+ }
+}
diff --git a/testsuite/systemtap.base/warnings.exp b/testsuite/systemtap.base/warnings.exp
index 6cff723d..b56d7a98 100644
--- a/testsuite/systemtap.base/warnings.exp
+++ b/testsuite/systemtap.base/warnings.exp
@@ -9,7 +9,7 @@ expect {
eof { }
}
wait
-if {$ok == 22} {
+if {$ok == 14} {
pass $test
} else {
fail "$test ($ok)"
diff --git a/testsuite/systemtap.base/warnings.stp b/testsuite/systemtap.base/warnings.stp
index a2ac5afc..94ed57b3 100644
--- a/testsuite/systemtap.base/warnings.stp
+++ b/testsuite/systemtap.base/warnings.stp
@@ -1,4 +1,4 @@
-# PR 1119, 6538
+# PR 1119
global elide_me1
function elide_me2 () {}
@@ -6,3 +6,12 @@ function foo:long () { elide_me3 = 1 }
function bar() { print(elide+me1) ; ; ; }
probe never { elide_me4 = 1; (elide_me5+5); print (foo()) }
probe never { print(elide+me1) bar () }
+
+# PR 6611
+
+probe probea = kernel.statement("bio_init@fs/bio.c:135")
+ { printf("%d", funca(2)); elide_me6="foo" }
+probe probea { printf("%d", funcb(2,3)); printf("%s",var) }
+
+function funcb(a:long, b:long) {return a + b}
+function funca(a:long) {a=b; elide_me7=1; return a}