[DTrace-devel] [PATCH] test: Clean up flowindent test

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Feb 20 22:43:27 UTC 2024


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

The flowindent test was marked XFAIL, claiming that
"flowindent is broken," but arguably the situation is more
nuanced than that.

The flowindent formatting is perhaps always going to be not completely
robust.  Each call to dt_consume_cpu() resets flowindent state.  This
is "necessarily" so, since data from different CPUs can be very difficult
(for multiple reasons) to interweave in any sensible fashion.

Therefore, adapt the test to jump less between CPUs.  For example,
trace only the target process:  /pid == $target/.

Further, improve the chances of a CPU finishing writing to its
buffer before the consumer tries to read the buffer.  E.g., employ
a switchrate:  -xswitchrate=1s.  Since this consumer throttling
takes a moment to kick in, do not worry about the first few probe
firings -- see tst.flowindent.r.p.

While we're at it, remove the unneeded tick probes.

Finally, not only update the .r results file, but also add such a
file for aarch64.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 .../unittest/options/tst.flowindent.aarch64.r | 160 ++++++++++++++++++
 test/unittest/options/tst.flowindent.d        |  22 +--
 test/unittest/options/tst.flowindent.r        |  44 -----
 test/unittest/options/tst.flowindent.r.p      |   7 +
 test/unittest/options/tst.flowindent.x86_64.r | 160 ++++++++++++++++++
 5 files changed, 331 insertions(+), 62 deletions(-)
 create mode 100644 test/unittest/options/tst.flowindent.aarch64.r
 delete mode 100644 test/unittest/options/tst.flowindent.r
 create mode 100755 test/unittest/options/tst.flowindent.r.p
 create mode 100644 test/unittest/options/tst.flowindent.x86_64.r

diff --git a/test/unittest/options/tst.flowindent.aarch64.r b/test/unittest/options/tst.flowindent.aarch64.r
new file mode 100644
index 00000000..7e745280
--- /dev/null
+++ b/test/unittest/options/tst.flowindent.aarch64.r
@@ -0,0 +1,160 @@
+ => read                                  syscall: 40
+
+   -> __arm64_sys_read                    fbt: 40
+
+   <- __arm64_sys_read                    fbt: 41
+
+ <= read                                  syscall: 41
+
+ => read                                  syscall: 42
+
+   -> __arm64_sys_read                    fbt: 42
+
+   <- __arm64_sys_read                    fbt: 43
+
+ <= read                                  syscall: 43
+
+ => read                                  syscall: 44
+
+   -> __arm64_sys_read                    fbt: 44
+
+   <- __arm64_sys_read                    fbt: 45
+
+ <= read                                  syscall: 45
+
+ => read                                  syscall: 46
+
+   -> __arm64_sys_read                    fbt: 46
+
+   <- __arm64_sys_read                    fbt: 47
+
+ <= read                                  syscall: 47
+
+ => read                                  syscall: 48
+
+   -> __arm64_sys_read                    fbt: 48
+
+   <- __arm64_sys_read                    fbt: 49
+
+ <= read                                  syscall: 49
+
+ => read                                  syscall: 50
+
+   -> __arm64_sys_read                    fbt: 50
+
+   <- __arm64_sys_read                    fbt: 51
+
+ <= read                                  syscall: 51
+
+ => read                                  syscall: 52
+
+   -> __arm64_sys_read                    fbt: 52
+
+   <- __arm64_sys_read                    fbt: 53
+
+ <= read                                  syscall: 53
+
+ => read                                  syscall: 54
+
+   -> __arm64_sys_read                    fbt: 54
+
+   <- __arm64_sys_read                    fbt: 55
+
+ <= read                                  syscall: 55
+
+ => read                                  syscall: 56
+
+   -> __arm64_sys_read                    fbt: 56
+
+   <- __arm64_sys_read                    fbt: 57
+
+ <= read                                  syscall: 57
+
+ => read                                  syscall: 58
+
+   -> __arm64_sys_read                    fbt: 58
+
+   <- __arm64_sys_read                    fbt: 59
+
+ <= read                                  syscall: 59
+
+ => read                                  syscall: 60
+
+   -> __arm64_sys_read                    fbt: 60
+
+   <- __arm64_sys_read                    fbt: 61
+
+ <= read                                  syscall: 61
+
+ => read                                  syscall: 62
+
+   -> __arm64_sys_read                    fbt: 62
+
+   <- __arm64_sys_read                    fbt: 63
+
+ <= read                                  syscall: 63
+
+ => read                                  syscall: 64
+
+   -> __arm64_sys_read                    fbt: 64
+
+   <- __arm64_sys_read                    fbt: 65
+
+ <= read                                  syscall: 65
+
+ => read                                  syscall: 66
+
+   -> __arm64_sys_read                    fbt: 66
+
+   <- __arm64_sys_read                    fbt: 67
+
+ <= read                                  syscall: 67
+
+ => read                                  syscall: 68
+
+   -> __arm64_sys_read                    fbt: 68
+
+   <- __arm64_sys_read                    fbt: 69
+
+ <= read                                  syscall: 69
+
+ => read                                  syscall: 70
+
+   -> __arm64_sys_read                    fbt: 70
+
+   <- __arm64_sys_read                    fbt: 71
+
+ <= read                                  syscall: 71
+
+ => read                                  syscall: 72
+
+   -> __arm64_sys_read                    fbt: 72
+
+   <- __arm64_sys_read                    fbt: 73
+
+ <= read                                  syscall: 73
+
+ => read                                  syscall: 74
+
+   -> __arm64_sys_read                    fbt: 74
+
+   <- __arm64_sys_read                    fbt: 75
+
+ <= read                                  syscall: 75
+
+ => read                                  syscall: 76
+
+   -> __arm64_sys_read                    fbt: 76
+
+   <- __arm64_sys_read                    fbt: 77
+
+ <= read                                  syscall: 77
+
+ => read                                  syscall: 78
+
+   -> __arm64_sys_read                    fbt: 78
+
+   <- __arm64_sys_read                    fbt: 79
+
+ <= read                                  syscall: 79
+
diff --git a/test/unittest/options/tst.flowindent.d b/test/unittest/options/tst.flowindent.d
index 8f8c2102..1ce1e26f 100644
--- a/test/unittest/options/tst.flowindent.d
+++ b/test/unittest/options/tst.flowindent.d
@@ -1,10 +1,9 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024, 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.
  */
