Skip to contentSkip to conversation

test: Skip tst.depth.sh

PATCH In review [email protected] 2 participants 12 messages Mar 31 – Apr 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 test: Skip tst.depth.sh

From: Eugene Loh <[email protected]>

The test asks for very many pid probes. E.g.,

        pid$target:::entry,
        pid$target:::return,
        pid$target:a.out::,

If it is successful, this can wreak havoc on some systems, in some cases leading to 1-2 dozen subsequent tests failing due to cascading problems:
poor test clean up, triggers left running, persistent loads, pid=0 not running, tests timing out, and so on. These problems require investigation.

For now, skip the precipitating test.

See
https://oss.oracle.com/pipermail/dtrace-devel/2025-November/006916.html

Incidentally, there are similar issues for

* test/unittest/pid/err.D_PROC_CREATEFAIL.many.d
but this test is already marked SKIP, apparently for the same reason. See commit d9423bd79
("err.D_PROC_CREATEFAIL.many.d causes failures in subsequent tests"). The current patch simply seeks to apply the same SKIP to another test.

* test/demo/user/userfunc.d
but this test is marked XFAIL since it needs a trigger

All three tests should be resolved when the underlying problem is tackled.

Orabug: 38642080

---
 test/unittest/ustack/tst.depth.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
test/unittest/ustack/tst.depth.sh +2 -2
index dec16a3aa..4a67291de 100755
@@ -1,10 +1,10 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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.
-# @@xfail: dtv2
+# @@skip
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
Signature · 1 line
2.47.3
#1 lore raw

PATCH 2/6 Simple typo in comment

From: Eugene Loh <[email protected]>

---
 libdtrace/dt_probe.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdtrace/dt_probe.h +1 -1
