]> sourceware.org Git - systemtap.git/commitdiff
Add a testcase for gtod init/kill
authorJosh Stone <jistone@redhat.com>
Mon, 23 Feb 2009 23:08:02 +0000 (15:08 -0800)
committerJosh Stone <jistone@redhat.com>
Mon, 23 Feb 2009 23:08:02 +0000 (15:08 -0800)
This test simply checks that _gettimeofday_init and _gettimeofday_kill
are pulled in when gettimeofday is used, and also that they are NOT
pulled in when gettimeofday is not used.

testsuite/systemtap.base/gtod_init.exp [new file with mode: 0644]

diff --git a/testsuite/systemtap.base/gtod_init.exp b/testsuite/systemtap.base/gtod_init.exp
new file mode 100644 (file)
index 0000000..48616b1
--- /dev/null
@@ -0,0 +1,29 @@
+# test for checking initialization of the time subsystem
+set test "gtod_init"
+
+# check that init and kill are both present with a gettimeofday
+set time_init 0
+set time_kill 0
+spawn stap -p2 -e {probe begin { println(gettimeofday_s()) }}
+expect {
+       -timeout 120
+       -re {\n_gettimeofday_init:} { incr time_init; exp_continue }
+       -re {\n_gettimeofday_kill:} { incr time_kill; exp_continue }
+       timeout { fail "$test (timeout)" }
+       eof {
+        if {$time_init == 1} { pass "$test (init)" } { fail "$test (init $time_init)" }
+        if {$time_kill == 1} { pass "$test (kill)" } { fail "$test (kill $time_kill)" }
+    }
+}
+wait
+
+# check that init and kill are both NOT present without a gettimeofday
+spawn stap -p2 -e {probe begin { println(get_cycles()) }}
+expect {
+       -timeout 120
+       -re {\n_gettimeofday_init:} { fail "$test (bad init)" }
+       -re {\n_gettimeofday_kill:} { fail "$test (bad kill)" }
+       timeout { fail "$test (timeout)" }
+       eof { pass "$test (no init/kill)" }
+}
+wait
This page took 0.029841 seconds and 5 git commands to generate.