From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28503 invoked by alias); 9 Sep 2009 16:33:15 -0000 Received: (qmail 28401 invoked by uid 22791); 9 Sep 2009 16:33:13 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1-old.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Sep 2009 16:33:07 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com ([10.11.47.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n89GX4oJ013192 for ; Wed, 9 Sep 2009 12:33:05 -0400 Received: from localhost.localdomain (dhcp-100-3-156.bos.redhat.com [10.16.3.156]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n89GX4US003060; Wed, 9 Sep 2009 12:33:04 -0400 From: Masami Hiramatsu Subject: [PATCH 3/3] Add signal based file switching testcase To: systemtap Date: Wed, 09 Sep 2009 16:33:00 -0000 Message-ID: <20090909163438.22599.74912.stgit@localhost.localdomain> In-Reply-To: <20090909163420.22599.87922.stgit@localhost.localdomain> References: <20090909163420.22599.87922.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2009-q3/txt/msg00634.txt.bz2 * testsuite/systemtap.base/flightrec1.exp: Add signal file switching testcase. * testsuite/systemtap.base/flightrec4.exp: New test for signal file switching with file number limits. * testsuite/systemtap.base/flightrec5.exp: New test for signal file switching with file number limits on bulk mode. --- testsuite/systemtap.base/flightrec1.exp | 12 +++++- testsuite/systemtap.base/flightrec4.exp | 56 +++++++++++++++++++++++++++ testsuite/systemtap.base/flightrec5.exp | 64 +++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletions(-) create mode 100644 testsuite/systemtap.base/flightrec4.exp create mode 100644 testsuite/systemtap.base/flightrec5.exp diff --git a/testsuite/systemtap.base/flightrec1.exp b/testsuite/systemtap.base/flightrec1.exp index c32a77f..eb7f26c 100644 --- a/testsuite/systemtap.base/flightrec1.exp +++ b/testsuite/systemtap.base/flightrec1.exp @@ -30,7 +30,8 @@ expect { } wait -exec kill -TERM $pid +# switch file +exec kill -USR1 $pid # check output file if {[catch {exec rm $test.out}]} { @@ -40,4 +41,13 @@ if {[catch {exec rm $test.out}]} { pass "$test (output file)" } +exec kill -TERM $pid + +# check switched output file +if {[catch {exec rm $test.out.1}]} { + fail "$test (failed to switch output file)" + return -1 +} else { + pass "$test (switch output file)" +} diff --git a/testsuite/systemtap.base/flightrec4.exp b/testsuite/systemtap.base/flightrec4.exp new file mode 100644 index 0000000..36c02d5 --- /dev/null +++ b/testsuite/systemtap.base/flightrec4.exp @@ -0,0 +1,56 @@ +set test "flightrec4" +if {![installtest_p]} { untested $test; return } + +# run stapio in background mode with number limit +spawn stap -F -S 1,2 -o $test.out -we {probe begin {}} +# check whether stap outputs stapio pid +set pid 0 +expect { + -timeout 240 + -re {([0-9]+)\r\n} { + pass "$test (flight recorder option)" + set pid $expect_out(1,string) + exp_continue} + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$pid == 0} { + fail "$test (no pid)" + return -1 +} + +# switch file to .1 +exec kill -USR1 $pid + +# check output file +if {[catch {exec rm $test.out.0}]} { + fail "$test (no output file)" + return -1 +} else { + pass "$test (output file)" +} + +# switch file to .2 +exec kill -USR1 $pid +# switch file to .3 (this time, .1 file should be deleted) +exec kill -USR1 $pid + +# check switched output file +if {[catch {exec rm $test.out.1}]} { + pass "$test (old output file is removed)" +} else { + fail "$test (failed to remove output file)" + return -1 +} + +exec kill -TERM $pid + +# check switched output file +if {[catch {exec rm $test.out.2 $test.out.3}]} { + fail "$test (failed to switch output file)" + return -1 +} else { + pass "$test (switch output file)" +} + diff --git a/testsuite/systemtap.base/flightrec5.exp b/testsuite/systemtap.base/flightrec5.exp new file mode 100644 index 0000000..e24e6e5 --- /dev/null +++ b/testsuite/systemtap.base/flightrec5.exp @@ -0,0 +1,64 @@ +set test "flightrec5" +if {![installtest_p]} { untested $test; return } + +# run stapio in background mode with number limit and bulk mode +spawn stap -F -S 1,2 -b -o $test.out -we {probe begin {}} +# check whether stap outputs stapio pid +set pid 0 +expect { + -timeout 240 + -re {([0-9]+)\r\n} { + pass "$test (flight recorder option)" + set pid $expect_out(1,string) + exp_continue} + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$pid == 0} { + fail "$test (no pid)" + return -1 +} + +# switch file to .1 +exec kill -USR1 $pid + +# check output file +eval set outfile {[glob -nocomplain $test.out_cpu*.0]} +if {$outfile == ""} { + fail "$test (no output file) $outfile" + exec kill -TERM $pid + return -1 +} else { + pass "$test (output file)" +} +eval exec rm $outfile + +print "pid = $pid" +# switch file to .2 +exec kill -USR1 $pid +# switch file to .3 (this time, .1 file should be deleted) +exec kill -USR1 $pid + +exec kill -TERM $pid + +# check switched output file +eval set outfile {[glob -nocomplain $test.out_cpu*.1]} +if {$outfile == ""} { + pass "$test (old output file is removed)" +} else { + fail "$test (failed to remove output file)" + eval exec rm $outfile + return -1 +} + +# check switched output file +eval set outfile {[glob -nocomplain $test.out_cpu*.*]} +if {$outfile == ""} { + fail "$test (failed to switch output file)" + return -1 +} else { + pass "$test (switch output file)" +} +eval exec rm $outfile + -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com