[DTrace-devel] [PATCH] test: Convert tick-* probes to BEGIN probes for count-not-quiet test

eugene.loh at oracle.com eugene.loh at oracle.com
Thu Mar 2 22:51:15 UTC 2023


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

The tick-* mechanism can be fickle on some platforms.  Do not use
it for this test, which is intended simply to check that aggregations
do not result in data-recording actions.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/aggs/tst.count_notquiet.d | 32 ++++++++++++++++++-------
 test/unittest/aggs/tst.count_notquiet.r |  8 +++++--
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/test/unittest/aggs/tst.count_notquiet.d b/test/unittest/aggs/tst.count_notquiet.d
index a55e3b41..87954418 100644
--- a/test/unittest/aggs/tst.count_notquiet.d
+++ b/test/unittest/aggs/tst.count_notquiet.d
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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.
  */
@@ -11,11 +11,25 @@
  * SECTION: Aggregations/Aggregations
  */
 
-tick-100ms
-{
-	@a = count();
-}
-tick-1005ms
-{
-	exit(0);
-}
+/* three default actions */
+BEGIN { }
+BEGIN { }
+BEGIN { }
+
+/* one explicit action */
+BEGIN { trace("hello world"); }
+
+/* ten non-data-recording actions */
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+BEGIN { @a = count(); }
+
+/* exit */
+BEGIN { exit(0); }
diff --git a/test/unittest/aggs/tst.count_notquiet.r b/test/unittest/aggs/tst.count_notquiet.r
index b6a14daa..8be93948 100644
--- a/test/unittest/aggs/tst.count_notquiet.r
+++ b/test/unittest/aggs/tst.count_notquiet.r
@@ -1,6 +1,10 @@
                    FUNCTION:NAME
-                    :tick-1005ms 
+                          :BEGIN 
+                          :BEGIN 
+                          :BEGIN 
+                          :BEGIN   hello world                      
+                          :BEGIN 
 
                10
 -- @@stderr --
-dtrace: script 'test/unittest/aggs/tst.count_notquiet.d' matched 2 probes
+dtrace: script 'test/unittest/aggs/tst.count_notquiet.d' matched 15 probes
-- 
2.18.4




More information about the DTrace-devel mailing list