index 54053cd3d..73b15553a 100644
@@ -33,7 +33,7 @@ typedef struct dt_probe_instance {
 typedef struct dt_probe {
 	dt_list_t list;			/* prev/next in enablings chain */
 	dt_list_t stmts;		/* stmts */
-	dt_list_t dependents;		/* dependenct probes to attach */
+	dt_list_t dependents;		/* dependent probes to attach */
 	const dtrace_probedesc_t *desc;	/* probe description (id, name) */
 	dt_provider_t *prov;		/* pointer to containing provider */
 	struct dt_hentry he_prv;	/* provider name htab links */
Signature · 1 line
2.47.3
#3 lore raw

PATCH 3/6 Check if the BPF PROG_LOAD is either -1 or else non-negative

In reply to [email protected]

From: Eugene Loh <[email protected]>

The return value is supposed to be -1 or non-negative. The current check lumps 0 with -1.

---
 libdtrace/dt_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdtrace/dt_bpf.c +1 -1
index fb66bd93b..c328f5100 100644
@@ -428,7 +428,7 @@ have_helper(uint32_t func_id)
 	/* If the program loads, we can use the helper. */
 	fd = dt_bpf_prog_attach(BPF_PROG_TYPE_KPROBE, 0, 0, 0, &dp,
 			      1, log, DT_BPF_LOG_SIZE_SMALL);
-	if (fd > 0) {
+	if (fd >= 0) {
 		close(fd);
 		return 1;
 	}
Signature · 1 line
2.47.3
#5 lore raw

PATCH 4/6 test: Remove unnecessary "destructive" pragma

In reply to [email protected]

From: Eugene Loh <[email protected]>

---
 test/unittest/sched/tst.oncpu.d | 1 -
 1 file changed, 1 deletion(-)
test/unittest/sched/tst.oncpu.d +0 -1
index 7a33bab4f..65bb313f0 100644
@@ -8,7 +8,6 @@
 /* @@timeout: 15 */
 
 #pragma D option switchrate=100hz
-#pragma D option destructive
 
 sched:::on-cpu
 /pid == $pid/
Signature · 1 line
2.47.3
#7 lore raw

PATCH 5/6 Possible uninitialized 'last' variable in usdt_copyin_data()

In reply to [email protected]

From: Eugene Loh <[email protected]>

Some compilers warn:

libcommon/usdt_parser.c: In function ‘usdt_copyin_data’:
libcommon/usdt_parser.c:191:15: warning:
‘last’ may be used uninitialized in this function [-Wmaybe-uninitialized]

    last->next = blk;
    ~~~~~~~~~~~^~~~~

Change the "if" check to make it easier for compilers to recognize that "last" will be initialized (and non-NULL even!).

---
 libcommon/usdt_parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libcommon/usdt_parser.c +2 -2
index 864198098..d8cb9b7ba 100644
@@ -163,7 +163,7 @@ usdt_destroy_data(usdt_data_t *data)
 usdt_data_t *
 usdt_copyin_data(int in, int out, int *ok)
 {
-	usdt_data_t *first = NULL, *last;
+	usdt_data_t *first = NULL, *last = NULL;
 	size_t cnt;
 
 	*ok = 1;
@@ -185,7 +185,7 @@ usdt_copyin_data(int in, int out, int *ok)
 		if ((blk = usdt_copyin_block(in, out, ok)) == NULL)
 			goto err;
 
-		if (first == NULL)
+		if (last == NULL)
 			first = last = blk;
 		else {
 			last->next = blk;
Signature · 1 line
2.47.3
Reviewed-by on v1 5/6
#8 lore raw

Re: [DTrace-devel] [PATCH 5/6] Possible uninitialized 'last' variable in usdt_copyin_data()

On 31 Mar 2026, eugene loh told this:

Quoted 6 lines

From: Eugene Loh <[email protected]>

Some compilers warn:

libcommon/usdt_parser.c: In function ‘usdt_copyin_data’:
libcommon/usdt_parser.c:191:15: warning:

Quoted 8 lines
   ‘last’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    last->next = blk;
    ~~~~~~~~~~~^~~~~

Change the "if" check to make it easier for compilers to recognize that "last" will be initialized (and non-NULL even!).

Ugh. Still, if it works, it works, and it's semantically the same.

Signature · 1 line
NULL && (void)
#9 lore raw

PATCH 6/6 test: Check declaration (without init) inside a probe

In reply to [email protected]

From: Eugene Loh <[email protected]>

We test that declaration (with init) of a variable inside a probe is not allowed.

Check also that declaration without init inside a probe is also forbidden.

The related test/unittest/probes/err.D_SYNTAX/err.D_SYNTAX.declare*.d tests are left alone.

---
 .../scalars/err.D_SYNTAX.declare-init.d       | 20 +++++++++++++++++++
 test/unittest/scalars/err.D_SYNTAX.declare.d  |  4 ++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 test/unittest/scalars/err.D_SYNTAX.declare-init.d
test/unittest/scalars/err.D_SYNTAX.declare-init.d new file +20 -0
new file mode 100644
index 000000000..fd8dca6c0
@@ -0,0 +1,20 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 2026, 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.
+ */
+
+/*
+ * ASSERTION:
+ *
+ * Declare and init a variable Inside Begin and make sure compilation fails.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+BEGIN
+{
+	int x = 123;
+}
test/unittest/scalars/err.D_SYNTAX.declare.d +2 -2
index f5b2ea914..b26acd04a 100644
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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.
  */
@@ -16,5 +16,5 @@
 
 BEGIN
 {
-	int x = 123;
+	int x;
 }
Signature · 1 line
2.47.3
Reviewed-by on v1 6/6
#10 lore raw

Re: [DTrace-devel] [PATCH 6/6] test: Check declaration (without init) inside a probe

On 31 Mar 2026, eugene loh stated:

Quoted 5 lines

From: Eugene Loh <[email protected]>

We test that declaration (with init) of a variable inside a probe is not allowed.

Quoted 7 lines

Check also that declaration without init inside a probe is also forbidden.

The related test/unittest/probes/err.D_SYNTAX/err.D_SYNTAX.declare*.d tests are left alone.

Signature · 1 line
NULL && (void)
#11 lore raw
In reply to [email protected]

On 31 Mar 2026, eugene loh told this:

Quoted 8 lines

From: Eugene Loh <[email protected]>

The test asks for very many pid probes. E.g.,

        pid$target:::entry,
        pid$target:::return,
        pid$target:a.out::,
Quoted 7 lines

If it is successful, this can wreak havoc on some systems, in some cases leading to 1-2 dozen subsequent tests failing due to cascading problems:
poor test clean up, triggers left running, persistent loads, pid=0 not running, tests timing out, and so on. These problems require investigation.

For now, skip the precipitating test.

This sort of thing is what the tagging system is for. This should probably be a default-skipped tag instead:

@@tag: skip-default

And add

!skip-default

into test/tags.default (not currently existing).

(The same is probably true of most of the other remaining skipped tests.)

Signature · 1 line
NULL && (void)