From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86353 invoked by alias); 4 Jan 2016 06:38:41 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 86338 invoked by uid 89); 4 Jan 2016 06:38:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:bogon, H*RU:bogon, H*r:ip*14.3.181.6, Hx-spam-relays-external:14.3.181.6 X-HELO: heian.cn.fujitsu.com Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Jan 2016 06:38:40 +0000 Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Jan 2016 14:38:32 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id ED027401E4CA for ; Mon, 4 Jan 2016 14:38:20 +0800 (CST) Received: from localhost.localdomain (10.167.226.48) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 4 Jan 2016 14:38:20 +0800 From: Zhou Wenjian To: Subject: [PATCH v2] Add new case for stress test Date: Mon, 04 Jan 2016 06:38:00 -0000 Message-ID: <1451889421-9209-1-git-send-email-zhouwj-fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-yoursite-MailScanner-ID: ED027401E4CA.A6D7E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhouwj-fnst@cn.fujitsu.com X-IsSubscribed: yes X-SW-Source: 2016-q1/txt/msg00001.txt.bz2 * testsuite/lib/gen_load.exp: New test file * testsuite/systemtap.stress/all_kernel_functions.exp: Use gen_load.exp * testsuite/systemtap.stress/current.exp: Use gen_load.exp * testsuite/systemtap.stress/parallel_exec.exp: New test case --- testsuite/lib/gen_load.exp | 19 ++++++++++ .../systemtap.stress/all_kernel_functions.exp | 16 +-------- testsuite/systemtap.stress/current.exp | 19 ++-------- testsuite/systemtap.stress/parallel_exec.exp | 42 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 testsuite/lib/gen_load.exp create mode 100644 testsuite/systemtap.stress/parallel_exec.exp diff --git a/testsuite/lib/gen_load.exp b/testsuite/lib/gen_load.exp new file mode 100644 index 0000000..43b9df1 --- /dev/null +++ b/testsuite/lib/gen_load.exp @@ -0,0 +1,19 @@ +# genload is used by stress test +proc gen_load {} { + # if 'genload' from the ltp exists, use it to create a real load + catch {exec which genload 2>/dev/null} genload + if {![file executable $genload]} { + 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 +} diff --git a/testsuite/systemtap.stress/all_kernel_functions.exp b/testsuite/systemtap.stress/all_kernel_functions.exp index d7c2fbc..d546cfc 100644 --- a/testsuite/systemtap.stress/all_kernel_functions.exp +++ b/testsuite/systemtap.stress/all_kernel_functions.exp @@ -1,18 +1,4 @@ -proc genload {} { - # 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 -} +load_lib "gen_load.exp" proc probe_ok {probepoint} { set cmd {exec stap -p2 -e} diff --git a/testsuite/systemtap.stress/current.exp b/testsuite/systemtap.stress/current.exp index 186baa3..83814b6 100644 --- a/testsuite/systemtap.stress/current.exp +++ b/testsuite/systemtap.stress/current.exp @@ -2,23 +2,8 @@ # function, install it, and get some output. set test "current" - -proc current_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 -} +load_lib "gen_load.exp" set output_string "(\\w+ = \\d+\r\n){5}(${all_pass_string}){2}(WARNING.*skipped.*)?" -stap_run $srcdir/$subdir/$test.stp current_load $output_string -g -w +stap_run $srcdir/$subdir/$test.stp gen_load $output_string -g -w diff --git a/testsuite/systemtap.stress/parallel_exec.exp b/testsuite/systemtap.stress/parallel_exec.exp new file mode 100644 index 0000000..9b6769e --- /dev/null +++ b/testsuite/systemtap.stress/parallel_exec.exp @@ -0,0 +1,42 @@ +#!/bin/expect -f + +set test "parallel execute" + +load_lib "gen_load.exp" + +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