[DTrace-devel] [PATCH 3/4] test: Convert tick-* probes to write:entry probes for trunc() test
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu Sep 7 22:39:23 UTC 2023
From: Eugene Loh <eugene.loh at oracle.com>
In commit 07a56e29b6c1
"test: Convert tick-* probes to write:entry probes for clear() tests",
clear() tests were cleaned up because they rely on tricky interactions
between the producer and consumer. Make the same change here for a
trunc() test that has been seen to be similarly vulnerable.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/aggs/tst.trunc0.d | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/test/unittest/aggs/tst.trunc0.d b/test/unittest/aggs/tst.trunc0.d
index fb5adbef..7686d019 100644
--- a/test/unittest/aggs/tst.trunc0.d
+++ b/test/unittest/aggs/tst.trunc0.d
@@ -1,32 +1,36 @@
/*
* 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.
*/
+/* @@trigger: periodic_output */
+/* @@nosort */
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=50ms
-int i;
-
-tick-100ms
-/i < 10/
-{
- @[i] = sum(10 - i);
- i++;
-}
-
-tick-100ms
-/i == 5/
+BEGIN
{
+ n = 0;
+ i = 0; @[i] = sum(10 - i);
+ i = 1; @[i] = sum(10 - i);
+ i = 2; @[i] = sum(10 - i);
+ i = 3; @[i] = sum(10 - i);
+ i = 4; @[i] = sum(10 - i);
trunc(@);
}
-tick-100ms
-/i == 10/
+/* Wait for the trunc() to be performed by the consumer. */
+syscall::write:entry
+/pid == $target && n++ == 2/
{
+ i = 5; @[i] = sum(10 - i);
+ i = 6; @[i] = sum(10 - i);
+ i = 7; @[i] = sum(10 - i);
+ i = 8; @[i] = sum(10 - i);
+ i = 9; @[i] = sum(10 - i);
exit(0);
}
--
2.18.4
More information about the DTrace-devel
mailing list