This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 3/3] Add new case for -k
- From: Zhou Wenjian <zhouwj-fnst at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Date: Thu, 10 Dec 2015 18:41:31 +0800
- Subject: [PATCH 3/3] Add new case for -k
- Authentication-results: sourceware.org; auth=none
- References: <1449744091-1673-1-git-send-email-zhouwj-fnst at cn dot fujitsu dot com>
* testsuite/systemtap.base/temp-directory.exp: new test case
---
testsuite/systemtap.base/temp-directory.exp | 37 +++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 testsuite/systemtap.base/temp-directory.exp
diff --git a/testsuite/systemtap.base/temp-directory.exp b/testsuite/systemtap.base/temp-directory.exp
new file mode 100644
index 0000000..66a629f
--- /dev/null
+++ b/testsuite/systemtap.base/temp-directory.exp
@@ -0,0 +1,37 @@
+# Check keep temporary directory
+set test "keep temporary directory"
+#if {![installtest_p]} { untested "$test"; return }
+
+# Script we'll use while testing:
+set script "probe begin{exit();}"
+set ret 0
+
+spawn stap -k -e $script
+expect {
+-re {Keeping temporary directory \"((/[0-9a-zA-Z]*)+)\"\r\n} {set dir $expect_out(1,string); exp_continue}
+eof
+}
+
+if { [file isdirectory $dir] == 1 } {
+ exec rm -rf $dir
+} else {
+ set ret 1
+}
+
+spawn stap -k -p1 -e $script
+expect {
+-re {Keeping temporary directory \"((/[0-9a-zA-Z]*)+)\"\r\n} {set dir $expect_out(1,string); exp_continue}
+eof
+}
+
+if { [file isdirectory $dir] == 1 } {
+ exec rm -rf $dir
+} else {
+ set ret 1
+}
+
+if { $ret == 0 } {
+ pass $test
+} else {
+ fail $test
+}
--
1.8.3.1