This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 3/3] Add new case for stress test
- From: Zhou Wenjian <zhouwj-fnst at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Date: Tue, 15 Dec 2015 15:21:44 +0800
- Subject: [PATCH 3/3] Add new case for stress test
- Authentication-results: sourceware.org; auth=none
- References: <1450164104-1508-1-git-send-email-zhouwj-fnst at cn dot fujitsu dot com>
* testsuite/systemtap.stress/parallel_exec.exp: New test case
---
testsuite/systemtap.stress/parallel_exec.exp | 56 ++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 testsuite/systemtap.stress/parallel_exec.exp
diff --git a/testsuite/systemtap.stress/parallel_exec.exp b/testsuite/systemtap.stress/parallel_exec.exp
new file mode 100644
index 0000000..9fbefae
--- /dev/null
+++ b/testsuite/systemtap.stress/parallel_exec.exp
@@ -0,0 +1,56 @@
+#!/bin/expect -f
+
+set test "parallel execute"
+
+proc gen_load {} {
+ # if 'genload' from the ltp exists, use it to create a real load
+ set genload {/usr/local/ltp/testcases/bin/genload}
+ if [file executable $genload] {
+ exec $genload -c 10 -i 10 -m 10 -t 10
+ # ^^^^^ run for 10 seconds
+ # ^^^^^ 10 procs spinning on malloc
+ # ^^^^^ 10 procs spinning on sync
+ # ^^^^^ 10 procs spinning on sqrt
+ } else {
+ # sleep for a bit
+ wait_n_secs 10
+ }
+ return 0
+}
+
+set process_num 10
+
+set script {
+ probe syscall.open
+ {
+ if (pid() != target()) next
+ log("open")
+ }
+
+ probe syscall.close
+ {
+ if (pid() != target()) next
+ log("close")
+ }
+}
+
+for { set i 0 } { $i < $process_num } { incr i } {
+ exec stap -e "$script" -c "cat /etc/hosts > /dev/null" >>/tmp/parallel_exec &
+}
+
+if {[eval gen_load] == 0} then {
+ pass "$test load generation"
+} else {
+ fail "$test load generation"
+}
+
+set num1 [exec stap -e "$script" -c "cat /etc/hosts > /dev/null" | grep \[open|close\] | wc -l]
+set num2 [exec grep \[open|close\] /tmp/parallel_exec | wc -l]
+
+exec rm -f /tmp/parallel_exec
+
+if {$num1 * $process_num != $num2} {
+ fail $test
+} else {
+ pass $test
+}
--
1.8.3.1