-/* @@xfail: flowindent is broken */
 
 /*
  * ASSERTION: The -xflowindent option enables entry/return matching output.
@@ -12,7 +11,7 @@
  * SECTION: Options and Tunables/Consumer Options
  */
 
-/* @@runtest-opts: -xflowindent -Z */
+/* @@runtest-opts: -xflowindent -Z -xswitchrate=1s */
 /* @@timeout: 15 */
 /* @@trigger: readwholedir */
 
@@ -20,11 +19,10 @@ BEGIN
 {
 	i = 0;
 	j = 0;
-	k = 0;
 }
 
 syscall::read:
-/i < 10/
+/pid == $target/
 {
 	printf("syscall: %d\n", i++);
 }
@@ -32,19 +30,7 @@ syscall::read:
 fbt:vmlinux:SyS_read:,
 fbt:vmlinux:__arm64_sys_read:,
 fbt:vmlinux:__x64_sys_read:
-/j < 10/
+/pid == $target/
 {
 	printf("fbt: %d\n", j++);
 }
-
-profile:::tick-1sec
-/k < 4/
-{
-	printf("profile: %d\n", k++);
-}
-
-profile:::tick-10sec
-/i > 9 && j > 9 && k > 3/
-{
-	exit(0);
-}
diff --git a/test/unittest/options/tst.flowindent.r b/test/unittest/options/tst.flowindent.r
deleted file mode 100644
index aae92b2e..00000000
--- a/test/unittest/options/tst.flowindent.r
+++ /dev/null
@@ -1,44 +0,0 @@
-FUNCTION                                 
- => read                                  syscall: 0
-
-   -> __x64_sys_read                      fbt: 0
-
-   <- __x64_sys_read                      fbt: 1
-
- <= read                                  syscall: 1
-
- => read                                  syscall: 2
-
-   -> __x64_sys_read                      fbt: 2
-
-   <- __x64_sys_read                      fbt: 3
-
- <= read                                  syscall: 3
-
- => read                                  syscall: 4
-
-   -> __x64_sys_read                      fbt: 4
-
-   <- __x64_sys_read                      fbt: 5
-
- <= read                                  syscall: 5
-
- => read                                  syscall: 6
-
-   -> __x64_sys_read                      fbt: 6
-
-   <- __x64_sys_read                      fbt: 7
-
- <= read                                  syscall: 7
-
- => read                                  syscall: 8
-
-   -> __x64_sys_read                      fbt: 8
-
-   <- __x64_sys_read                      fbt: 9
-
- <= read                                  syscall: 9
-
-
--- @@stderr --
-dtrace: script 'test/unittest/options/tst.flowindent.d' matched 7 probes
diff --git a/test/unittest/options/tst.flowindent.r.p b/test/unittest/options/tst.flowindent.r.p
new file mode 100755
index 00000000..1c648960
--- /dev/null
+++ b/test/unittest/options/tst.flowindent.r.p
@@ -0,0 +1,7 @@
+#!/usr/bin/gawk -f
+
+# Report only from 40 to 80.
+BEGIN { report = 0 }
+$NF == 40 { report = 1 }
+$NF == 80 { report = 0 }
+report == 1 { print }
diff --git a/test/unittest/options/tst.flowindent.x86_64.r b/test/unittest/options/tst.flowindent.x86_64.r
new file mode 100644
index 00000000..53800726
--- /dev/null
+++ b/test/unittest/options/tst.flowindent.x86_64.r
@@ -0,0 +1,160 @@
+ => read                                  syscall: 40
+
+   -> __x64_sys_read                      fbt: 40
+
+   <- __x64_sys_read                      fbt: 41
+
+ <= read                                  syscall: 41
+
+ => read                                  syscall: 42
+
+   -> __x64_sys_read                      fbt: 42
+
+   <- __x64_sys_read                      fbt: 43
+
+ <= read                                  syscall: 43
+
+ => read                                  syscall: 44
+
+   -> __x64_sys_read                      fbt: 44
+
+   <- __x64_sys_read                      fbt: 45
+
+ <= read                                  syscall: 45
+
+ => read                                  syscall: 46
+
+   -> __x64_sys_read                      fbt: 46
+
+   <- __x64_sys_read                      fbt: 47
+
+ <= read                                  syscall: 47
+
+ => read                                  syscall: 48
+
+   -> __x64_sys_read                      fbt: 48
+
+   <- __x64_sys_read                      fbt: 49
+
+ <= read                                  syscall: 49
+
+ => read                                  syscall: 50
+
+   -> __x64_sys_read                      fbt: 50
+
+   <- __x64_sys_read                      fbt: 51
+
+ <= read                                  syscall: 51
+
+ => read                                  syscall: 52
+
+   -> __x64_sys_read                      fbt: 52
+
+   <- __x64_sys_read                      fbt: 53
+
+ <= read                                  syscall: 53
+
+ => read                                  syscall: 54
+
+   -> __x64_sys_read                      fbt: 54
+
+   <- __x64_sys_read                      fbt: 55
+
+ <= read                                  syscall: 55
+
+ => read                                  syscall: 56
+
+   -> __x64_sys_read                      fbt: 56
+
+   <- __x64_sys_read                      fbt: 57
+
+ <= read                                  syscall: 57
+
+ => read                                  syscall: 58
+
+   -> __x64_sys_read                      fbt: 58
+
+   <- __x64_sys_read                      fbt: 59
+
+ <= read                                  syscall: 59
+
+ => read                                  syscall: 60
+
+   -> __x64_sys_read                      fbt: 60
+
+   <- __x64_sys_read                      fbt: 61
+
+ <= read                                  syscall: 61
+
+ => read                                  syscall: 62
+
+   -> __x64_sys_read                      fbt: 62
+
+   <- __x64_sys_read                      fbt: 63
+
+ <= read                                  syscall: 63
+
+ => read                                  syscall: 64
+
+   -> __x64_sys_read                      fbt: 64
+
+   <- __x64_sys_read                      fbt: 65
+
+ <= read                                  syscall: 65
+
+ => read                                  syscall: 66
+
+   -> __x64_sys_read                      fbt: 66
+
+   <- __x64_sys_read                      fbt: 67
+
+ <= read                                  syscall: 67
+
+ => read                                  syscall: 68
+
+   -> __x64_sys_read                      fbt: 68
+
+   <- __x64_sys_read                      fbt: 69
+
+ <= read                                  syscall: 69
+
+ => read                                  syscall: 70
+
+   -> __x64_sys_read                      fbt: 70
+
+   <- __x64_sys_read                      fbt: 71
+
+ <= read                                  syscall: 71
+
+ => read                                  syscall: 72
+
+   -> __x64_sys_read                      fbt: 72
+
+   <- __x64_sys_read                      fbt: 73
+
+ <= read                                  syscall: 73
+
+ => read                                  syscall: 74
+
+   -> __x64_sys_read                      fbt: 74
+
+   <- __x64_sys_read                      fbt: 75
+
+ <= read                                  syscall: 75
+
+ => read                                  syscall: 76
+
+   -> __x64_sys_read                      fbt: 76
+
+   <- __x64_sys_read                      fbt: 77
+
+ <= read                                  syscall: 77
+
+ => read                                  syscall: 78
+
+   -> __x64_sys_read                      fbt: 78
+
+   <- __x64_sys_read                      fbt: 79
+
+ <= read                                  syscall: 79
+
-- 
2.18.4




More information about the DTrace-devel mailing list