Skip to content

Commit

Permalink
test: Clean up flowindent test
Browse files Browse the repository at this point in the history
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@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Feb 22, 2024
1 parent 6e99a62 commit e3c8b28
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 62 deletions.
160 changes: 160 additions & 0 deletions test/unittest/options/tst.flowindent.aarch64.r
Original file line number Diff line number Diff line change
@@ -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

22 changes: 4 additions & 18 deletions test/unittest/options/tst.flowindent.d
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
/*
* 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.
*
* SECTION: Options and Tunables/Consumer Options
*/

/* @@runtest-opts: -xflowindent -Z */
/* @@runtest-opts: -xflowindent -Z -xswitchrate=1s */
/* @@timeout: 15 */
/* @@trigger: readwholedir */

BEGIN
{
i = 0;
j = 0;
k = 0;
}

syscall::read:
/i < 10/
/pid == $target/
{
printf("syscall: %d\n", i++);
}

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);
}
44 changes: 0 additions & 44 deletions test/unittest/options/tst.flowindent.r

This file was deleted.

7 changes: 7 additions & 0 deletions test/unittest/options/tst.flowindent.r.p
Original file line number Diff line number Diff line change
@@ -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 }

0 comments on commit e3c8b28

Please sign in to comment.