xref: /llvm-project/bolt/test/X86/yaml-unknown-keys.test (revision 15fa3ba547bc3ee04af5c32b8f723a97e3feefd8)
1## Test that BOLT gracefully handles a YAML profile with unknown keys.
2
3# REQUIRES: system-linux
4# RUN: split-file %s %t
5# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
6# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
7# RUN: llvm-bolt %t.exe -o %t.null --data %t/profile.yaml \
8# RUN:   --profile-ignore-hash -v=1 2>&1 | FileCheck %s
9# CHECK: warning: unknown key 'unknown-header-key'
10# CHECK: warning: unknown key 'unknown_succ_key'
11# CHECK: warning: unknown key 'unknown_block_key'
12# CHECK: warning: unknown key 'unknown_function_key'
13# CHECK: warning: unknown key 'unknown_toplev_key'
14#--- main.s
15  .globl main
16  .type main, %function
17main:
18  .cfi_startproc
19  cmpl	$0x0, %eax
20  jne .LBB0
21.LBB0:
22  retq
23  .cfi_endproc
24.size main, .-main
25#--- profile.yaml
26---
27header:
28  profile-version: 1
29  binary-name:     'yaml-multiple-profiles.test.tmp.exe'
30  binary-build-id: '<unknown>'
31  profile-flags:   [ lbr ]
32  profile-origin:  branch profile reader
33  profile-events:  ''
34  dfs-order:       false
35  unknown-header-key: true
36functions:
37  - name:            'main'
38    fid:             1
39    hash:            0x50BBA3441D436491
40    exec:            1
41    nblocks:         1
42    blocks:
43      - bid:             0
44        insns:           2
45        hash:            0x4D4D8FAF7D4C0000
46        succ:            [ { bid: 1, cnt: 0, unknown_succ_key: 0x10 } ]
47        unknown_block_key: [ ]
48    unknown_function_key: 1
49unknown_toplev_key: ''
50...
51