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

Eugene Loh eugene.loh at oracle.com
Fri May 5 18:12:02 UTC 2023


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

There are lots of ways of doing this, of course.  E.g., the .r.p is 
checking for a regex anyhow, so could do

/ 0: 64 74 72 61 63 65 00( [0-9A-F]{2}){9}  dtrace/ { exit(0) }
END { exit(1) }

skipping the {print} (and can skip the .r file), but the approach in the 
patch is just fine.

Also want #pragma D option quiet ?

And the patch also makes sense for old kernels:  why were were relying 
on the garbage to be the right garbage?

On 5/5/23 11:29, Kris Van Hees via DTrace-devel wrote:
> 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