Blob Blame History Raw
commit d09defa86b31bd665a3a148ed15713aced8ae227
Author: David Smith <dsmith@redhat.com>
Date:   Thu Mar 9 11:11:49 2017 -0600

    Add PR19021 test case to task_dentry_path.exp.

diff --git a/testsuite/systemtap.base/task_dentry_path.exp b/testsuite/systemtap.base/task_dentry_path.exp
index 9bb7b9d..00b9e02 100644
--- a/testsuite/systemtap.base/task_dentry_path.exp
+++ b/testsuite/systemtap.base/task_dentry_path.exp
@@ -3,7 +3,8 @@
 # unmounted synthentic filesystem, it would go into an infinite loop
 # (until killed by MAXACTION).
 
-set test "task_dentry_path"
+set test_base "task_dentry_path"
+set test "${test_base}"
 
 # Only run on make installcheck
 if {! [installtest_p]} { untested "$test"; return }
@@ -18,3 +19,17 @@ expect {
 }
 catch {close}; catch {wait}
 if {$ok == 1} { fail "$test ($ok)" } { pass "$test ($ok)" }
+
+# Test the fix for PR19021 - the tapset function task_dentry_path()
+# should handle more than just files.
+set test "${test_base}2"
+spawn stap $srcdir/$subdir/$test.stp -c "echo hi | cat > /dev/null"
+set ok 0
+expect {
+    -timeout 150
+    -re {^pipe:\[[0-9]+\]\r\n} { incr ok; exp_continue }
+    timeout { fail "$test (timeout)" }
+    eof { }
+}
+catch {close}; catch {wait}
+if {$ok == 1} { pass "$test" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/task_dentry_path2.stp b/testsuite/systemtap.base/task_dentry_path2.stp
new file mode 100644
index 0000000..3fc9db4
--- /dev/null
+++ b/testsuite/systemtap.base/task_dentry_path2.stp
@@ -0,0 +1,6 @@
+probe kernel.function("pipe_read") {
+    t = task_current()
+    println(task_dentry_path(t, $iocb->ki_filp->f_path->dentry,
+	    $iocb->ki_filp->f_path->mnt))
+    exit()
+}