From 2129d358c4aba84430a18f86309f2aa70a8fd123 Mon Sep 17 00:00:00 2001 From: hunt Date: Fri, 1 Feb 2008 19:06:02 +0000 Subject: 2008-02-01 Martin Hunt PR4736 * systemtap.printf/stap_merge.tcl: Copied here so it will always be available. --- testsuite/systemtap.printf/end1b.exp | 8 +-- testsuite/systemtap.printf/mixed_outb.exp | 8 +-- testsuite/systemtap.printf/out1b.exp | 8 +-- testsuite/systemtap.printf/out2b.exp | 8 +-- testsuite/systemtap.printf/out3b.exp | 8 +-- testsuite/systemtap.printf/stap_merge.tcl | 102 ++++++++++++++++++++++++++++++ 6 files changed, 107 insertions(+), 35 deletions(-) create mode 100755 testsuite/systemtap.printf/stap_merge.tcl (limited to 'testsuite/systemtap.printf') diff --git a/testsuite/systemtap.printf/end1b.exp b/testsuite/systemtap.printf/end1b.exp index 6168f66e..e23d6bc7 100644 --- a/testsuite/systemtap.printf/end1b.exp +++ b/testsuite/systemtap.printf/end1b.exp @@ -3,13 +3,7 @@ set TEST_NAME "$subdir/end1b" if {![installtest_p]} { untested $TEST_NAME; return } -# Look for stap_merge in the toplevel build directory -# and if that fails, use "which" to try to find a copy -# in the path. -set stap_merge_path "$srcdir/../runtime/staprun/stap_merge.tcl" -if (![file executable $stap_merge_path]) { - catch {exec which stap_merge} stap_merge_path -} +set stap_merge_path "$srcdir/$subdir/stap_merge.tcl" if (![file executable $stap_merge_path]) { fail "$TEST_NAME : could not find stap_merge" return diff --git a/testsuite/systemtap.printf/mixed_outb.exp b/testsuite/systemtap.printf/mixed_outb.exp index 6d352dd4..6f591c45 100644 --- a/testsuite/systemtap.printf/mixed_outb.exp +++ b/testsuite/systemtap.printf/mixed_outb.exp @@ -3,13 +3,7 @@ set TEST_NAME "$subdir/mixed_outb" if {![installtest_p]} { untested $TEST_NAME; return } -# Look for stap_merge in the toplevel build directory -# and if that fails, use "which" to try to find a copy -# in the path. -set stap_merge_path "$srcdir/../runtime/staprun/stap_merge.tcl" -if (![file executable $stap_merge_path]) { - catch {exec which stap_merge} stap_merge_path -} +set stap_merge_path "$srcdir/$subdir/stap_merge.tcl" if (![file executable $stap_merge_path]) { fail "$TEST_NAME : could not find stap_merge" return diff --git a/testsuite/systemtap.printf/out1b.exp b/testsuite/systemtap.printf/out1b.exp index 723238c5..0de48546 100644 --- a/testsuite/systemtap.printf/out1b.exp +++ b/testsuite/systemtap.printf/out1b.exp @@ -3,13 +3,7 @@ set TEST_NAME "$subdir/out1b" if {![installtest_p]} { untested $TEST_NAME; return } -# Look for stap_merge in the toplevel build directory -# and if that fails, use "which" to try to find a copy -# in the path. -set stap_merge_path "$srcdir/../runtime/staprun/stap_merge.tcl" -if (![file executable $stap_merge_path]) { - catch {exec which stap_merge} stap_merge_path -} +set stap_merge_path "$srcdir/$subdir/stap_merge.tcl" if (![file executable $stap_merge_path]) { fail "$TEST_NAME : could not find stap_merge" return diff --git a/testsuite/systemtap.printf/out2b.exp b/testsuite/systemtap.printf/out2b.exp index 085cfa14..883deedc 100644 --- a/testsuite/systemtap.printf/out2b.exp +++ b/testsuite/systemtap.printf/out2b.exp @@ -3,13 +3,7 @@ set TEST_NAME "$subdir/out2b" if {![installtest_p]} { untested $TEST_NAME; return } -# Look for stap_merge in the toplevel build directory -# and if that fails, use "which" to try to find a copy -# in the path. -set stap_merge_path "$srcdir/../runtime/staprun/stap_merge.tcl" -if (![file executable $stap_merge_path]) { - catch {exec which stap_merge} stap_merge_path -} +set stap_merge_path "$srcdir/$subdir/stap_merge.tcl" if (![file executable $stap_merge_path]) { fail "$TEST_NAME : could not find stap_merge" return diff --git a/testsuite/systemtap.printf/out3b.exp b/testsuite/systemtap.printf/out3b.exp index 395363fc..dfafc170 100644 --- a/testsuite/systemtap.printf/out3b.exp +++ b/testsuite/systemtap.printf/out3b.exp @@ -3,13 +3,7 @@ set TEST_NAME "$subdir/out3b" if {![installtest_p]} { untested $TEST_NAME; return } -# Look for stap_merge in the toplevel build directory -# and if that fails, use "which" to try to find a copy -# in the path. -set stap_merge_path "$srcdir/../runtime/staprun/stap_merge.tcl" -if (![file executable $stap_merge_path]) { - catch {exec which stap_merge} stap_merge_path -} +set stap_merge_path "$srcdir/$subdir/stap_merge.tcl" if (![file executable $stap_merge_path]) { fail "$TEST_NAME : could not find stap_merge" return diff --git a/testsuite/systemtap.printf/stap_merge.tcl b/testsuite/systemtap.printf/stap_merge.tcl new file mode 100755 index 00000000..47d419ce --- /dev/null +++ b/testsuite/systemtap.printf/stap_merge.tcl @@ -0,0 +1,102 @@ +#!/usr/bin/env tclsh +# +# stap_merge.tcl - systemtap merge program +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Copyright (C) Red Hat Inc, 2007 +# +# + +proc usage {} { + puts stderr "$::argv0 \[-v\] \[-o output_filename\] input_files ...\n" + exit 1 +} + +set outfile "stdout" +set verbose 0 +set index 0 +while {[string match -* [lindex $argv $index]]} { + switch -glob -- [lindex $argv $index] { + -v {set verbose 1} + -o {incr index; set outfile [lindex $argv $index]} + default {usage} + } + incr index +} + +if {$tcl_platform(byteOrder) == "littleEndian"} { + set int_format i +} else { + set int_format I +} + +set files [lrange $argv $index end] + +set n 0 +foreach file $files { + if {[catch {open $file} fd($n)]} { + puts stderr $fd($n) + exit 1 + } + fconfigure $fd($n) -translation binary + if {![binary scan [read $fd($n) 4] $int_format timestamp($n)]} { + continue + } + set timestamp($n) [expr $timestamp($n) & 0xFFFFFFFF] + incr n +} +set ncpus $n + +if {$outfile != "stdout"} { + if {[catch {open $outfile w} outfile]} { + puts stderr $outfile + exit 1 + } +} +fconfigure $outfile -translation binary + +while {1} { + set mincpu -1 + for {set n 0} {$n < $ncpus} {incr n} { + if {[info exists fd($n)] && (![info exists min] || $timestamp($n) <= $min)} { + set min $timestamp($n) + set mincpu $n + } + } + + if {![info exists min]} {break} + + if {![binary scan [read $fd($mincpu) 4] $int_format len]} { + puts stderr "Error reading length from channel $mincpu" + exit 1 + } + + if {$verbose == 1} { + puts stderr "\[CPU:$mincpu, seq=$min, length=$len\]" + } + + set data [read $fd($mincpu) $len] + puts -nonewline $outfile $data + + set data [read $fd($mincpu) 4] + if {$data == ""} { + unset fd($mincpu) + } else { + binary scan $data $int_format timestamp($mincpu) + set timestamp($mincpu) [expr $timestamp($mincpu) & 0xFFFFFFFF] + } + unset min +} -- cgit From 3f545051d7334d4afcc95cca9f9de33a07462f44 Mon Sep 17 00:00:00 2001 From: hiramatu Date: Wed, 6 Feb 2008 17:30:41 +0000 Subject: 2008-02-06 Masami Hiramatsu * systemtap.base/procfs.exp: Added PROCFS.ko cleanup. * systemtap.context/context.exp: Added cleanup call. * systemtap.printf/end1b.exp: Passed evaluated command string to as_root. * systemtap.printf/mixed_outb.exp: Ditto. * systemtap.printf/out1b.exp: Ditto. * systemtap.printf/out2b.exp: Ditto. * systemtap.printf/out3b.exp: Ditto. --- testsuite/systemtap.printf/end1b.exp | 8 ++++---- testsuite/systemtap.printf/mixed_outb.exp | 8 ++++---- testsuite/systemtap.printf/out1b.exp | 8 ++++---- testsuite/systemtap.printf/out2b.exp | 8 ++++---- testsuite/systemtap.printf/out3b.exp | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'testsuite/systemtap.printf') diff --git a/testsuite/systemtap.printf/end1b.exp b/testsuite/systemtap.printf/end1b.exp index e23d6bc7..e28dce5b 100644 --- a/testsuite/systemtap.printf/end1b.exp +++ b/testsuite/systemtap.printf/end1b.exp @@ -18,24 +18,24 @@ if {[catch {exec mktemp -t staptestXXXXX} tmpfile]} { if {[catch {exec stap -b -o $tmpfile $test} res]} { untested $TEST_NAME puts "stap failed: $res" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {eval [list exec $stap_merge_path -o $tmpfile] [glob "${tmpfile}_*"]} res]} { puts "merge failed: $res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {exec cmp $tmpfile $srcdir/$subdir/large_output} res]} { puts "$res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } pass "$TEST_NAME passed" -as_root {/bin/rm -f [glob ${tmpfile}*]} +as_root "/bin/rm -f [glob ${tmpfile}*]" diff --git a/testsuite/systemtap.printf/mixed_outb.exp b/testsuite/systemtap.printf/mixed_outb.exp index 6f591c45..748dd0f2 100644 --- a/testsuite/systemtap.printf/mixed_outb.exp +++ b/testsuite/systemtap.printf/mixed_outb.exp @@ -18,24 +18,24 @@ if {[catch {exec mktemp -t staptestXXXXX} tmpfile]} { if {[catch {exec stap -DMAXACTION=100000 -b -o $tmpfile $test} res]} { untested $TEST_NAME puts "stap failed: $res" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {eval [list exec $stap_merge_path -o $tmpfile] [glob "${tmpfile}_*"]} res]} { puts "merge failed: $res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {exec cmp $tmpfile $srcdir/$subdir/large_output} res]} { puts "$res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } pass "$TEST_NAME passed" -as_root {/bin/rm -f [glob ${tmpfile}*]} +as_root "/bin/rm -f [glob ${tmpfile}*]" diff --git a/testsuite/systemtap.printf/out1b.exp b/testsuite/systemtap.printf/out1b.exp index 0de48546..6edb8772 100644 --- a/testsuite/systemtap.printf/out1b.exp +++ b/testsuite/systemtap.printf/out1b.exp @@ -18,24 +18,24 @@ if {[catch {exec mktemp -t staptestXXXXX} tmpfile]} { if {[catch {exec stap -b -o $tmpfile $test} res]} { untested $TEST_NAME puts "stap failed: $res" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {eval [list exec $stap_merge_path -o $tmpfile] [glob "${tmpfile}_*"]} res]} { puts "merge failed: $res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {exec cmp $tmpfile $srcdir/$subdir/large_output} res]} { puts "$res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } pass "$TEST_NAME passed" -as_root {/bin/rm -f [glob ${tmpfile}*]} +as_root "/bin/rm -f [glob ${tmpfile}*]" diff --git a/testsuite/systemtap.printf/out2b.exp b/testsuite/systemtap.printf/out2b.exp index 883deedc..fc3301ab 100644 --- a/testsuite/systemtap.printf/out2b.exp +++ b/testsuite/systemtap.printf/out2b.exp @@ -18,24 +18,24 @@ if {[catch {exec mktemp -t staptestXXXXX} tmpfile]} { if {[catch {exec stap -b -o $tmpfile $test} res]} { untested $TEST_NAME puts "stap failed: $res" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {eval [list exec $stap_merge_path -o $tmpfile] [glob "${tmpfile}_*"]} res]} { puts "merge failed: $res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {exec cmp $tmpfile $srcdir/$subdir/large_output} res]} { puts "$res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } pass "$TEST_NAME passed" -as_root {/bin/rm -f [glob ${tmpfile}*]} +as_root "/bin/rm -f [glob ${tmpfile}*]" diff --git a/testsuite/systemtap.printf/out3b.exp b/testsuite/systemtap.printf/out3b.exp index dfafc170..af0d6be7 100644 --- a/testsuite/systemtap.printf/out3b.exp +++ b/testsuite/systemtap.printf/out3b.exp @@ -18,24 +18,24 @@ if {[catch {exec mktemp -t staptestXXXXX} tmpfile]} { if {[catch {exec stap -DMAXACTION=100000 -b -o $tmpfile $test} res]} { untested $TEST_NAME puts "stap failed: $res" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {eval [list exec $stap_merge_path -o $tmpfile] [glob "${tmpfile}_*"]} res]} { puts "merge failed: $res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } if {[catch {exec cmp $tmpfile $srcdir/$subdir/large_output} res]} { puts "$res" fail "$TEST_NAME failed" - as_root {/bin/rm -f [glob ${tmpfile}*]} + as_root "/bin/rm -f [glob ${tmpfile}*]" return } pass "$TEST_NAME passed" -as_root {/bin/rm -f [glob ${tmpfile}*]} +as_root "/bin/rm -f [glob ${tmpfile}*]" -- cgit