[DTrace-devel] [PATCH] test: Convert tick-* probes to ioctl:entry for more tests

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Mar 7 18:48:48 UTC 2023


From: Eugene Loh <eugene.loh at oracle.com>

There are currently reliability issues in the kernel for tick-* probes.
Meanwhile, many tests have historically relied on tick-* for test
construction, even though they simply needed any probe to fire "many
times" -- which probe fires is immaterial to the test.

In patches
    80a539ae test: Account for unreliable tick firing
    8b989703 test: Fix race condition in many-fire tests
many tests were converted from tick-* probes to ioctl:entry probes (and
adding the appropriate trigger).  Not all tests that "incidentally" use
tick-* probes were converted, to mitigate disruption to the test suite and
because many tests do not use tick-* very aggressively.

Nevertheless, a few more tests have been failing egregiously in extensive
testing due to this problem.  They use tick-* "moderately" (e.g., one or more
dozen times).

Convert more tests from tick-* to ioctl:entry.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/aggs/tst.lquantzero.d           | 18 ++++++++++--------
 test/unittest/aggs/tst.negorder.d             | 18 ++++++++++--------
 test/unittest/funcs/substr/tst.substrminate.d | 10 ++++++----
 test/unittest/funcs/tst.basename.d            | 11 ++++++-----
 test/unittest/multiaggs/tst.sort.d            | 10 ++++++----
 test/unittest/multiaggs/tst.sortpos.d         | 15 ++++++++-------
 6 files changed, 46 insertions(+), 36 deletions(-)

diff --git a/test/unittest/aggs/tst.lquantzero.d b/test/unittest/aggs/tst.lquantzero.d
index 8f69d9a9..b942015d 100644
--- a/test/unittest/aggs/tst.lquantzero.d
+++ b/test/unittest/aggs/tst.lquantzero.d
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 
@@ -14,20 +15,21 @@ BEGIN
 	val = (-a * b) + a;
 }
 
-tick-1ms
+syscall::ioctl:entry
+/pid == $target/
 {
 	incr = val % b;
 	val += a;
 }
 
-tick-1ms
-/val == 0/
+syscall::ioctl:entry
+/pid == $target && val == 0/
 {
 	val += a;
 }
 
-tick-1ms
-/incr != 0/
+syscall::ioctl:entry
+/pid == $target && incr != 0/
 {
 	i++;
 	@one[i] = lquantize(0, 10, 20, 1, incr);
@@ -39,8 +41,8 @@ tick-1ms
 	@seven[i] = lquantize(0, -10, -2, 1, incr);
 }
 
-tick-1ms
-/incr == 0/
+syscall::ioctl:entry
+/pid == $target && incr == 0/
 {
 	printf("Zero below the range:\n");
 	printa(@one);
diff --git a/test/unittest/aggs/tst.negorder.d b/test/unittest/aggs/tst.negorder.d
index 4d5e6386..1e43b0dc 100644
--- a/test/unittest/aggs/tst.negorder.d
+++ b/test/unittest/aggs/tst.negorder.d
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 
@@ -14,20 +15,21 @@ BEGIN
 	val = (-a * b) + a;
 }
 
-tick-1ms
+syscall::ioctl:entry
+/pid == $target/
 {
 	incr = val % b;
 	val += a;
 }
 
-tick-1ms
-/val == 0/
+syscall::ioctl:entry
+/pid == $target && val == 0/
 {
 	val += a;
 }
 
-tick-1ms
-/incr != 0/
+syscall::ioctl:entry
+/pid == $target && incr != 0/
 {
 	i++;
 	@quanty[i] = quantize(1, incr);
@@ -37,8 +39,8 @@ tick-1ms
 	@minny[i] = min(incr);
 }
 
