[DTrace-devel] [PATCH] test: Make clearlquantize less susceptible to timer variations

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Feb 28 22:40:40 UTC 2023


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/aggs/tst.clearlquantize.d | 34 +++++++++++++++----------
 test/unittest/aggs/tst.clearlquantize.r |  2 +-
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/test/unittest/aggs/tst.clearlquantize.d b/test/unittest/aggs/tst.clearlquantize.d
index 7e47e3aa..dbd987db 100644
--- a/test/unittest/aggs/tst.clearlquantize.d
+++ b/test/unittest/aggs/tst.clearlquantize.d
@@ -1,45 +1,53 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, 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.
  */
 
 /*
  * ASSERTION:
- * 	Positive lquantize()/clear() test
+ * 	Positive quantize()/lquantize()/clear() test
  *
  * SECTION: Aggregations/Aggregations
  *
  * NOTES:
  *	Verifies that printing a clear()'d aggregation with an lquantize()
- *	aggregation function doesn't cause problems.
- *
+ *	or quantize() aggregation function doesn't cause problems.
  */
 
+/* @@nosort */
 
-#pragma D option switchrate=50ms
+#pragma D option switchrate=20ms
 #pragma D option aggrate=1ms
 #pragma D option quiet
 
-tick-100ms
+BEGIN
 {
-	x++;
-	@a["linear"] = lquantize(x, 0, 100, 1);
-	@b["exp"] = quantize(x);
+	z = 0;
 }
 
-tick-100ms
-/(x % 5) == 0 && y++ < 5/
+tick-500ms
+/(z % 2) == 0/
 {
+	x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x);
+	x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x);
+	x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x);
+	x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x);
+	x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x);
 	printa(@a);
 	printa(@b);
+}
+
+tick-500ms
+/(z % 2) == 1/
+{
 	clear(@a);
 	clear(@b);
 }
 
-tick-100ms
-/(x % 5) == 0 && y == 5/
+tick-500ms
+/z++ >= 9/
 {
 	exit(0);
 }
diff --git a/test/unittest/aggs/tst.clearlquantize.r b/test/unittest/aggs/tst.clearlquantize.r
index 5a1eb792..e7e2a600 100644
--- a/test/unittest/aggs/tst.clearlquantize.r
+++ b/test/unittest/aggs/tst.clearlquantize.r
@@ -1,3 +1,4 @@
+
   linear                                            
            value  ------------- Distribution ------------- count    
                0 |                                         0        
@@ -91,4 +92,3 @@
               32 |                                         0        
 
 
-
-- 
2.18.4




More information about the DTrace-devel mailing list