[DTrace-devel] [PATCH 01/05] test: make tst.array.d work for old and new kernels

Kris Van Hees kris.van.hees at oracle.com
Fri May 5 15:29:11 UTC 2023


Some older kernels leave trailing garbage in the curthread->comm char
array whereas newer kernels do not.  The post-processor is updated to
handle this variation.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 test/unittest/actions/trace/tst.array.r   | 2 +-
 test/unittest/actions/trace/tst.array.r.p | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 test/unittest/actions/trace/tst.array.r.p

diff --git a/test/unittest/actions/trace/tst.array.r b/test/unittest/actions/trace/tst.array.r
index 872f16f6..fbb674b6 100644
--- a/test/unittest/actions/trace/tst.array.r
+++ b/test/unittest/actions/trace/tst.array.r
@@ -1,7 +1,7 @@
                    FUNCTION:NAME
                           :BEGIN 
              0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
-         0: 64 74 72 61 63 65 00 00 73 68 00 00 00 00 00 00  dtrace..sh......
+         0: 64 74 72 61 63 65 00 00 00 00 00 00 00 00 00 00  dtrace..........
 
 
 -- @@stderr --
diff --git a/test/unittest/actions/trace/tst.array.r.p b/test/unittest/actions/trace/tst.array.r.p
old mode 100644
new mode 100755
index e1f1bd02..3ee0b5a9
--- a/test/unittest/actions/trace/tst.array.r.p
+++ b/test/unittest/actions/trace/tst.array.r.p
@@ -1,5 +1,6 @@
 #!/usr/bin/awk -f
 
+# Some Linux kernel versions leave garbage at the end of the string.
+{ sub(/( [0-9A-F]{2}){9}  /, " 00 00 00 00 00 00 00 00 00  "); }
+{ sub(/  dtrace\..{9}/, "  dtrace.........."); }
 { print; }
-/0:( [0-9A-F]{2}){16}  dtrace/ { exit(0); }
-END { exit(1); }
-- 
2.40.1




More information about the DTrace-devel mailing list