-tick-1ms
-/incr == 0/
+syscall::ioctl:entry
+/pid == $target && incr == 0/
 {
 	printf("Ordering of quantize() with some negative weights:\n");
 	printa(@quanty);
diff --git a/test/unittest/funcs/substr/tst.substrminate.d b/test/unittest/funcs/substr/tst.substrminate.d
index 573a2076..56532bc7 100644
--- a/test/unittest/funcs/substr/tst.substrminate.d
+++ b/test/unittest/funcs/substr/tst.substrminate.d
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 #pragma D option aggsortkey
@@ -13,13 +14,14 @@
  * substr() subroutine.
  */
 
-tick-1ms
-/i++ > 10/
+syscall::ioctl:entry
+/pid == $target && i++ > 10/
 {
 	exit(0);
 }
 
-tick-1ms
+syscall::ioctl:entry
+/pid == $target/
 {
 	@[substr((i & 1) ? "Bryan is smart" : "he's not a dummy", 0,
 	    (i & 1) ? 8 : 18)] = count();
diff --git a/test/unittest/funcs/tst.basename.d b/test/unittest/funcs/tst.basename.d
index 0d0c00c9..86d80873 100644
--- a/test/unittest/funcs/tst.basename.d
+++ b/test/unittest/funcs/tst.basename.d
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 
@@ -41,8 +42,8 @@ BEGIN
 	printf("#!/bin/bash\n\n");
 }
 
-tick-1ms
-/i < end/
+syscall::ioctl:entry
+/pid == $target && i < end/
 {
 	printf("if [ `basename \"%s\"` != \"%s\" ]; then\n",
 	    dir[i], basename(dir[i]));
@@ -59,8 +60,8 @@ tick-1ms
 	i++;
 }
 
-tick-1ms
-/i == end/
+syscall::ioctl:entry
+/pid == $target && i == end/
 {
 	exit(0);
 }
diff --git a/test/unittest/multiaggs/tst.sort.d b/test/unittest/multiaggs/tst.sort.d
index f9be92df..f653a30d 100644
--- a/test/unittest/multiaggs/tst.sort.d
+++ b/test/unittest/multiaggs/tst.sort.d
@@ -1,13 +1,15 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 
-tick-1ms
+syscall::ioctl:entry
+/pid == $target/
 {
 	i++;
 	@a[i] = sum(100 - (i / 2));
@@ -16,8 +18,8 @@ tick-1ms
 	@d[i] = sum(100 - (i / 16));
 }
 
-tick-1ms
-/i == 100/
+syscall::ioctl:entry
+/pid == $target && i == 100/
 {
 	printa("%10d %@10d %@10d %@10d %@10d\n", @a, @b, @c, @d);
 	printa("%10d %@10d %@10d %@10d %@10d\n", @d, @c, @b, @a);
diff --git a/test/unittest/multiaggs/tst.sortpos.d b/test/unittest/multiaggs/tst.sortpos.d
index 36763186..223bc15d 100644
--- a/test/unittest/multiaggs/tst.sortpos.d
+++ b/test/unittest/multiaggs/tst.sortpos.d
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, 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.
  */
+/* @@trigger: bogus-ioctl */
 
 #pragma D option quiet
 
@@ -12,8 +13,8 @@ BEGIN
 	j = 0;
 }
 
-tick-1ms
-/i < 100/
+syscall::ioctl:entry
+/pid == $target && i < 100/
 {
 	i++;
 	@a[i] = sum(i);
@@ -22,8 +23,8 @@ tick-1ms
 	@d[i] = sum((75 + i) % 100);
 }
 
-tick-1ms
-/i == 100 && j < 10/
+syscall::ioctl:entry
+/pid == $target && i == 100 && j < 10/
 {
 	printf("Sorted at position %d:\n", j);
 	setopt("aggsortpos", lltostr(j));
@@ -32,8 +33,8 @@ tick-1ms
 	j++;
 }
 
-tick-1ms
-/i == 100 && j == 10/
+syscall::ioctl:entry
+/pid == $target && i == 100 && j == 10/
 {
 	exit(0);
 }
-- 
2.18.4




More information about the DTrace-devel mailing list