diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.base/bz10078.c | 22 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz10078.exp | 35 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz10078.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/grapher.stp | 32 | ||||
-rw-r--r-- | testsuite/systemtap.printf/basic6.exp | 3 | ||||
-rw-r--r-- | testsuite/systemtap.printf/basic6.stp | 5 |
6 files changed, 101 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/bz10078.c b/testsuite/systemtap.base/bz10078.c new file mode 100644 index 00000000..9075fbc7 --- /dev/null +++ b/testsuite/systemtap.base/bz10078.c @@ -0,0 +1,22 @@ +#include <stdlib.h> +#include <stdio.h> + +struct point { int x, y; }; + +struct point mkpoint2(void) +{ + struct point p = { 1, 2 }; + return p; +} + +struct point mkpoint1(void) +{ + return mkpoint2(); +} + +main() +{ + struct point p = mkpoint1(); + printf("%d,%d\n", p.x, p.y); + exit(0); +} diff --git a/testsuite/systemtap.base/bz10078.exp b/testsuite/systemtap.base/bz10078.exp new file mode 100644 index 00000000..cad3a3a8 --- /dev/null +++ b/testsuite/systemtap.base/bz10078.exp @@ -0,0 +1,35 @@ +set test bz10078 + +catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err +if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" } + +if {![utrace_p]} { + catch {exec rm -f $test} + untested "$test -p4" + untested "$test -p5" + return +} + +set rc [stap_run_batch $srcdir/$subdir/$test.stp] +if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } + +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} + +# Pick up the stap being tested. +set stapexe [exec /usr/bin/which stap] +spawn sudo $stapexe $srcdir/$subdir/$test.stp -c ./$test +set ok 0 +expect { + -timeout 60 + -re {mkpoint[^\r\n]* returns\r\n} { incr ok; exp_continue } + -re {1,2\r\n} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$ok == 3} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" } +exec rm -f $test diff --git a/testsuite/systemtap.base/bz10078.stp b/testsuite/systemtap.base/bz10078.stp new file mode 100644 index 00000000..0318e4e9 --- /dev/null +++ b/testsuite/systemtap.base/bz10078.stp @@ -0,0 +1,4 @@ +#! stap -p4 +probe process("./bz10078").function("mkpoint*").return { + printf("%s returns\n", probefunc()) +} diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp new file mode 100644 index 00000000..4f326ec1 --- /dev/null +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -0,0 +1,32 @@ +#! /usr/bin/stap + +probe begin +{ +printf ("%%Title:CPU utilization\n"); +printf ("%%XAxisTitle:Time"); +printf ("%%YAxisTitle:Percent"); +printf ("%%DataSet:cpu 100 00ff00 bar"); +printf ("%%DataSet:kbd 100 ff0000 dot"); +} + +# CPU utilization +probe begin { qnames["cpu"] ++; qsq_start ("cpu") } +probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }} +probe scheduler.cpu_off { if (!idle) qs_done ("cpu") } + +global qnames + +function qsq_util_reset(q) { + u=qsq_utilization (q, 100) + qsq_start (q) + return u +} + +probe timer.ms(100) { # collect utilization percentages frequently + foreach (q in qnames) + printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q)) +} + +probe kernel.function("kbd_event") { + printf("kbd %d %d\n", gettimeofday_ms(), 75) +} diff --git a/testsuite/systemtap.printf/basic6.exp b/testsuite/systemtap.printf/basic6.exp new file mode 100644 index 00000000..72bf8f57 --- /dev/null +++ b/testsuite/systemtap.printf/basic6.exp @@ -0,0 +1,3 @@ +set test "basic6" +set ::result_string {Hello%World} +stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.printf/basic6.stp b/testsuite/systemtap.printf/basic6.stp new file mode 100644 index 00000000..69721188 --- /dev/null +++ b/testsuite/systemtap.printf/basic6.stp @@ -0,0 +1,5 @@ +probe begin +{ + printf("Hello%%World"); + exit() +} |