Re: [DTrace-devel] [PATCH] test: adjust sdt.tst.args.d for task_rename tracepoint differences

Kris Van Hees <[email protected]>
Newsgroups dev.linux.lists.dtrace
Message-ID <aJuB8FBHT4JdV3U/@oracle.com>
On Tue, Aug 12, 2025 at 01:54:22PM -0400, Eugene Loh wrote:
> On 8/12/25 08:41, Kris Van Hees via DTrace-devel wrote:
> 
> > As of kernel 6.14, the task_rename tracepoint provides only 3 arguments
> > rather than 4 (the pid got dropped).
> > 
> > Signed-off-by: Kris Van Hees <[email protected]>
> > ---
> >   test/unittest/sdt/tst.args-3.d                | 42 +++++++++++++++++++
> >   .../unittest/sdt/{tst.args.r => tst.args-3.r} |  0
> >   test/unittest/sdt/tst.args-3.x                | 14 +++++++
> >   .../unittest/sdt/{tst.args.d => tst.args-4.d} |  0
> >   test/unittest/sdt/tst.args-4.r                |  2 +
> >   test/unittest/sdt/tst.args-4.x                | 13 ++++++
> >   6 files changed, 71 insertions(+)
> >   create mode 100644 test/unittest/sdt/tst.args-3.d
> >   rename test/unittest/sdt/{tst.args.r => tst.args-3.r} (100%)
> >   create mode 100755 test/unittest/sdt/tst.args-3.x
> >   rename test/unittest/sdt/{tst.args.d => tst.args-4.d} (100%)
> >   create mode 100644 test/unittest/sdt/tst.args-4.r
> >   create mode 100755 test/unittest/sdt/tst.args-4.x
> > 
> > diff --git a/test/unittest/sdt/tst.args-3.d b/test/unittest/sdt/tst.args-3.d
> > new file mode 100644
> > index 000000000..ae070cb72
> > --- /dev/null
> > +++ b/test/unittest/sdt/tst.args-3.d
> > @@ -0,0 +1,42 @@
> > +/*
> > + * Oracle Linux DTrace.
> > + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
> > + * Licensed under the Universal Permissive License v 1.0 as shown at
> > + * http://oss.oracle.com/licenses/upl.
> > + */
> > +
> > +#pragma D option destructive
> > +#pragma D option quiet
> > +
> > +/*
> > + * Ensure that arguments to SDT probes can be retrieved correctly.
> > + */
> > +BEGIN
> > +{
> > +	/* Timeout after 5 seconds */
> > +	timeout = timestamp + 5000000000;
> > +	system("ls >/dev/null");
> > +}
> > +
> > +/*
> > + * The 'task_rename' tracepoint passes the following arguments:
> > + *
> > + *	char	oldcomm[16]
> > + *	char	newcomm[16]
> > + *	short	oom_score_adj
> > + */
> > +this char v;
> > +this bool done;
> > +
> > +sdt:task::task_rename
> > +{
> > +	printf("PID OK, oldcomm [%s], newcomm [%s], oom_score_adj %hd\n", stringof(args[0]), stringof(args[1]), args[2]);
> 
> It makes no sense to report that PID is okay.  What is pid?  It isn't in the
> test and it isn't in the probe.  It is only in other kernel versions and in
> some other test.  Emitting a PID OK label is not necessary for matching with
> the older test since different .r files are used.

I opted for keeping the output of the two tests the same because it essentially
is the same test, just on different versions of the kernel.  I do not want to
give the impression in any way that they are different tests.  I think that
having distinct output may make this less clear.  Since it is a constant string
in both cases, there is no downside to this.

> > +	exit(0);
> > +}
> > +
> > +profile:::tick-1
> > +/timestamp > timeout/
> > +{
> > +	trace("test timed out");
> > +	exit(1);
> > +}
> > diff --git a/test/unittest/sdt/tst.args.r b/test/unittest/sdt/tst.args-3.r
> > similarity index 100%
> > rename from test/unittest/sdt/tst.args.r
> > rename to test/unittest/sdt/tst.args-3.r
> 
> Again, PID OK makes no sense here.

See above.

> > diff --git a/test/unittest/sdt/tst.args-3.x b/test/unittest/sdt/tst.args-3.x
> > new file mode 100755
> > index 000000000..80c135543
> > --- /dev/null
> > +++ b/test/unittest/sdt/tst.args-3.x
> > @@ -0,0 +1,14 @@
> > +#!/bin/bash
> > +
> > +read MAJOR MINOR <<< `uname -r | grep -Eo '^[0-9]+\.[0-9]+' | tr '.' ' '`
> > +
> > +if [ $MAJOR -lt 6 ]; then
> > +	echo "tst.args-3.d disabled on kernels < 6.14"
> > +	exit 2
> > +fi
> > +if [ $MAJOR -eq 6 -a $MINOR -lt 14 ]; then
> > +	echo "tst.args-3.d disabled on kernels < 6.14"
> > +	exit 2
> > +fi
> > +
> > +exit 0
> > diff --git a/test/unittest/sdt/tst.args.d b/test/unittest/sdt/tst.args-4.d
> > similarity index 100%
> > rename from test/unittest/sdt/tst.args.d
> > rename to test/unittest/sdt/tst.args-4.d
> > diff --git a/test/unittest/sdt/tst.args-4.r b/test/unittest/sdt/tst.args-4.r
> > new file mode 100644
> > index 000000000..52854c0b3
> > --- /dev/null
> > +++ b/test/unittest/sdt/tst.args-4.r
> > @@ -0,0 +1,2 @@
> > +PID OK, oldcomm [dtrace], newcomm [sh], oom_score_adj 0
> > +
> > diff --git a/test/unittest/sdt/tst.args-4.x b/test/unittest/sdt/tst.args-4.x
> > new file mode 100755
> > index 000000000..74a0234bf
> > --- /dev/null
> > +++ b/test/unittest/sdt/tst.args-4.x
> > @@ -0,0 +1,13 @@
> > +#!/bin/bash
> > +
> > +read MAJOR MINOR <<< `uname -r | grep -Eo '^[0-9]+\.[0-9]+' | tr '.' ' '`
> > +
> > +if [ $MAJOR -lt 6 ]; then
> > +	exit 0
> > +fi
> > +if [ $MAJOR -eq 6 -a $MINOR -lt 14 ]; then
> > +	exit 0
> > +fi
> > +
> > +echo "tst.args-4.d disabled on kernels < 6.14"
> > +exit 2
> 
> The < should be >=.

Ah yes, thanks.  v2 on the way
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.