summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-10-08 17:18:51 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-10-08 17:22:52 -0400
commit6987cb4306107994d06b0e653b9eac97388056bc (patch)
treee2fd08360ecae16f250243e3e4979438e3aafe2c
parent2e2516781661f5a4b41e4dc79d423250e057f271 (diff)
downloadsystemtap-steved-6987cb4306107994d06b0e653b9eac97388056bc.tar.gz
systemtap-steved-6987cb4306107994d06b0e653b9eac97388056bc.tar.xz
systemtap-steved-6987cb4306107994d06b0e653b9eac97388056bc.zip
testsuite: robustify check_* invocation of examples meta
testsuite/systemtap.examples/ * check.exp (extract_tag): Log extracted tags. Tolerate embedded '$'. (run_command): Pass through commands to sh -c without eval quoting. * README: Document "sh -c"-ness of check_* tags. * *.meta: Fix quoting, add a few check_support predicates.
-rw-r--r--testsuite/systemtap.examples/README6
-rw-r--r--testsuite/systemtap.examples/check.exp10
-rw-r--r--testsuite/systemtap.examples/general/para-callgraph.meta4
-rw-r--r--testsuite/systemtap.examples/io/iostat-scsi.meta2
-rw-r--r--testsuite/systemtap.examples/io/ttyspy.meta1
-rw-r--r--testsuite/systemtap.examples/locks/bkl.meta1
-rw-r--r--testsuite/systemtap.examples/locks/bkl_stats.meta1
-rw-r--r--testsuite/systemtap.examples/memory/mmanonpage.meta2
-rw-r--r--testsuite/systemtap.examples/memory/mmfilepage.meta2
-rw-r--r--testsuite/systemtap.examples/memory/mmreclaim.meta2
-rw-r--r--testsuite/systemtap.examples/memory/mmwriteback.meta2
-rw-r--r--testsuite/systemtap.examples/network/autofs4.meta2
-rw-r--r--testsuite/systemtap.examples/network/dropwatch.meta2
-rw-r--r--testsuite/systemtap.examples/network/tcpipstat.meta1
-rw-r--r--testsuite/systemtap.examples/process/schedtimes.meta2
15 files changed, 22 insertions, 18 deletions
diff --git a/testsuite/systemtap.examples/README b/testsuite/systemtap.examples/README
index 89586ece..cf500c54 100644
--- a/testsuite/systemtap.examples/README
+++ b/testsuite/systemtap.examples/README
@@ -88,9 +88,11 @@ examples. Discussions take place on the
system-wide or pid
arg_[0-9]+: Describe what the arguments into the script are. (optional)
description: A text description what the script does. (required)
- test_check: How to check that the example compiles.
+ test_support: How to check that the example is applicable. Run by 'sh -c COMMAND'.
+ (e.g. stap -l needed.probe)
+ test_check: How to check that the example compiles. Run by 'sh -c COMMAND'.
(e.g. stap -p4 iotime.stp)
- test_installcheck: How to check that the example runs.
+ test_installcheck: How to check that the example runs. Run by 'sh -c COMMAND'.
(e.g. stap iotime.stp -c "sleep 1")
diff --git a/testsuite/systemtap.examples/check.exp b/testsuite/systemtap.examples/check.exp
index 0fad597d..6e606718 100644
--- a/testsuite/systemtap.examples/check.exp
+++ b/testsuite/systemtap.examples/check.exp
@@ -25,10 +25,11 @@ proc get_meta_data { FILE } {
proc extract_tag { META_DATA TAG } {
set taglines ""
set value ""
- set expr "^$TAG:\[^\$\]*"
+ set expr "^$TAG: \[^\r\n\]*"
regexp -line -all $expr $META_DATA taglines
- set expr "$TAG:"
+ set expr "^$TAG: "
regsub -line $expr $taglines "" value
+ verbose -log "meta taglines '$taglines' tag '$TAG' value '$value'"
return $value
}
@@ -36,10 +37,7 @@ proc run_command { test action command } {
#FIXME tcl says that single quotes not dealt with
if { $command != "" } then {
verbose -log "attempting command $command"
- # Pipe both stdout and stderr to cat, otherwise any stderr
- # output results in res being set to 1 (TCL_ERROR). This breaks
- # scripts that have WARNINGS about for example skipped probes.
- set res [catch {eval exec "$command |& cat"} value]
+ set res [catch {exec sh -c $command 2>@1} value]
verbose -log "OUT $value"
verbose -log "RC $res"
if { $res != 0 } { # allow failure for support
diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta
index 84d1c93f..32f56ef2 100644
--- a/testsuite/systemtap.examples/general/para-callgraph.meta
+++ b/testsuite/systemtap.examples/general/para-callgraph.meta
@@ -3,5 +3,5 @@ name: para-callgraph.stp
keywords: trace callgraph
subsystem: general
description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.
-test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read")
-test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") -c "cat /proc/sys/vm/*"
+test_check: stap -p4 para-callgraph.stp 'kernel.function("*@fs/proc*.c")' 'kernel.function("vfs_read")'
+test_installcheck: stap para-callgraph.stp 'kernel.function("*@fs/proc*.c")' 'kernel.function("vfs_read")' -c "cat /proc/sys/vm/*"
diff --git a/testsuite/systemtap.examples/io/iostat-scsi.meta b/testsuite/systemtap.examples/io/iostat-scsi.meta
index a5fe7a8f..6aa4c5d9 100644
--- a/testsuite/systemtap.examples/io/iostat-scsi.meta
+++ b/testsuite/systemtap.examples/io/iostat-scsi.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: timed
scope: system-wide
description: The iostat-scsi.stp script provides a breakdown of the number of blks read and written on the machine's various SCSI devices. The script takes one argument which is the number of seconds between reports.
-test_support: stap -l module("st").function("st_do_scsi")!,kernel.function("st_do_scsi")
+test_support: stap -l 'module("st").function("st_do_scsi")!,kernel.function("st_do_scsi")'
test_check: stap -g -p4 iostat-scsi.stp 1
test_installcheck: stap -g iostat-scsi.stp 1 -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/io/ttyspy.meta b/testsuite/systemtap.examples/io/ttyspy.meta
index b190eafd..ea1c9040 100644
--- a/testsuite/systemtap.examples/io/ttyspy.meta
+++ b/testsuite/systemtap.examples/io/ttyspy.meta
@@ -2,5 +2,6 @@ title: Monitor tty typing.
name: ttyspy.stp
keywords: io tty per-process monitor
description: The ttyspy.stp script uses tty_audit hooks to monitor recent typing activity on the system, printing a scrolling record of recent keystrokes, on a per-tty basis.
+test_support: stap -l 'kernel.function("tty_audit_add_data")'
test_check: stap -gp4 ttyspy.stp
test_installcheck: stap --skip-badvars -g ttyspy.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/locks/bkl.meta b/testsuite/systemtap.examples/locks/bkl.meta
index 61bd4eb7..dd467fe7 100644
--- a/testsuite/systemtap.examples/locks/bkl.meta
+++ b/testsuite/systemtap.examples/locks/bkl.meta
@@ -6,5 +6,6 @@ author: Flavio Leitner
status: production
exit: user-controlled
description: The bkl.stp script can help determine whether the Big Kernel Lock (BKL) is causing serialization on a multiprocessor system due to excessive contention of the BKL. The bkl.stp script takes one argument which is the number of processes waiting for the Big Kernel Lock (BKL). When the number of processes waiting for the BKL is reached or exceeded, the script will print a time stamp, the number of processes waiting for the BKL, the holder of the BKL, and the amount of time the BKL was held.
+test_support: stap -l 'kernel.function("lock_kernel").return'
test_check: stap -p4 bkl.stp 1
test_installcheck: stap bkl.stp -c "sleep 0.2" 1
diff --git a/testsuite/systemtap.examples/locks/bkl_stats.meta b/testsuite/systemtap.examples/locks/bkl_stats.meta
index 6db6c72f..16ac2911 100644
--- a/testsuite/systemtap.examples/locks/bkl_stats.meta
+++ b/testsuite/systemtap.examples/locks/bkl_stats.meta
@@ -9,5 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent holding the lock for each of the processes.
+test_support: stap -l 'kernel.function("lock_kernel").return'
test_check: stap -p4 bkl_stats.stp
test_installcheck: stap bkl_stats.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/memory/mmanonpage.meta b/testsuite/systemtap.examples/memory/mmanonpage.meta
index eb2e9f57..96ddd3a3 100644
--- a/testsuite/systemtap.examples/memory/mmanonpage.meta
+++ b/testsuite/systemtap.examples/memory/mmanonpage.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. Its useful in debugging leaks in the anonymous regions of a process.
-test_support: stap -l kernel.trace("mm_page_allocation"),kernel.trace("mm_page_free"),kernel.trace("mm_anon_fault"),kernel.trace("mm_anon_pgin"),kernel.trace("mm_anon_cow"),kernel.trace("mm_anon_unmap"),kernel.trace("mm_anon_userfree")
+test_support: stap -l 'kernel.trace("mm_page_allocation"),kernel.trace("mm_page_free"),kernel.trace("mm_anon_fault"),kernel.trace("mm_anon_pgin"),kernel.trace("mm_anon_cow"),kernel.trace("mm_anon_unmap"),kernel.trace("mm_anon_userfree")'
test_check: stap -p4 mmanonpage.stp
test_installcheck: stap mmanonpage.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/memory/mmfilepage.meta b/testsuite/systemtap.examples/memory/mmfilepage.meta
index c26f0601..bc0e0429 100644
--- a/testsuite/systemtap.examples/memory/mmfilepage.meta
+++ b/testsuite/systemtap.examples/memory/mmfilepage.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.
-test_support: stap -l kernel.trace("mm_page_allocation"),kernel.trace("mm_page_free"),kernel.trace("mm_filemap_fault"),kernel.trace("mm_filemap_cow"),kernel.trace("mm_filemap_unmap"),kernel.trace("mm_filemap_userunmap")
+test_support: stap -l 'kernel.trace("mm_page_allocation"),kernel.trace("mm_page_free"),kernel.trace("mm_filemap_fault"),kernel.trace("mm_filemap_cow"),kernel.trace("mm_filemap_unmap"),kernel.trace("mm_filemap_userunmap")'
test_check: stap -p4 mmfilepage.stp
test_installcheck: stap mmfilepage.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/memory/mmreclaim.meta b/testsuite/systemtap.examples/memory/mmreclaim.meta
index c301d302..4b5c9de2 100644
--- a/testsuite/systemtap.examples/memory/mmreclaim.meta
+++ b/testsuite/systemtap.examples/memory/mmreclaim.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. Its useful is debugging performance problems that occur due to page reclamation.
-test_support: stap -l kernel.trace("mm_directreclaim_reclaimall"),kernel.trace("mm_pagereclaim_shrinkinactive"),kernel.trace("mm_pagereclaim_free"),kernel.trace("mm_pagereclaim_pgout"),kernel.trace("mm_pagereclaim_shrinkactive_a2a"),kernel.trace("mm_pagereclaim_shrinkinactive_i2a"),kernel.trace("mm_pagereclaim_shrinkactive_a2i"),kernel.trace("mm_pagereclaim_shrinkinactive_i2i")
+test_support: stap -l 'kernel.trace("mm_directreclaim_reclaimall"),kernel.trace("mm_pagereclaim_shrinkinactive"),kernel.trace("mm_pagereclaim_free"),kernel.trace("mm_pagereclaim_pgout"),kernel.trace("mm_pagereclaim_shrinkactive_a2a"),kernel.trace("mm_pagereclaim_shrinkinactive_i2a"),kernel.trace("mm_pagereclaim_shrinkactive_a2i"),kernel.trace("mm_pagereclaim_shrinkinactive_i2i")'
test_check: stap -p4 mmreclaim.stp
test_installcheck: stap mmreclaim.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/memory/mmwriteback.meta b/testsuite/systemtap.examples/memory/mmwriteback.meta
index dbcaa476..76cc53a7 100644
--- a/testsuite/systemtap.examples/memory/mmwriteback.meta
+++ b/testsuite/systemtap.examples/memory/mmwriteback.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. Its useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.
-test_support: stap -l kernel.trace("mm_pdflush_bgwriteout"),kernel.trace("mm_pdflush_kupdate"),kernel.trace("mm_pagereclaim_pgout")
+test_support: stap -l 'kernel.trace("mm_pdflush_bgwriteout"),kernel.trace("mm_pdflush_kupdate"),kernel.trace("mm_pagereclaim_pgout")'
test_check: stap -p4 mmwriteback.stp
test_installcheck: stap mmwriteback.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/network/autofs4.meta b/testsuite/systemtap.examples/network/autofs4.meta
index e0036481..4c721abf 100644
--- a/testsuite/systemtap.examples/network/autofs4.meta
+++ b/testsuite/systemtap.examples/network/autofs4.meta
@@ -4,6 +4,6 @@ name: autofs4.stp
author: Jeff Moyer
keywords: network autofs nfs
subsystem: network
-test_support: stap -l module("autofs4").function("autofs4_lookup"),module("autofs4").function("autofs4_follow_link"),module("autofs4").function("autofs4_expire_indirect").return,module("autofs4").function("autofs4_wait").return
+test_support: stap -l 'module("autofs4").function("autofs4_lookup"),module("autofs4").function("autofs4_follow_link"),module("autofs4").function("autofs4_expire_indirect").return,module("autofs4").function("autofs4_wait").return'
test_check: stap -p4 autofs4.stp
test_installcheck: stap autofs4.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/network/dropwatch.meta b/testsuite/systemtap.examples/network/dropwatch.meta
index 06d338c5..b75e3d33 100644
--- a/testsuite/systemtap.examples/network/dropwatch.meta
+++ b/testsuite/systemtap.examples/network/dropwatch.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: timed
scope: system-wide
description: Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.
-test_support: stap -l kernel.trace("kfree_skb")
+test_support: stap -l 'kernel.trace("kfree_skb")'
test_check: stap -p4 dropwatch.stp
test_installcheck: stap dropwatch.stp -c "sleep 0.2"
diff --git a/testsuite/systemtap.examples/network/tcpipstat.meta b/testsuite/systemtap.examples/network/tcpipstat.meta
index d77d0b2f..9e97ea5b 100644
--- a/testsuite/systemtap.examples/network/tcpipstat.meta
+++ b/testsuite/systemtap.examples/network/tcpipstat.meta
@@ -10,5 +10,6 @@ output: timed
scope: per-socket
arg_[0-9]+: tcpstat.stp [index=laddr|raddr|lport|rport|tuple] [timeout=<N sec>] [nozeros=1|0] [filters...]
description: tcpipstat collects and display network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets.
+test_support: stap -l 'tcpmib.InSegs'
test_check: stap -p4 tcpipstat.stp
test_installcheck: stap tcpipstat.stp timeout=1
diff --git a/testsuite/systemtap.examples/process/schedtimes.meta b/testsuite/systemtap.examples/process/schedtimes.meta
index 960d8eda..5315042a 100644
--- a/testsuite/systemtap.examples/process/schedtimes.meta
+++ b/testsuite/systemtap.examples/process/schedtimes.meta
@@ -9,6 +9,6 @@ exit: user-controlled
output: sorted-list
scope: system-wide
description: The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.
-test_support: stap -l kernel.trace("sched_switch"),kernel.trace("sched_wakeup")
+test_support: stap -l 'kernel.trace("sched_switch"),kernel.trace("sched_wakeup")'
test_check: stap -p4 schedtimes.stp
test_installcheck: stap schedtimes.stp -c "sleep 0.2"