diff options
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/buildok/process-all-probes.stp | 12 | ||||
-rwxr-xr-x | testsuite/buildok/process_test.stp | 12 | ||||
-rw-r--r-- | testsuite/systemtap.base/bitfield.exp | 3 | ||||
-rw-r--r-- | testsuite/systemtap.base/bitfield.stp | 46 | ||||
-rw-r--r-- | testsuite/systemtap.base/labels.exp | 15 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.txt | 8 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.html | 6 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.txt | 16 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/tcpdumplike.meta | 12 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/tcpdumplike.stp | 14 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/proc_snoop.stp | 12 | ||||
-rw-r--r-- | testsuite/systemtap.stress/whitelist.exp | 1 |
13 files changed, 142 insertions, 18 deletions
diff --git a/testsuite/buildok/process-all-probes.stp b/testsuite/buildok/process-all-probes.stp index 91a96514..c754462b 100755 --- a/testsuite/buildok/process-all-probes.stp +++ b/testsuite/buildok/process-all-probes.stp @@ -2,11 +2,11 @@ // Tests if all probes in the process tapset are resolvable. -probe process.create, - process.start, - process.exec, - process.exec_complete, - process.exit, - process.release +probe kprocess.create, + kprocess.start, + kprocess.exec, + kprocess.exec_complete, + kprocess.exit, + kprocess.release { } diff --git a/testsuite/buildok/process_test.stp b/testsuite/buildok/process_test.stp index 90de8b69..ba3fadf1 100755 --- a/testsuite/buildok/process_test.stp +++ b/testsuite/buildok/process_test.stp @@ -1,31 +1,31 @@ #! stap -p4 -probe process.create { +probe kprocess.create { log(pp()) log(sprint(task)) } -probe process.start { +probe kprocess.start { log(pp()) } -probe process.exec { +probe kprocess.exec { log(pp()) log(filename) } -probe process.exec_complete { +probe kprocess.exec_complete { log(pp()) log(sprint(errno)) log(sprint(success)) } -probe process.exit { +probe kprocess.exit { log(pp()) log(sprint(code)) } -probe process.release { +probe kprocess.release { log(pp()) log(sprint(task)) } diff --git a/testsuite/systemtap.base/bitfield.exp b/testsuite/systemtap.base/bitfield.exp new file mode 100644 index 00000000..16451369 --- /dev/null +++ b/testsuite/systemtap.base/bitfield.exp @@ -0,0 +1,3 @@ +# test that bitfield r/w works correctly +set test "bitfield" +stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string -g diff --git a/testsuite/systemtap.base/bitfield.stp b/testsuite/systemtap.base/bitfield.stp new file mode 100644 index 00000000..c2ff4929 --- /dev/null +++ b/testsuite/systemtap.base/bitfield.stp @@ -0,0 +1,46 @@ +%{ +#include <linux/tcp.h> +static struct tcphdr foo = {0}; +%} + +function get_ptr:long() %{ THIS->__retvalue = (long)&foo; /* pure */ %} +function get_ack:long() %{ THIS->__retvalue = foo.ack; /* pure */ %} +function get_urg:long() %{ THIS->__retvalue = foo.urg; /* pure */ %} + +function check:long(ack:long, urg:long) { + ptr = get_ptr() + + /* set the bits with cast */ + @cast(ptr, "tcphdr")->ack = ack + @cast(ptr, "tcphdr")->urg = urg + + /* check that reading with embedded-C is ok */ + real_ack = get_ack() + real_urg = get_urg() + errors = (ack != real_ack) + (urg != real_urg) + + /* check that reading with a cast is ok */ + cast_ack = @cast(ptr, "tcphdr")->ack + cast_urg = @cast(ptr, "tcphdr")->urg + errors += (ack != cast_ack) + (urg != cast_urg) + + if (errors) + printf("bitfield had %d errors; expect(%d%d), real(%d%d), cast(%d%d)\n", + errors, ack, urg, real_ack, real_urg, cast_ack, cast_urg) + + return errors +} + +probe begin { + println("systemtap starting probe") + + errors = check(0, 0) + errors += check(0, 1) + errors += check(1, 0) + errors += check(1, 1) + + println("systemtap ending probe") + if (errors == 0) + println("systemtap test success") + exit() +} diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 268bb320..88ed4619 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -55,8 +55,23 @@ if { $res != "" } { pass "compiling labels.c -g" } +# list of labels + +spawn stap -l "process(\"$label_exepath\").function(\"*\").label(\"*\")" + +wait +expect { + -timeout 180 + -re {process.*function.*labels.c:5...label..init_an_int.*process.*function.*labels.c:16...label..init_an_int.*process.*function.*labels.c:18...label..init_an_int_again} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if {$ok == 1} { pass "$test -l .label" } { fail "$test -l .label $ok" } + # label in an executable +set ok 0 verbose -log "spawn stap -c $label_exepath $label_stppath" spawn stap -c $label_exepath $label_stppath diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 3287458a..a03b8dcc 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -97,6 +97,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br> <p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li> +<li><a href="network/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br> +keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br> +<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li> <li><a href="process/errsnoop.stp">process/errsnoop.stp</a> - tabulate system call errors<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br> <p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</p></li> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index d538d760..d24232e7 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -182,6 +182,14 @@ keywords: network tcp socket originator of the request. +network/tcpdumplike.stp - Dump of Received TCP Packets +keywords: network traffic + + The tcpdumplike.stp prints out a line for each TCP packet received. + Each line includes the source and destination IP addresses, the + source and destination ports, and flags. + + process/errsnoop.stp - tabulate system call errors keywords: process syscall diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 2254fd25..e65ed19d 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -159,6 +159,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br> <p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li> +<li><a href="network/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br> +keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br> +<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li> </ul> <h3><a name="PER-PROCESS">PER-PROCESS</a></h3> <ul> @@ -288,6 +291,9 @@ keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.ht <li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <a href="keyword-index.html#PER-PROCESS">PER-PROCESS</a> <br> <p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +<li><a href="network/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br> +keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br> +<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li> </ul> <h3><a name="USE">USE</a></h3> <ul> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 8fd8e0d8..40b5276f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -281,6 +281,14 @@ keywords: network tcp socket originator of the request. +network/tcpdumplike.stp - Dump of Received TCP Packets +keywords: network traffic + + The tcpdumplike.stp prints out a line for each TCP packet received. + Each line includes the source and destination IP addresses, the + source and destination ports, and flags. + + = PER-PROCESS = network/nettop.stp - Periodic Listing of Processes Using Network Interfaces @@ -597,6 +605,14 @@ keywords: network traffic per-process interval. +network/tcpdumplike.stp - Dump of Received TCP Packets +keywords: network traffic + + The tcpdumplike.stp prints out a line for each TCP packet received. + Each line includes the source and destination IP addresses, the + source and destination ports, and flags. + + = USE = general/graphs.stp - Graphing Disk and CPU Utilization diff --git a/testsuite/systemtap.examples/network/tcpdumplike.meta b/testsuite/systemtap.examples/network/tcpdumplike.meta new file mode 100644 index 00000000..8fb9fccb --- /dev/null +++ b/testsuite/systemtap.examples/network/tcpdumplike.meta @@ -0,0 +1,12 @@ +title: Dump of Received TCP Packets +name: tcpdumplike.stp +version: 1.0 +author: anonymous +keywords: network traffic +subsystem: network +status: production +exit: user-controlled +output: timed +scope: system-wide +description: The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags. +test_installcheck: stap tcpdumplike.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/network/tcpdumplike.stp b/testsuite/systemtap.examples/network/tcpdumplike.stp new file mode 100755 index 00000000..de3899d6 --- /dev/null +++ b/testsuite/systemtap.examples/network/tcpdumplike.stp @@ -0,0 +1,14 @@ +#! /usr/bin/env stap + +// A TCP dump like example + +probe begin, timer.s(1) { + printf("-----------------------------------------------------------------\n") + printf(" Source IP Dest IP SPort DPort U A P R S F \n") + printf("-----------------------------------------------------------------\n") +} + +probe tcp.receive { + printf(" %15s %15s %5d %5d %d %d %d %d %d %d\n", + saddr, daddr, sport, dport, urg, ack, psh, rst, syn, fin) +} diff --git a/testsuite/systemtap.examples/process/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp index 06425d45..9a3768c2 100755 --- a/testsuite/systemtap.examples/process/proc_snoop.stp +++ b/testsuite/systemtap.examples/process/proc_snoop.stp @@ -18,30 +18,30 @@ function id:string(task:long) { task_execname(task)) } -probe process.create { +probe kprocess.create { report(sprintf("create %s", id(task))) } -probe process.start { +probe kprocess.start { report("start") } -probe process.exec { +probe kprocess.exec { report(sprintf("exec %s", filename)) } -probe process.exec_complete { +probe kprocess.exec_complete { if (success) report("exec success") else report(sprintf("exec failed %d (%s)", errno, errno_str(errno))) } -probe process.exit { +probe kprocess.exit { report(sprintf("exit %d", code)) } -probe process.release { +probe kprocess.release { report(sprintf("remove %s", id(task))) } diff --git a/testsuite/systemtap.stress/whitelist.exp b/testsuite/systemtap.stress/whitelist.exp index 4a31c124..70973978 100644 --- a/testsuite/systemtap.stress/whitelist.exp +++ b/testsuite/systemtap.stress/whitelist.exp @@ -96,6 +96,7 @@ set init_probes_all_script { udp.*.return, tcp.*, tcp.*.return, + kprocess.*, process.*, nfs.fop.*, nfs.aop.*, |