1## Check we are able to have multiple YAMLs in a file and switch between
2## them using --docnum=x option.
3
4# RUN: yaml2obj --docnum=1 %s \
5# RUN:   | llvm-readobj --symbols - | FileCheck -check-prefix=DOC1 %s
6# RUN: yaml2obj --docnum=2 %s \
7# RUN:   | llvm-readobj --symbols - | FileCheck -check-prefix=DOC2 %s
8# RUN: yaml2obj --docnum=3 %s \
9# RUN:   | llvm-readobj --symbols - | FileCheck -check-prefix=DOC3 %s
10# RUN: yaml2obj --docnum=4 %s \
11# RUN:   | llvm-readobj --symbols - | FileCheck -check-prefix=DOC4 %s
12# RUN: not yaml2obj --docnum=5 %s 2>&1 \
13# RUN:   | FileCheck -check-prefix=DOC5 %s
14
15# DOC1: Name: _sym1
16# DOC2: Name: _sym2
17# DOC3: Name: _sym3
18# DOC4: Name: _sym4
19# DOC5: error: cannot find the 5th document
20
21--- !ELF
22FileHeader: !FileHeader
23  Class: ELFCLASS32
24  Data: ELFDATA2LSB
25  Type: ET_REL
26  Machine: EM_MIPS
27  Flags: [EF_MIPS_CPIC]
28Symbols:
29- Name: _sym1
30
31--- !ELF
32FileHeader: !FileHeader
33  Class: ELFCLASS32
34  Data: ELFDATA2LSB
35  Type: ET_REL
36  Machine: EM_386
37Symbols:
38- Name: _sym2
39
40--- !COFF
41header:
42  Machine: IMAGE_FILE_MACHINE_I386
43  Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ]
44
45sections:
46  - Name: .text
47    Alignment: 16
48    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE,
49                       IMAGE_SCN_MEM_READ ]
50    SectionData: "00000000"
51symbols:
52  - Name: .text
53    Value: 0
54    SectionNumber: 1
55    SimpleType: IMAGE_SYM_TYPE_NULL
56    ComplexType: IMAGE_SYM_DTYPE_NULL
57    StorageClass: IMAGE_SYM_CLASS_STATIC
58    SectionDefinition:
59      Length:          36
60      NumberOfRelocations: 3
61      NumberOfLinenumbers: 0
62      CheckSum:        0
63      Number:          1
64  - Name: _sym3
65    Value: 0
66    SectionNumber: 0
67    SimpleType: IMAGE_SYM_TYPE_NULL
68    ComplexType: IMAGE_SYM_DTYPE_NULL
69    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
70
71--- !COFF
72header:
73  Machine: IMAGE_FILE_MACHINE_I386
74  Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ]
75
76sections:
77  - Name: .text
78    Alignment: 16
79    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE,
80                       IMAGE_SCN_MEM_READ ]
81    SectionData: "00000000"
82symbols:
83  - Name: .text
84    Value: 0
85    SectionNumber: 1
86    SimpleType: IMAGE_SYM_TYPE_NULL
87    ComplexType: IMAGE_SYM_DTYPE_NULL
88    StorageClass: IMAGE_SYM_CLASS_STATIC
89    SectionDefinition:
90      Length:          36
91      NumberOfRelocations: 3
92      NumberOfLinenumbers: 0
93      CheckSum:        0
94      Number:          1
95  - Name: _sym4
96    Value: 0
97    SectionNumber: 0
98    SimpleType: IMAGE_SYM_TYPE_NULL
99    ComplexType: IMAGE_SYM_DTYPE_NULL
100    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
101