summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2009-01-29 16:55:06 -0500
committerWilliam Cohen <wcohen@redhat.com>2009-01-29 16:55:06 -0500
commit9fbda39bf7687ceeee28813f30f6e3ec5c72fc5d (patch)
tree591d46a22865cb745e368ca4325bf95ad93e7f70 /testsuite/systemtap.samples
parent8da0793017c9871b96cb9695ab10e9fa040c0a03 (diff)
downloadsystemtap-steved-9fbda39bf7687ceeee28813f30f6e3ec5c72fc5d.tar.gz
systemtap-steved-9fbda39bf7687ceeee28813f30f6e3ec5c72fc5d.tar.xz
systemtap-steved-9fbda39bf7687ceeee28813f30f6e3ec5c72fc5d.zip
Move some systemtap.sample tests to systemtap.base.
Diffstat (limited to 'testsuite/systemtap.samples')
-rw-r--r--testsuite/systemtap.samples/arith.exp14
-rw-r--r--testsuite/systemtap.samples/arith.stp79
-rw-r--r--testsuite/systemtap.samples/arith_limits.exp13
-rw-r--r--testsuite/systemtap.samples/arith_limits.stp80
-rw-r--r--testsuite/systemtap.samples/control_limits.exp46
-rw-r--r--testsuite/systemtap.samples/control_limits.stp24
-rw-r--r--testsuite/systemtap.samples/gtod.c26
-rw-r--r--testsuite/systemtap.samples/gtod.exp40
-rwxr-xr-xtestsuite/systemtap.samples/gtod.sh4
-rw-r--r--testsuite/systemtap.samples/gtod.stp8
-rw-r--r--testsuite/systemtap.samples/system_func.exp22
-rw-r--r--testsuite/systemtap.samples/system_func.stp35
12 files changed, 0 insertions, 391 deletions
diff --git a/testsuite/systemtap.samples/arith.exp b/testsuite/systemtap.samples/arith.exp
deleted file mode 100644
index c4f72793..00000000
--- a/testsuite/systemtap.samples/arith.exp
+++ /dev/null
@@ -1,14 +0,0 @@
-set test "arith"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -DMAXNESTING=5 $srcdir/$subdir/arith.stp
-set ok 0
-expect {
- -timeout 150
- -re {passes: [0-9]* failures: 0} { incr ok }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-close
-wait
-if {$ok == 1} { pass "$test" } { fail "$test" }
diff --git a/testsuite/systemtap.samples/arith.stp b/testsuite/systemtap.samples/arith.stp
deleted file mode 100644
index 59016dcb..00000000
--- a/testsuite/systemtap.samples/arith.stp
+++ /dev/null
@@ -1,79 +0,0 @@
-global testno, passes, failures
-
-function test (v,n1,n2) {
- if (n1 == n2) {
- passes ++
- result = "pass"
- } else {
- failures ++
- result = "fail"
- }
- println ("test " . (sprint (++testno)) . " [" . v . "]\t" . result)
-}
-
-function stest (v,n1,n2) {
- if (n1 == n2) {
- passes ++
- result = "pass"
- } else {
- failures ++
- result = "fail"
- }
- println ("test " . (sprint (++testno)) . " [" . v . "]\t" . result)
-}
-
-
-probe begin {
- test ("+", 0, 0+0)
- test ("+", 33339999, 33330000+9999)
- test ("-", -1, 2-3)
- test ("==", 1, -1==-1)
- test ("!=", 1, -1!=1)
- test ("== s", 1, "foobar"=="foobar")
- test ("<= s", 1, "fooban"<="foobar")
- test ("> s", 1, "xxx">"aaa")
- test ("<", 1, -1<0)
- test ("<", 1, 85723838<8273823892)
- test ("*", 100300400500, 1003004005 * 100)
- test ("*", -1*-500, 500)
- test ("/", 1003004005/1000, 1003004)
- test ("%", 1003004005%1000, 5)
- test ("/", -1/-1, 1)
- test ("%", -1%-1, 0)
- test ("/", 0/-100, 0)
- test ("%", 0%-100, 0)
- test ("/", (-2147483647-1)/-1, 2147483648)
- test ("%", (-2147483647-1)%-1, 0)
- # but (-9223372036854775807-1)/-1 may overflow
- test ("%", (-9223372036854775807-1)%-1, 0)
- test ("&", 0x555&0xaaa, 0)
- test ("|", 0x555|0xaaa, 0xfff)
- test ("^", 0x55f^0xaaf, 0xff0)
- test ("&&", 0x555&&0xaaa, 1)
- test ("||", 0x555||0xaaa, 1)
- test ("<<", 0<<5, 0)
- test ("<<", 1<<8, 0x100)
- test ("<<", 120<<-2, 120)
- test ("<<", 120<<0, 120)
- test ("<<", -4096<<-3, -4096)
- test (">>", -4096>>3, -512)
- test (">>", -4096>>-3, -4096)
- test (">>", 120>>-2, 120)
- test (">>", 120>>0, 120)
- i=1; test ("--i", --i, 0)
- i=1; test ("++i", ++i, 2)
- i=1; test ("i--", i--, 1)
- i=1; test ("i++", i++, 1)
- i=1; test ("+=", i+=4, 5) test ("after +=", i, 5)
- i=5; test ("/=", i/=2, 2) test ("after /=", i, 2)
- a="1" b="2"; stest (".=", a .= b, "12") stest ("after .=", a, "12")
-}
-
-
-probe timer.jiffies(1) { # some time after all the begin probes
- exit ()
-}
-
-probe end {
- printf ("passes: %d failures: %d\n", passes, failures)
-}
diff --git a/testsuite/systemtap.samples/arith_limits.exp b/testsuite/systemtap.samples/arith_limits.exp
deleted file mode 100644
index 93794c8e..00000000
--- a/testsuite/systemtap.samples/arith_limits.exp
+++ /dev/null
@@ -1,13 +0,0 @@
-set test "arith_limits"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -DMAXNESTING=5 $srcdir/$subdir/arith_limits.stp
-set ok 0
-expect {
- -timeout 150
- -re {passes: [0-9]* failures: 0} { incr ok }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-wait
-if {$ok == 1} { pass "$test" } { fail "$test" }
diff --git a/testsuite/systemtap.samples/arith_limits.stp b/testsuite/systemtap.samples/arith_limits.stp
deleted file mode 100644
index 6c620830..00000000
--- a/testsuite/systemtap.samples/arith_limits.stp
+++ /dev/null
@@ -1,80 +0,0 @@
-global testno, passes, failures
-
-function test (v,n1,n2) {
- if (n1 == n2) {
- passes ++
- result = "pass"
- } else {
- failures ++
- result = "fail"
- }
- printf ("test %d [%s]\t\t%s\n", testno++, v, result)
-}
-
-# Exactly the same as test() except it will magically work for strings.
-# Wouldn't it be nice if we didn't have to do this?
-
-function teststr (v,n1,n2) {
- if (n1 == n2) {
- passes ++
- result = "pass"
- } else {
- failures ++
- result = "fail"
- }
- printf ("test %d [%s]\t\t%s\n", testno++, v, result)
-}
-
-
-
-probe begin {
- # max/minimum signed 32-bit values.
- # these could cause problems for 32-bit cpus when overflows
- # occur into 64-but values
- lmax = 0x7fffffff
- lmin = -0x80000000
-
- # max/minimum signed 64-bit values
- llmax = 0x7fffffffffffffff
- llmin = -0x7fffffffffffffff-1
-
- # 32-bit limit tests
- teststr ("string lmax", sprint(lmax), "2147483647")
- teststr ("hex lmax", sprintf("0x%x", lmax), "0x7fffffff")
- teststr ("string lmin", sprint(lmin), "-2147483648")
- teststr ("hex lmin", sprintf("0x%x", lmin), "0xffffffff80000000")
- test ("lmax/-1", lmax/-1, -2147483647);
- test ("lmin/-1", lmin/-1, 2147483648);
- test ("lmax +1", lmax+1, 2147483648);
- test ("lmin -1", lmin-1, -2147483649);
-
- # 64-bit limits
- teststr ("string llmax", sprint(llmax), "9223372036854775807")
- teststr ("hex llmax", sprintf("0x%x", llmax), "0x7fffffffffffffff")
- teststr ("string llmin", sprint(llmin), "-9223372036854775808")
- teststr ("hex llmin", sprintf("0x%x", llmin), "0x8000000000000000")
- test ("llmax/-1", llmax/-1, -llmax)
- test ("llmax*-1", llmax*-1, -llmax)
-
- # the next three overflow and produce predictable, although
- # wrong results
- test ("llmin/-1", llmin/-1, llmin)
- test ("llmin*-1", llmin*-1, llmin)
- test ("llmax +1", llmax+1, llmin)
- test ("llmin -1", llmin-1, llmax)
-
- # modulo tests
- test ("llmax%1", llmax%1, 0)
- test ("llmin%1", llmin%1, 0)
- test ("0%1 ", 0%1, 0)
- test ("0%lmax", 0%lmax, 0)
- test ("1%lmax", 1%lmax, 1)
- test ("0%lmin", 0%lmin, 0)
- test ("1%lmin", 1%lmin, 1)
-
- exit()
-}
-
-probe end {
- printf ("passes: %d failures: %d\n", passes, failures)
-}
diff --git a/testsuite/systemtap.samples/control_limits.exp b/testsuite/systemtap.samples/control_limits.exp
deleted file mode 100644
index 513b2c4d..00000000
--- a/testsuite/systemtap.samples/control_limits.exp
+++ /dev/null
@@ -1,46 +0,0 @@
-set test "control_limits MAXNESTING"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -u -DMAXNESTING=5 $srcdir/$subdir/control_limits.stp
-set ok 0
-expect {
- -timeout 150
- -re {ERROR.*MAXNESTING} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" }
-
-set test "control_limits MAXACTION"
-spawn stap -u -DMAXACTION_INTERRUPTIBLE=500 $srcdir/$subdir/control_limits.stp
-set ok 0
-expect {
- -timeout 150
- -re {ERROR.*MAXACTION} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" }
-
-set test "control_limits MAXSTRINGLEN small"
-spawn stap -u -DMAXSTRINGLEN=50 $srcdir/$subdir/control_limits.stp
-set ok 0
-expect {
- -timeout 150
- -re {ERROR.*MAXSTRINGLEN reduced} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" }
-
-set test "control_limits MAXSTRINGLEN large"
-spawn stap -u -DMAXSTRINGLEN=500 $srcdir/$subdir/control_limits.stp
-set ok 0
-expect {
- -timeout 150
- -re {ERROR.*MAXSTRINGLEN enlarged} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" }
-
diff --git a/testsuite/systemtap.samples/control_limits.stp b/testsuite/systemtap.samples/control_limits.stp
deleted file mode 100644
index 89b0bae4..00000000
--- a/testsuite/systemtap.samples/control_limits.stp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-# for MAXNESTING testing
-function recurse (n) {
- if (n > 0) recurse (n-1)
-}
-probe begin {
- recurse (7)
-}
-
-# for MAXACTION testing
-probe begin {
- for (i=0; i<498; i++) {}
-}
-
-# for MAXSTRINGLEN testing
-probe begin {
- s = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" # last 8 will be \0'd
- if (strlen(s) < 127) error ("MAXSTRINGLEN reduced")
- if (strlen(s) > 127) error ("MAXSTRINGLEN enlarged")
-}
-
-
-probe begin { exit () }
-
diff --git a/testsuite/systemtap.samples/gtod.c b/testsuite/systemtap.samples/gtod.c
deleted file mode 100644
index abc08543..00000000
--- a/testsuite/systemtap.samples/gtod.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-int main (int argc, char *argv[])
-{
- int i;
- struct timeval tv[100][2];
- int us = 0;
- if (argc == 2) us = atoi(argv[1]);
- for (i=0; i<100; i++) {
- gettimeofday(&tv[i][0], NULL);
- setsid();
- gettimeofday(&tv[i][1], NULL);
- if (us) usleep(us);
- }
- for (i=0; i<100; i++) {
- // change last 4 chars for correctly sorting even if the
- // time stamps are completely same.
- printf("%8d%06d :%02d appl\n", tv[i][0].tv_sec, tv[i][0].tv_usec, i);
- printf("%8d%06d :%02d prog\n", tv[i][1].tv_sec, tv[i][1].tv_usec, i);
- }
- return 0;
-}
-
diff --git a/testsuite/systemtap.samples/gtod.exp b/testsuite/systemtap.samples/gtod.exp
deleted file mode 100644
index a8f3c9d6..00000000
--- a/testsuite/systemtap.samples/gtod.exp
+++ /dev/null
@@ -1,40 +0,0 @@
-# test for checking monotonic timer (PR3916)
-set test "gtod"
-if {![installtest_p]} { untested $test; continue }
-
-set wd [pwd]
-set filename "$srcdir/$subdir/gtod.c"
-
-target_compile $filename $wd/gtod executable ""
-
-# non interval (check timer drift in short range)
-spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod
-set ok 0
-expect {
- -timeout 120
- -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-wait
-#10ms interval (check timer drift in middle range)
-spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod 10000
-expect {
- -timeout 120
- -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-wait
-#100ms interval (calm down processors and CPU freq might be changed)
-spawn $srcdir/$subdir/gtod.sh $srcdir/$subdir/gtod.stp $wd/gtod 100000
-expect {
- -timeout 120
- -re {^[0-9]+ \:([0-9]+) appl\r\n[0-9]+ \:\1 kern\r\n[0-9]+ \:\1 prog\r\n} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-wait
-exec rm -f $wd/gtod
-if {$ok == 300} { pass "$test ($ok)" } { fail "$test ($ok)" }
-
diff --git a/testsuite/systemtap.samples/gtod.sh b/testsuite/systemtap.samples/gtod.sh
deleted file mode 100755
index 4d4a28c2..00000000
--- a/testsuite/systemtap.samples/gtod.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-stap $1 -c "$2 $3" | sort
-
diff --git a/testsuite/systemtap.samples/gtod.stp b/testsuite/systemtap.samples/gtod.stp
deleted file mode 100644
index f252dc0a..00000000
--- a/testsuite/systemtap.samples/gtod.stp
+++ /dev/null
@@ -1,8 +0,0 @@
-global count = 0
-
-probe syscall.setsid {
- if (pid() == target()) {
- printf("%014d :%02d kern\n", gettimeofday_us(), count);
- count ++;
- }
-}
diff --git a/testsuite/systemtap.samples/system_func.exp b/testsuite/systemtap.samples/system_func.exp
deleted file mode 100644
index ec935783..00000000
--- a/testsuite/systemtap.samples/system_func.exp
+++ /dev/null
@@ -1,22 +0,0 @@
-set test "system_func"
-if {![installtest_p]} { untested $test; return }
-spawn stap $srcdir/$subdir/system_func.stp
-set open 0
-set done 0
-set saw_user 0
-set user [exec whoami]
-expect {
- -timeout 30
- -re "($user|sys_open|DONE)\r" {
- switch $expect_out(1,string) {
- sys_open {incr open}
- DONE {incr done}
- default {incr saw_user}
- }
- exp_continue
- }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-catch {close}; wait
-if {$open == 1 && $saw_user == 1 && $done == 1 } { pass "$test" } { fail "$test ($open,$saw_user,$done)" }
diff --git a/testsuite/systemtap.samples/system_func.stp b/testsuite/systemtap.samples/system_func.stp
deleted file mode 100644
index d14fb25b..00000000
--- a/testsuite/systemtap.samples/system_func.stp
+++ /dev/null
@@ -1,35 +0,0 @@
-#! stap
-
-# test the system() function
-
-global saw_echo, did_cat
-
-probe kernel.function("sys_open") {
- if (!saw_echo) {
- # very inefficient. Testing only. DO NOT DO THIS
- msg="echo sys_open"
- system(msg)
- saw_echo = 1
- }
-}
-
-probe timer.ms(100) {
- # should fail
- system("cat __xyzzy123ABC__")
- did_cat = 1
-}
-
-probe timer.ms(150) {
- if (saw_echo && did_cat)
- exit()
-}
-
-probe begin {
- # should succeed
- system("whoami")
-}
-
-probe end {
- # should succeed
- system("echo DONE")
-}