summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples/gtod.exp
diff options
context:
space:
mode:
authorhiramatu <hiramatu>2007-09-27 16:28:28 +0000
committerhiramatu <hiramatu>2007-09-27 16:28:28 +0000
commitff0dba8fb7c752a10d64258d3cc1350893139929 (patch)
treef80ecb5a1ab79d46ad9c18ad42abd1f473026f16 /testsuite/systemtap.samples/gtod.exp
parent5e4c160908b88e1272ec09f2c88d7612ce82b7c8 (diff)
downloadsystemtap-steved-ff0dba8fb7c752a10d64258d3cc1350893139929.tar.gz
systemtap-steved-ff0dba8fb7c752a10d64258d3cc1350893139929.tar.xz
systemtap-steved-ff0dba8fb7c752a10d64258d3cc1350893139929.zip
2007-09-27 Masami Hiramatsu <mhiramat@redhat.com>
PR3916 * systemtap.sample/gtod.*: New test for gettimeofday accuracy.
Diffstat (limited to 'testsuite/systemtap.samples/gtod.exp')
-rw-r--r--testsuite/systemtap.samples/gtod.exp40
1 files changed, 40 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/gtod.exp b/testsuite/systemtap.samples/gtod.exp
new file mode 100644
index 00000000..a8f3c9d6
--- /dev/null
+++ b/testsuite/systemtap.samples/gtod.exp
@@ -0,0 +1,40 @@
+# 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)" }
+