summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/deref2.exp29
-rw-r--r--testsuite/systemtap.base/deref2.stp9
2 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/deref2.exp b/testsuite/systemtap.base/deref2.exp
new file mode 100644
index 00000000..6ee85d10
--- /dev/null
+++ b/testsuite/systemtap.base/deref2.exp
@@ -0,0 +1,29 @@
+set test "deref2"
+
+# XXX: the load-generation code below doesn't trigger reliably under dejagnu
+untested $test; continue
+
+
+if {![installtest_p]} { untested $test; continue }
+
+# This is asking perl to consume all of its file handles with sockets.
+# When there are no more, sock_alloc_fd will start returning errors (negatives).
+set load_gen_cmd {perl -e {use Socket; while ($i < 65536) { $i++; socket $Foo[$i], AF_UNIX, SOC_STREAM, PF_UNSPEC;} print "Toodaloo\n"; }}
+
+spawn stap $srcdir/$subdir/deref2.stp
+
+set pos 0
+set neg 0
+expect {
+ start\r\n {
+ catch { eval exec $load_gen_cmd }
+ verbose -log "starting loadgen"
+ }
+ pos\r\n { verobse -log "pos"; incr pos; exp_continue }
+ neg\r\n { verbose -log "neg"; incr neg; exp_continue }
+ eof { }
+ timeout { }
+}
+wait
+
+if {$neg > 0} { pass "$test ($pos $neg)" } else { fail "$test ($pos $neg)" }
diff --git a/testsuite/systemtap.base/deref2.stp b/testsuite/systemtap.base/deref2.stp
new file mode 100644
index 00000000..aa59490c
--- /dev/null
+++ b/testsuite/systemtap.base/deref2.stp
@@ -0,0 +1,9 @@
+# PR 3331
+
+# It's just an ordinary function that returns a 4-byte signed value,
+# even on a 64-bit hosts.
+probe kernel.function("sock_alloc_fd").return {
+ log ($return < 0 ? "neg" : "pos")
+}
+probe timer.s (5) { exit () }
+probe begin { log ("start") } \ No newline at end of file