summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/semok/cast.stp4
-rw-r--r--testsuite/systemtap.base/cast.exp6
-rw-r--r--testsuite/systemtap.base/cast.stp21
3 files changed, 29 insertions, 2 deletions
diff --git a/testsuite/semok/cast.stp b/testsuite/semok/cast.stp
index 93da18ef..d30823cd 100755
--- a/testsuite/semok/cast.stp
+++ b/testsuite/semok/cast.stp
@@ -10,4 +10,8 @@ probe begin {
// would be nice to test usermode @cast too,
// but who knows what debuginfo is installed...
+
+ // check modules generated from headers
+ println(@cast(0, "task_struct", "kmod<linux/sched.h>")->tgid)
+ println(@cast(0, "timeval", "umod<sys/time.h>")->tv_sec)
}
diff --git a/testsuite/systemtap.base/cast.exp b/testsuite/systemtap.base/cast.exp
index df3246e8..74c4d72a 100644
--- a/testsuite/systemtap.base/cast.exp
+++ b/testsuite/systemtap.base/cast.exp
@@ -1,4 +1,6 @@
set test "cast"
set ::result_string {PID OK
-execname OK}
-stap_run2 $srcdir/$subdir/$test.stp
+PID2 OK
+execname OK
+tv_sec OK}
+stap_run2 $srcdir/$subdir/$test.stp -g
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;
+%}