[PATCH] test: adjust sdt.tst.args.d for task_rename tracepoint differences
Kris Van Hees <[email protected]>
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <SJ0PR10MB5672305D781B114488EA0800C22BA@SJ0PR10MB5672.namprd10.prod.outlook.com> |
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]); + 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 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 -- 2.45.2