]> sourceware.org Git - systemtap.git/commitdiff
Make testcase at_var.exp work with stap-4.1+ and kernel-4.17+
authorMartin Cermak <mcermak@redhat.com>
Tue, 8 Jan 2019 16:06:41 +0000 (17:06 +0100)
committerMartin Cermak <mcermak@redhat.com>
Tue, 8 Jan 2019 16:06:41 +0000 (17:06 +0100)
This testcase update tries to reflect following changes:
- 4.17 breaks syscalls tapset
  https://sourceware.org/bugzilla/show_bug.cgi?id=23160
- $foo->bar differs from @var("foo")->bar
  https://bugzilla.redhat.com/show_bug.cgi?id=1660889#c4 .

testsuite/systemtap.base/at_var.exp
testsuite/systemtap.base/at_var.stp

index 890d2563de4d75df6338ff1c2ea1ae6acac1ac66..875d01dc8c32ab5ab9cc1d7eec0fefeaf28bfffd 100644 (file)
@@ -21,8 +21,10 @@ $utimes[1]$$: {.tv_sec=3, .tv_usec=4}
 set result_string3 {user_int(&$foo->bar): 40
 user_int(&@var("foo")->bar): 40
 &@cast($foo->bar, "struct foo")->bar: 42
+$foo->bar == @entry($foo->bar): true}
+
+set result_string4 {
 &@cast(@var("foo")->bar, "struct foo")->bar: 42
-$foo->bar == @entry($foo->bar): true
 @var("foo")->bar == @entry(@var("foo")->bar): true}
 
 # s390x machines can't do $utimes$$, since all syscall args are
@@ -37,6 +39,8 @@ if {[istarget s390x-*-*]} {
 if {! [installtest_p]} { untested "$test"; return }
 if {! [uretprobes_p]} { untested "$test"; return }
 
+# A)  Test the "current" (post-4a8652800d4dc7d57d3e2ac5463c1d292b9742a8) version behavior:
+
 set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-O2 additional_flags=-g"]
 if { $res != "" } {
     verbose "target_compile failed: $res" 2
@@ -55,5 +59,27 @@ if { $res != "" } {
     stap_run3 $test_name $srcdir/$subdir/$test.stp -c ./${test} -w
 }
 
+# B) Test the legacy/--compatible=4.0 (pre-4a8652800d4dc7d57d3e2ac5463c1d292b9742a8) behavior:
+
+set ::result_string "${::result_string}$result_string4"
+
+set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-O2 additional_flags=-g"]
+if { $res != "" } {
+    verbose "target_compile failed: $res" 2
+    fail "${test}: unable to compile ${test}.c"
+} else {
+    stap_run3 $test $srcdir/$subdir/$test.stp -c ./${test} -w --compatible=4.0
+}
+
+# Test for target program compiled without optimization
+set test_name "${test} (non-optimized)"
+set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-g"]
+if { $res != "" } {
+    verbose "target_compile failed: $res" 2
+    fail "${test_name}: unable to compile ${test}.c"
+} else {
+    stap_run3 $test_name $srcdir/$subdir/$test.stp -c ./${test} -w --compatible=4.0
+}
+
 # Cleanup
 if { $verbose == 0 } { catch { exec rm -f $test } }
index fb76868da604cb8f538d2659ed3f5df5969fc37b..e74436d80b46045766cee90ddc7aabace0c73f6a 100644 (file)
@@ -19,7 +19,7 @@ probe process.function("sub")
 %(arch != "s390" %?
   // On s390x, the utimes() wrapper and function both just get longs,
   // so we'll have to use @cast().
-probe kernel.function("SYSC_utimes")!, kernel.function("sys_utimes")
+probe kernel.function("SYSC_utimes")!, kernel.function("sys_utimes")!, kernel.function("do_futimesat")
 {
   printf("$utimes$$: %s\n", $utimes$$);
   printf("$utimes[1]$$: %s\n", $utimes[1]$$);
@@ -38,12 +38,12 @@ probe process.function("sub").return
      so taking the address of that field is 42 again. */
   printf("&@cast($foo->bar, \"struct foo\")->bar: %d\n",
         &@cast($foo->bar, "struct foo")->bar);
-  printf("&@cast(@var(\"foo\")->bar, \"struct foo\")->bar: %d\n",
-        &@cast(@var("foo")->bar, "struct foo")->bar);
-
-  /* Note that variables are taken at entry in both cases. */
   printf("$foo->bar == @entry($foo->bar): %s\n",
         $foo->bar == @entry($foo->bar) ? "true" : "false");
+%( systemtap_v <= "4.0" %?
+  printf("&@cast(@var(\"foo\")->bar, \"struct foo\")->bar: %d\n",
+        &@cast(@var("foo")->bar, "struct foo")->bar);
   printf("@var(\"foo\")->bar == @entry(@var(\"foo\")->bar): %s\n",
         @var("foo")->bar == @entry(@var("foo")->bar) ? "true" : "false");
+%)
 }
This page took 0.030785 seconds and 5 git commands to generate.