1 ## When running main twice, we'll also output the time trace JSON twice, which
2 ## breaks JSON parsing.
3 # XFAIL: main-run-twice
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
8 ## Test implicit trace file name
9 # RUN: %lld --time-trace --time-trace-granularity=0 -o %t1.macho %t.o
10 # RUN: cat %t1.macho.time-trace \
11 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
14 ## Test specified trace file name.
15 # RUN: %lld --time-trace=%t2.json --time-trace-granularity=0 -o %t2.macho %t.o
17 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
20 ## Test trace requested to stdout.
21 # RUN: %lld --time-trace=- --time-trace-granularity=0 -o %t3.macho %t.o \
22 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
25 # CHECK: "beginningOfTime": {{[0-9]{16},}}
26 # CHECK-NEXT: "traceEvents": [
28 ## Check one event has correct fields
36 ## Check there is an ExecuteLinker event
37 # CHECK: "name": "ExecuteLinker"
39 ## Check process_name entry field
40 # CHECK: "name": "ld64.lld{{(.exe)?}}"
41 # CHECK: "name": "process_name"
42 # CHECK: "name": "thread_name"