Skip to content

Commit 6d3d952

Browse files
authored
[XRay][account] add account test for nonempty exit mismatch (#93564)
- Add `llvm-xray account` regression test for an exit mismatch with a non empty stack (its a different code path than empty stack). - Align empty stack test case name.
1 parent fac6be6 commit 6d3d952

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#RUN: not llvm-xray account %s -o - -m %S/Inputs/simple-instrmap.yaml -d 2>&1 | FileCheck %s
2+
#RUN: llvm-xray account %s -k -o - -m %S/Inputs/simple-instrmap.yaml -d 2>&1 | FileCheck %s --check-prefix=KEEPGOING
3+
4+
---
5+
header:
6+
version: 1
7+
type: 0
8+
constant-tsc: true
9+
nonstop-tsc: true
10+
cycle-frequency: 0
11+
records:
12+
# An exit record doesn't match an entry record on a non empty stack with sibling call deduction.
13+
# This can happen for example when an instrumented function does a 'fork()',
14+
# where the child process will not see
15+
# the entry record but see the exit record. This is completely valid data,
16+
# which should be handled with grace (i.e. we treat it as an error, but since
17+
# the llvm-xray account tool has an option to keep going, gives the user a
18+
# chance to retry).
19+
- { type: 0, func-id: 1, cpu: 1, thread: 1, kind: function-enter, tsc: 10000 }
20+
- { type: 0, func-id: 4, cpu: 1, thread: 1, kind: function-exit, tsc: 10001 }
21+
- { type: 0, func-id: 1, cpu: 1, thread: 1, kind: function-exit, tsc: 10002 }
22+
...
23+
24+
#CHECK: Error processing record: {{.*}}
25+
#CHECK-NEXT: Thread ID: 1
26+
#CHECK-NEXT: #1 @(1)
27+
#CHECK-NEXT: llvm-xray: Failed accounting function calls in file '{{.*}}'.
28+
29+
#KEEPGOING: Error processing record: {{.*}}
30+
#KEEPGOING-NEXT: Thread ID: 1
31+
#KEEPGOING-NEXT: #1 @(1)

llvm/test/tools/llvm-xray/X86/account-keep-going.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ header:
77
nonstop-tsc: true
88
cycle-frequency: 0
99
records:
10-
# We want to test the case for when we see spurious exits, but keep going
11-
# anyway ignoring the records in the process.
10+
# We want to test the case for when we see spurious exits without sibling call deduction,
11+
# but keep going anyway ignoring the records in the process.
1212
- { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter, tsc: 10000 }
1313
- { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10001 }
1414
- { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-enter, tsc: 10002 }

0 commit comments

Comments
 (0)