[DTrace-devel] [PATCH] test: Make tests more resilient to different prid widths
Nick Alcock
nick.alcock at oracle.com
Wed Jul 16 11:15:10 UTC 2025
On 13 Mar 2025, eugene loh said:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Various tests convert run-dependent values -- like PIDs and probe IDs
> -- to run-independent strings before checking against their .r results
> files. But the conversions could be remarkably sensitive to the width
> of probe IDs. E.g., some conversions assumed probe IDs were flush with
> the beginning of the line, but if they were narrower they were preceded
> by white space and were not detected. This will be important in up-coming
> fbt work, where probe IDs for fbt probes can be much lower in value
> (fewer digits).
I have long wished for some way to fix this.
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
> diff --git a/test/unittest/usdt/convert_PID_and_PRID.awk b/test/unittest/usdt/convert_PID_and_PRID.awk
> new file mode 100755
> index 000000000..1dbb31301
> --- /dev/null
> +++ b/test/unittest/usdt/convert_PID_and_PRID.awk
> @@ -0,0 +1,20 @@
> +#!/usr/bin/gawk -f
> +
> +# ignore the banner
> +/^ *ID *PROVIDER *MODULE *FUNCTION *NAME *$/ { next; }
> +
> +# process other lines
> +{
> + # convert run-dependent PID values to "PID"
> + $0 = gensub("prov([abc]?)[0-9]+", "prov\\1PID", "g");
> + sub("pid [0-9]+", "pid PID");
> +
> + # convert run-dependent probe ID values to "PRID"
> + sub("^ *[0-9]+", "PRID");
... that seems like a rather wide net to cast. I suppose as long as it's
not used outside usdt and possibly pid, this should do.
--
NULL && (void)
More information about the DTrace-devel
mailing list