public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: eugene.loh@oracle.com
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH] test: Make tests more resilient to different prid widths
Date: Wed, 16 Jul 2025 12:15:10 +0100	[thread overview]
Message-ID: <87ple0petd.fsf@esperi.org.uk> (raw)
In-Reply-To: <20250313003946.11074-1-eugene.loh@oracle.com> (eugene loh's message of "Wed, 12 Mar 2025 20:39:46 -0400")

On 13 Mar 2025, eugene loh said:

> From: Eugene Loh <eugene.loh@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@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)

      reply	other threads:[~2025-07-16 11:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13  0:39 [PATCH] test: Make tests more resilient to different prid widths eugene.loh
2025-07-16 11:15 ` Nick Alcock [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ple0petd.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox