diff options
Diffstat (limited to 'testsuite')
34 files changed, 572 insertions, 29 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index c951971b..fa6e4fad 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,49 @@ +2008-05-21 Frank Ch. Eigler <fche@elastic.org> + + PR 6538 + * buildok/ioscheduler.stp, nine.stp, scsi.stp, sixteen.stp, + socket.stp, stat_insert.stp: Adapt to new warnings. + * systemtap.maps/linear_empty.exp, systemtap.samples/args.exp, + systemtap.samples/poll_map.stp, systemtap.string/strtol.stp: Ditto. + +2008-05-20 Frank Ch. Eigler <fche@elastic.org> + + PR 6538 + * systemtap.base/warnings.*: New tests. + * buildok/eleven.stp, systemtap.examples/disktop.stp, + transok/three.stp: Adapt to new warnings. + +2008-05-21 Stan Cox <scox@redhat.com> + + * systemtap.base/optim_arridx.stp: Test compound assignment and + binary expression. + * systemtap.base/optim_arridx.exp: Likewise. + (optim_arridx_run): Don't check warnings. + +2008-05-21 Mark Wielaard <mwielaard@redhat.com> + + * buildok/aux_syscalls-embedded.stp: Don't check _struct_utimbuf_u + and _struct_compat_utimbuf_u. Check new _struct_utimbuf_actime, + _struct_utimbuf_modtime, _struct_compat_utimbuf_actime and + _struct_compat_utimbuf_modtime. + +2008-05-20 Mark Wielaard <mwielaard@redhat.com> + + PR 5001 + * systemtap.syscall/futimes.c (utime): Expect new time format. + * systemtap.syscall/stat.c (utime): Likewise. + +2008-05-19 Mark Wielaard <mwielaard@redhat.com> + + PR 6524 + * systemtap.base/ctime.stp: New test. + * systemtap.base/ctime.exp: New expect file. + +2008-05-19 Stan Cox <scox@redhat.com> + + * systemtap.base/optim_arridx.stp: New test. + * systemtap.base/optim_arridx.exp: New test. + 2008-04-29 Frank Ch. Eigler <fche@elastic.org> PR 6466. diff --git a/testsuite/buildok/aux_syscalls-embedded.stp b/testsuite/buildok/aux_syscalls-embedded.stp index 2b552801..ce00893d 100755 --- a/testsuite/buildok/aux_syscalls-embedded.stp +++ b/testsuite/buildok/aux_syscalls-embedded.stp @@ -4,8 +4,10 @@ probe begin { print (_struct_timeval_u(0,0)) print (_struct_compat_timeval_u(0,0)) print (_struct_timezone_u (0)) - print (_struct_utimbuf_u(0)) - print (_struct_compat_utimbuf_u(0)) + print (_struct_utimbuf_actime(0)) + print (_struct_utimbuf_modtime(0)) + print (_struct_compat_utimbuf_actime(0)) + print (_struct_compat_utimbuf_modtime(0)) print (_struct_timespec_u(0,0)) print (_struct_compat_timespec_u(0,0)) print (_struct_itimerspec_u(0)) diff --git a/testsuite/buildok/eleven.stp b/testsuite/buildok/eleven.stp index 66d4a318..e6627fdc 100755 --- a/testsuite/buildok/eleven.stp +++ b/testsuite/buildok/eleven.stp @@ -3,15 +3,17 @@ probe begin { a = -1 / -1; - b = 2147483647; - c = 4294967295 / a; + b = 2147483647 + a; + c = 4294967295 / b; d = (-2147483647-1) % c; - e = 9223372036854775807 * b; - d /= b % e; - b %= 0 / f; - x = 1 / 0; + e = 9223372036854775807 * d; + f /= b % e; + g %= 0 / f; + h = 1 / 0; + println (h) } probe end { y %= 0; + println (y) } diff --git a/testsuite/buildok/ioscheduler.stp b/testsuite/buildok/ioscheduler.stp index 7a39c455..2d88d2d5 100755 --- a/testsuite/buildok/ioscheduler.stp +++ b/testsuite/buildok/ioscheduler.stp @@ -1,4 +1,6 @@ -#! stap -p4 +#! stap -wp4 + +# PR6538: "-w" is above since disk_major/disk_minor are not defined by all aliases. probe ioscheduler.* { diff --git a/testsuite/buildok/nine.stp b/testsuite/buildok/nine.stp index d9a15276..a0ca1d40 100755 --- a/testsuite/buildok/nine.stp +++ b/testsuite/buildok/nine.stp @@ -4,5 +4,5 @@ function f () { } function g (arg) { } probe begin { - true ? f() : g(1); + (true=1) ? f() : g(1); } diff --git a/testsuite/buildok/scsi.stp b/testsuite/buildok/scsi.stp index 6f60de2f..dfe855de 100755 --- a/testsuite/buildok/scsi.stp +++ b/testsuite/buildok/scsi.stp @@ -23,7 +23,7 @@ probe scsi.iodispatching { printf("ppname: %s, %d, %d, %d, %d, %d, %d, %p, %d\n", probefunc(), host_no, channel, lun, dev_id, device_state, data_direction, - request_buffer, req_bufflen) + request_buffer, request_bufflen) } diff --git a/testsuite/buildok/sixteen.stp b/testsuite/buildok/sixteen.stp index 0e313fa8..97721a2d 100755 --- a/testsuite/buildok/sixteen.stp +++ b/testsuite/buildok/sixteen.stp @@ -3,7 +3,7 @@ global a function foo () { - if (a[k] == "sayonara") { return 2 } + if (a[4] == "sayonara") { return 2 } } diff --git a/testsuite/buildok/socket.stp b/testsuite/buildok/socket.stp index 4b9142a9..5ada4018 100755 --- a/testsuite/buildok/socket.stp +++ b/testsuite/buildok/socket.stp @@ -1,4 +1,4 @@ -#! stap -p4 +#! stap -wp4 probe socket.send, socket.receive, socket.sendmsg, socket.sendmsg.return, @@ -33,7 +33,7 @@ probe socket.send, socket.receive, typ = sock_type_str2num(tstr) log(sprintf("%d, %d, %s", type, typ, tstr)) - log(sprintf("%d", success)) + log(sprintf("%d", success)) # -w since success is not universally defined } diff --git a/testsuite/buildok/stat_insert.stp b/testsuite/buildok/stat_insert.stp index 4039a190..7d7eb98e 100755 --- a/testsuite/buildok/stat_insert.stp +++ b/testsuite/buildok/stat_insert.stp @@ -15,8 +15,8 @@ function wibble() i = 0 logmap[i++, "stewed"] <<< 1 logmap[i++, "boiled"] <<< 1 + 2 - logmap[i++, "baked"] <<< x - logmap[i++, "fried"] <<< (x * y) + 3 + logmap[i++, "baked"] <<< (x = 0) + logmap[i++, "fried"] <<< (x * (y=2)) + 3 } function wobble() diff --git a/testsuite/systemtap.base/ctime.exp b/testsuite/systemtap.base/ctime.exp new file mode 100644 index 00000000..f6db096a --- /dev/null +++ b/testsuite/systemtap.base/ctime.exp @@ -0,0 +1,18 @@ +set test "ctime" +set ::result_string {Thu Jan 1 00:00:00 1970 +Wed Dec 31 23:59:59 1969 +Thu Jan 1 00:00:01 1970 +Sat Mar 3 09:46:40 1973 +Fri Feb 13 23:31:30 2009 +Sat Jan 10 13:37:04 2004 +Fri Jul 13 11:01:20 2012 +a long, long time ago... +far far in the future... +Fri Dec 13 20:45:52 1901 +a long, long time ago... +Tue Jan 19 03:14:07 2038 +far far in the future... +a long, long time ago... +far far in the future... +} +stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.base/ctime.stp b/testsuite/systemtap.base/ctime.stp new file mode 100644 index 00000000..680baff7 --- /dev/null +++ b/testsuite/systemtap.base/ctime.stp @@ -0,0 +1,55 @@ +probe begin +{ + // epoch + println(ctime(0)) + + // epoch - 1 + println(ctime(-1)) + + // epoch + 1 + println(ctime(1)) + + // Some funny numbers + println(ctime(100000000)) + println(ctime(1234567890)) + println(ctime(1073741824)) + println(ctime(0x50000000)) + + // some time really long ago + secspermin = 60 + minsperhour = 60 + hoursperday = 24 + secsperhour = secspermin * minsperhour + secsperday = secsperhour * hoursperday + epoch_year = 1970 + time = -1 * (epoch_year - 1000) * 365 * secsperday + println(ctime(time)) + + // some time in the far future + time = (9999 - epoch_year) * 365 * secsperday + println(ctime(time)) + + // min 32 bit + time = -2147483648 + println(ctime(time)) + + // over the edge, a long, long time ago... + time-- + println(ctime(time)) + + // max 32 bit + time = 2147483647 + println(ctime(time)) + + // over the edge, far far in the future... + time++ + println(ctime(time)) + + // min 64 bit + println(ctime(-9223372036854775808)) + + // max 64 bit + println(ctime(9223372036854775807)) + + exit() +} diff --git a/testsuite/systemtap.base/optim_arridx.exp b/testsuite/systemtap.base/optim_arridx.exp new file mode 100644 index 00000000..0987dec6 --- /dev/null +++ b/testsuite/systemtap.base/optim_arridx.exp @@ -0,0 +1,77 @@ +# test integer limits. Set and print variables and print constants. + +set test "optim_arridx" +set ::result_string {# globals +arr1:long [long, long] +arr2:long [long] +arr3:long [long] +# functions +fna:long (a:long) +return a +fnb:long (a:long, b:long) +return (a) + (b) +exit:unknown () +%{ + atomic_set (&session_state, STAP_SESSION_STOPPING); + _stp_exit (); +%} +# probes +begin /* <- begin */ + # locals + idx2:long + j:long + k:long + b:long + m:long + arr1:long [long] + arr2:long [long, long] + aa:long + bb:long + cc:long + dd:long + ee:long +{ +(arr2[(idx2) = (2)]) = (20) +(arr2[(j) = (4)]) = (40) +(arr1[fna((k) = (0)), k]) = (1) +(arr1[(b) = (1), b]) = (2) +fnb((arr3[0]) = (4), arr3[0]) +(m) = (1) +for (2; (m) <= (10); (m)++) ; +printf("%d %d %d %d\\n", arr1[0], arr2[0, 0], idx2, j) +(aa) = (fna(1)) +(bb) = (fnb((cc) = (1), 2)) +for (1; (bb) < (10); (bb)++) (cc) += (bb) +for ((dd) = (1); (dd) < (10); 1) (dd) += (1) +if (1) (ee) = (1) + +(cc) = ((dd) = (5)) +(cc) = ((4) + ((cc) = (1))) +printf("%d %d %d %d %d", aa, bb, cc, dd, ee) +exit() +} +} + +proc optim_arridx_run { TEST_NAME args } { + # zap the srcdir prefix + set test_file_name $TEST_NAME + set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""] + + set cmd [concat stap $args $test_file_name] + catch {eval exec $cmd} res + + set n 0 + set expected [split $::result_string "\n"] + foreach line [split $res "\n"] { + if {![string equal $line [lindex $expected $n]]} { + fail "$TEST_NAME" + send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\"\n" + send_log "Got \"$line\"\n" + return + } + incr n + } + pass "$TEST_NAME" +} + +optim_arridx_run $srcdir/$subdir/$test.stp -p2 -v 2>/dev/null diff --git a/testsuite/systemtap.base/optim_arridx.stp b/testsuite/systemtap.base/optim_arridx.stp new file mode 100644 index 00000000..20710c7f --- /dev/null +++ b/testsuite/systemtap.base/optim_arridx.stp @@ -0,0 +1,45 @@ +global arr1, arr2, arr3, elide_idx1, elide_global_a, elide_global_b + +function fna(a:long) {return a} +function fnb(a:long, b:long) {return a+b} + +probe begin { + // array indices + arr2[elide_idx1 = 1] = 10 + arr2[idx2 = 2] = 20 + arr2[elide_i=3] = 30 + arr2[j=4] = 40 + arr1[fna(k = 0), k] = 1 + arr1[b = 1, b] = 2 + arr1[elide_c = 2,2] = 3 + fnb(arr3[0] = 4, arr3[0]) + m = 1 + for (elide_n=2; m <= 10; m++) + arr2[m] = m * 10 + printf ("%d %d %d %d\n", arr1[0], arr2[0,0], idx2, j) + + // function args + aa = fna(elide_aa = 1) + bb = fnb(cc = 1, elide_global_a = 2) + + // loop + for (elide_bb = 1; bb < 10; bb++) + cc += bb + for (dd = 1; dd < 10; elide_ee = 1) + dd += 1 + + // conditional + if (elide_ff = 0) + elide_ff = 1 + if (elide_global_b = 1) + ee = 1 + + // compound assignment + cc = elide_gg=dd=5 + + // binary expression + cc = ((elide_hh = 4) + (cc = 1)) + + printf("%d %d %d %d %d", aa, bb, cc, dd, ee) + exit () +} diff --git a/testsuite/systemtap.base/warnings.exp b/testsuite/systemtap.base/warnings.exp index 025bde89..6cff723d 100644 --- a/testsuite/systemtap.base/warnings.exp +++ b/testsuite/systemtap.base/warnings.exp @@ -9,7 +9,7 @@ expect { eof { } } wait -if {$ok == 9} { +if {$ok == 22} { pass $test } else { fail "$test ($ok)" diff --git a/testsuite/systemtap.base/warnings.stp b/testsuite/systemtap.base/warnings.stp index a0ce8d8d..a2ac5afc 100644 --- a/testsuite/systemtap.base/warnings.stp +++ b/testsuite/systemtap.base/warnings.stp @@ -1,9 +1,8 @@ -# PR 1119 +# PR 1119, 6538 global elide_me1 - function elide_me2 () {} - function foo:long () { elide_me3 = 1 } - +function bar() { print(elide+me1) ; ; ; } probe never { elide_me4 = 1; (elide_me5+5); print (foo()) } +probe never { print(elide+me1) bar () } diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog index 41b70135..743e7adf 100644 --- a/testsuite/systemtap.examples/ChangeLog +++ b/testsuite/systemtap.examples/ChangeLog @@ -1,3 +1,11 @@ +2008-05-20 William Cohen <wcohen@redhat.com> + + * io_submit.stp, io_submit.meta: + * traceio.stp, traceio.meta: + * iotop.stp, iotop.meta: + * disktop.stp, disktop.meta: + * sigkill.stp, sigkill.meta: New. + 2008-05-09 William Cohen <wcohen@redhat.com> * syscalls_by_pid.meta, syscalls_by_proc.meta: diff --git a/testsuite/systemtap.examples/disktop.meta b/testsuite/systemtap.examples/disktop.meta new file mode 100644 index 00000000..b063075b --- /dev/null +++ b/testsuite/systemtap.examples/disktop.meta @@ -0,0 +1,13 @@ +title: Summarize Disk Read/Write Traffic +name: disktop.stp +version: 1.0 +author: Oracle +keywords: disk +subsystem: disk +status: production +exit: user-controlled +output: timed +scope: system-wide +description: Get the status of reading/writing disk every 5 seconds, output top ten entries during that period. +test_check: stap -p4 disktop.stp +test_installcheck: stap disktop.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/disktop.stp b/testsuite/systemtap.examples/disktop.stp new file mode 100644 index 00000000..2637d735 --- /dev/null +++ b/testsuite/systemtap.examples/disktop.stp @@ -0,0 +1,69 @@ +#!/usr/bin/env stap +# +# Copyright (C) 2007 Oracle Corp. +# +# Get the status of reading/writing disk every 5 seconds, output top ten entries +# +# This is free software,GNU General Public License (GPL); either version 2, or (at your option) any +# later version. +# +# Usage: +# ./disktop.stp +# + +global io_stat,device +global read_bytes,write_bytes + +probe kernel.function("vfs_read").return { + if ($return>0) { + dev = __file_dev($file) + devname = __find_bdevname(dev,__file_bdev($file)) + + if (devname!="N/A") {/*skip read from cache*/ + io_stat[pid(),execname(),uid(),ppid(),"R"] += $return + device[pid(),execname(),uid(),ppid(),"R"] = devname + read_bytes += $return + } + } +} + +probe kernel.function("vfs_write").return { + if ($return>0) { + dev = __file_dev($file) + devname = __find_bdevname(dev,__file_bdev($file)) + + if (devname!="N/A") { /*skip update cache*/ + io_stat[pid(),execname(),uid(),ppid(),"W"] += $return + device[pid(),execname(),uid(),ppid(),"W"] = devname + write_bytes += $return + } + } +} + +probe timer.ms(5000) { + /* skip non-read/write disk */ + if (read_bytes+write_bytes) { + + printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n",ctime(gettimeofday_s()),"Average:", + ((read_bytes+write_bytes)/1024)/5,"Read:",read_bytes/1024,"Write:",write_bytes/1024) + + /* print header */ + printf("%8s %8s %8s %25s %8s %4s %12s\n","UID","PID","PPID","CMD","DEVICE","T","BYTES") + } + /* print top ten I/O */ + foreach ([process,cmd,userid,parent,action] in io_stat- limit 10) + printf("%8d %8d %8d %25s %8s %4s %12d\n",userid,process,parent,cmd,device[process,cmd,userid,parent,action],action,io_stat[process,cmd,userid,parent,action]) + + /* clear data */ + delete io_stat + delete device + read_bytes = 0 + write_bytes = 0 +} + +probe end{ + delete io_stat + delete device + delete read_bytes + delete write_bytes +} diff --git a/testsuite/systemtap.examples/io_submit.meta b/testsuite/systemtap.examples/io_submit.meta new file mode 100644 index 00000000..911cb837 --- /dev/null +++ b/testsuite/systemtap.examples/io_submit.meta @@ -0,0 +1,13 @@ +title: Tally Reschedule Reason During AIO io_submit Call +name: io_submit.stp +version: 1.0 +author: Oracle +keywords: io backtrace +subsystem: io +status: production +exit: user-controlled +output: sorted on-exit +scope: system-wide +description: When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace. +test_check: stap -p4 io_submit.stp +test_installcheck: stap io_submit.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io_submit.stp b/testsuite/systemtap.examples/io_submit.stp new file mode 100644 index 00000000..735dd6f9 --- /dev/null +++ b/testsuite/systemtap.examples/io_submit.stp @@ -0,0 +1,71 @@ +#!/bin/env stap
+#
+# Copyright (C) 2007 Oracle Corp. Chris Mason <chris.mason@oracle.com>
+#
+# This was implemented to find the most common causes of schedule during
+# the AIO io_submit call. It does this by recording which pids are inside
+# AIO, and recording the current stack trace if one of those pids is
+# inside schedule.
+# When the probe exits, it prints out the 30 most common call stacks for
+# schedule().
+#
+# This file is free software. You can redistribute it and/or modify it under
+# the terms of the GNU General Public License (GPL); either version 2, or (at
+# your option) any later version.
+
+global in_iosubmit
+global traces
+
+/*
+ * add a probe to sys_io_submit, on entry, record in the in_iosubmit
+ * hash table that this proc is in io_submit
+ */
+probe syscall.io_submit {
+ in_iosubmit[tid()] = 1
+}
+
+/*
+ * when we return from sys_io_submit, record that we're no longer there
+ */
+probe syscall.io_submit.return {
+ /* this assumes a given proc will do lots of io_submit calls, and
+ * so doesn't do the more expensive "delete in_iosubmit[p]". If
+ * there are lots of procs doing small number of io_submit calls,
+ * the hash may grow pretty big, so using delete may be better
+ */
+ in_iosubmit[tid()] = 0
+}
+
+/*
+ * every time we call schedule, check to see if we started off in
+ * io_submit. If so, record our backtrace into the traces histogram
+ */
+probe kernel.function("schedule") {
+ if (tid() in in_iosubmit) {
+ traces[backtrace()]++
+
+ /*
+ * change this to if (1) if you want a backtrace every time
+ * you go into schedule from io_submit. Unfortunately, the traces
+ * saved into the traces histogram above are truncated to just a
+ * few lines. so the only way to see the full trace is via the
+ * more verbose print_backtrace() right here.
+ */
+ if (0) {
+ printf("schedule in io_submit!\n")
+ print_backtrace()
+ }
+ }
+}
+
+/*
+ * when stap is done (via ctrl-c) go through the record of all the
+ * trace paths and print the 30 most common.
+ */
+probe end {
+ foreach (stack in traces- limit 30) {
+ printf("%d:", traces[stack])
+ print_stack(stack);
+ }
+}
+
diff --git a/testsuite/systemtap.examples/iotop.meta b/testsuite/systemtap.examples/iotop.meta new file mode 100644 index 00000000..4eba0130 --- /dev/null +++ b/testsuite/systemtap.examples/iotop.meta @@ -0,0 +1,13 @@ +title: Periodically Print I/O Activity by Process Name +name: iotop.stp +version: 1.0 +author: anonymous +keywords: io +subsystem: io +status: production +exit: user-controlled +output: timed +scope: system-wide +description: Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in decending order. +test_check: stap -p4 iotop.stp +test_installcheck: stap iotop.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/iotop.stp b/testsuite/systemtap.examples/iotop.stp new file mode 100644 index 00000000..6050343c --- /dev/null +++ b/testsuite/systemtap.examples/iotop.stp @@ -0,0 +1,25 @@ +global reads, writes, total_io + +probe kernel.function("vfs_read") { + reads[execname()] += $count +} + +probe kernel.function("vfs_write") { + writes[execname()] += $count +} + +# print top 10 IO processes every 5 seconds +probe timer.s(5) { + foreach (name in writes) + total_io[name] += writes[name] + foreach (name in reads) + total_io[name] += reads[name] + printf ("%16s\t%10s\t%10s\n", "Process", "KB Read", "KB Written") + foreach (name in total_io- limit 10) + printf("%16s\t%10d\t%10d\n", name, + reads[name]/1024, writes[name]/1024) + delete reads + delete writes + delete total_io + print("\n") +} diff --git a/testsuite/systemtap.examples/sigkill.meta b/testsuite/systemtap.examples/sigkill.meta new file mode 100644 index 00000000..57032224 --- /dev/null +++ b/testsuite/systemtap.examples/sigkill.meta @@ -0,0 +1,14 @@ +title: Track SIGKILL Signals +name: sigkill.stp +version: 1.0 +author: Red Hat +keywords: signals +subsystem: signals +status: production +exit: user-controlled +output: trace +scope: systemwide +description: The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal. +arg_1: The name of the signal to look for on selected process. +test_check: stap -p4 sigkill.stp +test_installcheck: stap sigkill.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/sigkill.stp b/testsuite/systemtap.examples/sigkill.stp new file mode 100644 index 00000000..8f754219 --- /dev/null +++ b/testsuite/systemtap.examples/sigkill.stp @@ -0,0 +1,23 @@ +#!/usr/bin/env stap +# sigkill.stp +# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# /usr/share/systemtap/tapset/signal.stp: +# [...] +# probe signal.send = _signal.send.* +# { +# sig=$sig +# sig_name = _signal_name($sig) +# sig_pid = task_pid(task) +# pid_name = task_execname(task) +# [...] + +probe signal.send { + if (sig_name == "SIGKILL") + printf("%s was sent to %s (pid:%d) by %s uid:%d\n", + sig_name, pid_name, sig_pid, execname(), uid()) +} diff --git a/testsuite/systemtap.examples/traceio.meta b/testsuite/systemtap.examples/traceio.meta new file mode 100644 index 00000000..a82a26aa --- /dev/null +++ b/testsuite/systemtap.examples/traceio.meta @@ -0,0 +1,13 @@ +title: Track Cumulative I/O Activity by Process Name +name: traceio.stp +version: 1.0 +author: Red Hat +keywords: io +subsystem: io +status: production +exit: user-controlled +output: timed +scope: system-wide +description: Every second print out the top ten executables sorted in decending order based on cumulative I/O traffic observed. +test_check: stap -p4 traceio.stp +test_installcheck: stap traceio.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/traceio.stp b/testsuite/systemtap.examples/traceio.stp new file mode 100644 index 00000000..d3757c23 --- /dev/null +++ b/testsuite/systemtap.examples/traceio.stp @@ -0,0 +1,32 @@ +#!/usr/bin/env stap +# traceio.stp +# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# + +global reads, writes, total_io + +probe kernel.function("vfs_read").return { + reads[execname()] += $return +} + +probe kernel.function("vfs_write").return { + writes[execname()] += $return +} + +probe timer.s(1) { + foreach (p in reads) + total_io[p] += reads[p] + foreach (p in writes) + total_io[p] += writes[p] + foreach(p in total_io- limit 10) + printf("%15s r: %8d KiB w: %8d KiB\n", + p, reads[p]/1024, + writes[p]/1024) + printf("\n") + # Note we don't zero out reads, writes and total_io, + # so the values are cumulative since the script started. +} diff --git a/testsuite/systemtap.maps/absentstats.stp b/testsuite/systemtap.maps/absentstats.stp index aeb176a1..0968cd58 100644 --- a/testsuite/systemtap.maps/absentstats.stp +++ b/testsuite/systemtap.maps/absentstats.stp @@ -1,5 +1,9 @@ # stap -DMAXERRORS=40 +# NB: PR 6538 will cause systemtap to warn about the read-only globals; +# we can't help that though since the point of this test is to see what +# happens when an empty (never written-to) aggregate is queried. + global sc probe begin { println(@count(sc)) } probe begin { print(@sum(sc)) } diff --git a/testsuite/systemtap.maps/linear_empty.exp b/testsuite/systemtap.maps/linear_empty.exp index 9bcc64eb..88a53a31 100644 --- a/testsuite/systemtap.maps/linear_empty.exp +++ b/testsuite/systemtap.maps/linear_empty.exp @@ -4,6 +4,5 @@ set test "linear_empty" set ::result_string {count=0 } -stap_run2 $srcdir/$subdir/$test.stp - +stap_run2 $srcdir/$subdir/$test.stp -w diff --git a/testsuite/systemtap.samples/args.exp b/testsuite/systemtap.samples/args.exp index 8bed7c9e..6b1fd3d0 100644 --- a/testsuite/systemtap.samples/args.exp +++ b/testsuite/systemtap.samples/args.exp @@ -12,7 +12,7 @@ if [file exists $staprunpath] { } set modname "args_[pid]" -spawn stap -k -p4 -m $modname $srcdir/$subdir/args.stp +spawn stap -w -k -p4 -m $modname $srcdir/$subdir/args.stp set tmpdir NO_SUCH_FILE expect { -timeout 120 diff --git a/testsuite/systemtap.samples/poll_map.stp b/testsuite/systemtap.samples/poll_map.stp index fb6b16e6..cd39b433 100755 --- a/testsuite/systemtap.samples/poll_map.stp +++ b/testsuite/systemtap.samples/poll_map.stp @@ -6,7 +6,7 @@ global called, num_polls probe kernel.function( "sys_*" ).call { - called[execname(),name]++ + called[execname(),probefunc()]++ } probe timer.ms(1000) diff --git a/testsuite/systemtap.string/strtol.stp b/testsuite/systemtap.string/strtol.stp index dcd1fe71..4f579e7d 100644 --- a/testsuite/systemtap.string/strtol.stp +++ b/testsuite/systemtap.string/strtol.stp @@ -23,7 +23,6 @@ probe begin printf("%d\n", strtol(teststr9, 16)) printf("%d\n", strtol(teststr9, 8)) printf("%d\n", strtol(teststr9, 2)) - printf("%d\n", strtol(teststr10, 2)) exit() } diff --git a/testsuite/systemtap.syscall/futimes.c b/testsuite/systemtap.syscall/futimes.c index 359afad3..eca1efc7 100644 --- a/testsuite/systemtap.syscall/futimes.c +++ b/testsuite/systemtap.syscall/futimes.c @@ -31,7 +31,7 @@ int main() times.actime = 1000000000; times.modtime = 2000000000; syscall(__NR_utime, "foobar", × ); - // utime ("foobar", \[2001/09/09-01:46:40, 2033/05/18-03:33:20\]) + // utime ("foobar", \[Sun Sep 9 01:46:40 2001, Wed May 18 03:33:20 2033]) #endif /* __NR_utimes */ #ifdef __NR_utimes diff --git a/testsuite/systemtap.syscall/stat.c b/testsuite/systemtap.syscall/stat.c index deade3e0..6be5cc79 100644 --- a/testsuite/systemtap.syscall/stat.c +++ b/testsuite/systemtap.syscall/stat.c @@ -39,7 +39,7 @@ int main() #ifdef __ia64__ // utimes ("foobar", \[1.000000\]\[1135641600.000000\]) = #else - // utime ("foobar", \[1970/01/01-00:00:01, 2005/12/27-00:00:00\]) = 0 + // utime ("foobar", \[Thu Jan 1 00:00:01 1970, Tue Dec 27 00:00:00 2005\]) = 0 #endif ubuf.actime = 1135690000; @@ -48,7 +48,7 @@ int main() #ifdef __ia64__ // utimes ("foobar", \[1135690000.000000\]\[1135700000.000000\]) = #else - // utime ("foobar", \[2005/12/27-13:26:40, 2005/12/27-16:13:20\]) = 0 + // utime ("foobar", \[Tue Dec 27 13:26:40 2005, Tue Dec 27 16:13:20 2005\]) = 0 #endif return 0; } diff --git a/testsuite/transok/three.stp b/testsuite/transok/three.stp index 6e99b640..a7406db4 100755 --- a/testsuite/transok/three.stp +++ b/testsuite/transok/three.stp @@ -7,6 +7,7 @@ function f1 (a, b) { d = "hello"; # poo[c] = bab[d] = "hi" bab = "hi"; + poo [c+1] = c+2; bab = poo[c]; return 0 } |