Skip to contentSkip to conversation

test: Skip pid-0 tests on oversubscribed systems

PATCH New [email protected] 1 participant 1 message Apr 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 test: Skip pid-0 tests on oversubscribed systems

From: Eugene Loh <[email protected]>

A number of tests check "tick-n /pid==0/" probes. The problem with this is that a tick-n probe runs on a specific CPU. If that CPU is fully subscribed, then pid 0 (swapper) will not run. Thus, the test will take a long time, only to time out.

Change these tests to use profile-n instead of tick-n probes, improving chances that the test probe will fire on a less subscribed CPU.

Therefore, also change the .r.p post-processing file so that it uses only one output line (in case two CPUs manage to write output).

Finally, add skip files in case pid 0 does not fire on any CPU.

---
 test/unittest/ustack/skip_pid0_if_oversubscribed.x | 5 +++++
 test/unittest/ustack/tst.kthread.d                 | 9 +++++++--
 test/unittest/ustack/tst.kthread.x                 | 1 +
 test/unittest/ustack/tst.uaddr-pid0.d              | 5 +++--
 test/unittest/ustack/tst.uaddr-pid0.r.p            | 4 ++--
 test/unittest/ustack/tst.uaddr-pid0.x              | 1 +
 test/unittest/ustack/tst.ufunc-pid0.d              | 5 +++--
 test/unittest/ustack/tst.ufunc-pid0.r.p            | 4 ++--
 test/unittest/ustack/tst.ufunc-pid0.x              | 1 +
 test/unittest/ustack/tst.usym-pid0.d               | 5 +++--
 test/unittest/ustack/tst.usym-pid0.r.p             | 4 ++--
 test/unittest/ustack/tst.usym-pid0.x               | 1 +
 12 files changed, 31 insertions(+), 14 deletions(-)
 create mode 100755 test/unittest/ustack/skip_pid0_if_oversubscribed.x
 create mode 120000 test/unittest/ustack/tst.kthread.x
 create mode 120000 test/unittest/ustack/tst.uaddr-pid0.x
 create mode 120000 test/unittest/ustack/tst.ufunc-pid0.x
 create mode 120000 test/unittest/ustack/tst.usym-pid0.x
test/unittest/ustack/skip_pid0_if_oversubscribed.x new file +5 -0
new file mode 100755
index 000000000..b5fe7177a
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+$dtrace -qn 'profile-100ms /pid == 0/ { exit(0) }
+             tick-1s { trace("cannot profile pid 0; oversubscribed system?"); exit(2) }'
+exit $?
test/unittest/ustack/tst.kthread.d +7 -2
index c6252b742..0fe5279f3 100644
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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.
  */
@@ -16,4 +16,9 @@
 
 #pragma D option quiet
 
-tick-100msec / pid == 0 / { ustack(); exit(0); }
+profile-100ms
+/ pid == 0 /
+{
+    ustack();
+    exit(0);
+}
test/unittest/ustack/tst.kthread.x new file +1 -0
new file mode 120000
index 000000000..1df0f1ccc
@@ -0,0 +1 @@
+skip_pid0_if_oversubscribed.x
\ No newline at end of file
test/unittest/ustack/tst.uaddr-pid0.d +3 -2
index 263a7ca94..3580f0cde 100644
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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.
  */
@@ -9,9 +9,10 @@
 
 #pragma D option quiet
 
-tick-1
+profile-100ms
 /pid == $target/
 {
     uaddr(ucaller);
+    printf("\n");
     exit(0);
 }
test/unittest/ustack/tst.uaddr-pid0.r.p +2 -2
index 9203dc824..78ab8e59d 100755
@@ -1,4 +1,4 @@
 #!/usr/bin/gawk -f
 
-# remove trailing blanks
-{ sub(" *$", ""); print }
+# remove trailing blanks, use only one line
+{ sub(" *$", ""); print; exit }
test/unittest/ustack/tst.uaddr-pid0.x new file +1 -0
new file mode 120000
index 000000000..1df0f1ccc
@@ -0,0 +1 @@
+skip_pid0_if_oversubscribed.x
\ No newline at end of file
test/unittest/ustack/tst.ufunc-pid0.d +3 -2
index f076782aa..0778c33c1 100644
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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.
  */
@@ -9,9 +9,10 @@
 
 #pragma D option quiet
 
-tick-1
+profile-100ms
 /pid == $target/
 {
     ufunc(ucaller);
+    printf("\n");
     exit(0);
 }
test/unittest/ustack/tst.ufunc-pid0.r.p +2 -2
index 9203dc824..78ab8e59d 100755
@@ -1,4 +1,4 @@
 #!/usr/bin/gawk -f
 
-# remove trailing blanks
-{ sub(" *$", ""); print }
+# remove trailing blanks, use only one line
+{ sub(" *$", ""); print; exit }
test/unittest/ustack/tst.ufunc-pid0.x new file +1 -0
new file mode 120000
index 000000000..1df0f1ccc
@@ -0,0 +1 @@
+skip_pid0_if_oversubscribed.x
\ No newline at end of file
test/unittest/ustack/tst.usym-pid0.d +3 -2
index d2f5ec5de..7833ab1e2 100644
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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.
  */
@@ -9,9 +9,10 @@
 
 #pragma D option quiet
 
-tick-1
+profile-100ms
 /pid == $target/
 {
     usym(ucaller);
+    printf("\n");
     exit(0);
 }
test/unittest/ustack/tst.usym-pid0.r.p +2 -2
index 9203dc824..78ab8e59d 100755
@@ -1,4 +1,4 @@
 #!/usr/bin/gawk -f
 
-# remove trailing blanks
-{ sub(" *$", ""); print }
+# remove trailing blanks, use only one line
+{ sub(" *$", ""); print; exit }
test/unittest/ustack/tst.usym-pid0.x new file +1 -0
new file mode 120000
index 000000000..1df0f1ccc
@@ -0,0 +1 @@
+skip_pid0_if_oversubscribed.x
\ No newline at end of file
Signature · 1 line
2.43.5