summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/cast.stp
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-04-20 17:18:32 -0700
committerJosh Stone <jistone@redhat.com>2009-04-20 17:18:32 -0700
commit219b3700b8603b6fe3610d6f06e353f3c041ee0b (patch)
treeb84d02cdcc07c3da3ce121ed4e1580128660fc17 /testsuite/systemtap.base/cast.stp
parent2ca818756fff583220c238cf344add80b71f7f8c (diff)
downloadsystemtap-steved-219b3700b8603b6fe3610d6f06e353f3c041ee0b.tar.gz
systemtap-steved-219b3700b8603b6fe3610d6f06e353f3c041ee0b.tar.xz
systemtap-steved-219b3700b8603b6fe3610d6f06e353f3c041ee0b.zip
Add tests for @cast-generated modules
Diffstat (limited to 'testsuite/systemtap.base/cast.stp')
-rw-r--r--testsuite/systemtap.base/cast.stp21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp
index bec0cc9b..33a14a28 100644
--- a/testsuite/systemtap.base/cast.stp
+++ b/testsuite/systemtap.base/cast.stp
@@ -10,6 +10,13 @@ probe begin
else
printf("PID %d != %d\n", pid, cast_pid)
+ // Compare PIDs using a generated kernel module
+ cast_pid = @cast(curr, "task_struct", "kmod<linux/sched.h>")->tgid
+ if (pid == cast_pid)
+ println("PID2 OK")
+ else
+ printf("PID2 %d != %d\n", pid, cast_pid)
+
// Compare execnames
name = execname()
cast_name = kernel_string(@cast(curr, "task_struct")->comm)
@@ -18,5 +25,19 @@ probe begin
else
printf("execname \"%s\" != \"%s\"\n", name, cast_name)
+ // Compare tv_sec using a generated user module
+ sec = 42
+ cast_sec = @cast(get_timeval(sec), "timeval", "umod<sys/time.h>")->tv_sec
+ if (sec == cast_sec)
+ println("tv_sec OK")
+ else
+ printf("tv_sec %d != %d\n", sec, cast_sec)
+
exit()
}
+
+function get_timeval:long(sec:long) %{
+ static struct timeval mytime = {0};
+ mytime.tv_sec = THIS->sec;
+ THIS->__retvalue = (long)&mytime;
+%}