[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / tools / obj2yaml / Archives / regular.yaml
blob923d99dec812c20ef2efe5e6fa72b6853abd970a
1 ## Check how obj2yaml dumps regular archives.
3 ## Check how we dump an empty archive.
5 # RUN: yaml2obj %s --docnum=1 -o %t.empty.a
6 # RUN: obj2yaml %t.empty.a | FileCheck %s --check-prefix=EMPTY
8 # EMPTY:      --- !Arch
9 # EMPTY-NEXT: Members: []
10 # EMPTY-NEXT: ...
12 --- !Arch
13 Members: []
15 ## Check how we dump archives with multiple members.
16 ## Check we don't dump excessive spaces when dumping fields.
17 ## Check we don't dump fields with values that are equal to default values.
18 ## Check how we dump empty field values.
20 # RUN: yaml2obj %s --docnum=2 -o %t.multiple.a
21 # RUN: obj2yaml %t.multiple.a | FileCheck %s --check-prefix=MULTIPLE
23 # MULTIPLE:      --- !Arch
24 # MULTIPLE-NEXT: Members:
25 # MULTIPLE-NEXT:   - Name:         'bbb/'
26 # MULTIPLE-NEXT:     LastModified: '1'
27 # MULTIPLE-NEXT:     UID:          '2'
28 # MULTIPLE-NEXT:     GID:          '3'
29 # MULTIPLE-NEXT:     AccessMode:   '644'
30 # MULTIPLE-NEXT:     Size:         '6'
31 # MULTIPLE-NEXT:     Content:      20616161200A
32 # MULTIPLE-NEXT:   - Name:         'dddd/'
33 # MULTIPLE-NEXT:     LastModified: '4'
34 # MULTIPLE-NEXT:     UID:          '5'
35 # MULTIPLE-NEXT:     GID:          '6'
36 # MULTIPLE-NEXT:     AccessMode:   '987'
37 # MULTIPLE-NEXT:     Size:         '7'
38 # MULTIPLE-NEXT:     Content:      2063636363200A
39 # MULTIPLE-NEXT:     PaddingByte:  0xA
40 # MULTIPLE-NEXT:   - LastModified: ''
41 # MULTIPLE-NEXT:     UID:          ''
42 # MULTIPLE-NEXT:     GID:          ''
43 # MULTIPLE-NEXT:     AccessMode:   ''
44 # MULTIPLE-NEXT:     Terminator:   ''
45 # MULTIPLE-NEXT:     Content:      ''
46 # MULTIPLE-NEXT:   - {}
47 # MULTIPLE-NEXT: ...
49 --- !Arch
50 Members:
51   - Name:         'bbb/'
52     LastModified: '1'
53     UID:          '2'
54     GID:          '3'
55     AccessMode:   '644'
56     Size:         '6'
57     Terminator:   "`\n"
58     Content:      20616161200A ## " aaa \n"
59   - Name:         'dddd/'
60     LastModified: '4'
61     UID:          '5'
62     GID:          '6'
63     AccessMode:   '987'
64     Size:         '7'
65     Terminator:   "`\n"
66     Content:      2063636363200A ## " cccc \n"
67     PaddingByte:  0x0A
68 ## All fields are empty (where possible).
69   - Name:         ''
70     LastModified: ''
71     UID:          ''
72     GID:          ''
73     AccessMode:   ''
74     Size:         '0'
75     Terminator:   ''
76     Content:      ''
77 ## All fields are explicitly set to the default values.
78   - Name:         ''
79     LastModified: '0'
80     UID:          '0'
81     GID:          '0'
82     AccessMode:   '0'
83     Size:         '0'
84     Terminator:   "`\n"
85     Content:      ""
86 ...
88 ## Check we report an error for non-regular archives.
90 # RUN: yaml2obj %s --docnum=3 -o %t.not.regular.a
91 # RUN: not obj2yaml %t.not.regular.a 2>&1 | \
92 # RUN:   FileCheck %s -DFILE=%t.not.regular.a --check-prefix=NOT-REGULAR-ERR
94 # NOT-REGULAR-ERR: Error reading file: [[FILE]]: only regular archives are supported
96 --- !Arch
97 Magic: "!<thin>\n"
98 Members:
99   - {}
101 ## Check we report an error when unable to read the header of an archive member.
103 # RUN: yaml2obj %s --docnum=4 -o %t.truncated.a
104 # RUN: not obj2yaml %t.truncated.a 2>&1 | \
105 # RUN:   FileCheck %s -DFILE=%t.truncated.a --check-prefix=TRUNCATED-ERR
107 # TRUNCATED-ERR: Error reading file: [[FILE]]: unable to read the header of a child at offset 0x8
109 --- !Arch
110 Content: "00"
112 ## Check we report an error when unable to read the data of an archive member.
114 # RUN: yaml2obj %s --docnum=5 -o %t.entdata.a
115 # RUN: not obj2yaml %t.entdata.a 2>&1 | \
116 # RUN:   FileCheck %s -DFILE=%t.entdata.a --check-prefix=ENTDATA-ERR
118 # ENTDATA-ERR: Error reading file: [[FILE]]: unable to read the data of a child at offset 0x8 of size 1: the remaining archive size is 0
120 --- !Arch
121 Members:
122   - Size: [[SIZE='1']]
124 ## Check we report an error when unable to read the size of an archive member.
126 # RUN: yaml2obj %s --docnum=5 -DSIZE='x' -o %t.entsize.a
127 # RUN: not obj2yaml %t.entsize.a 2>&1 | \
128 # RUN:   FileCheck %s -DFILE=%t.entsize.a --check-prefix=ENTSIZE-ERR
130 # ENTSIZE-ERR: Error reading file: [[FILE]]: unable to read the size of a child at offset 0x8 as integer: "x"
132 ## Check we don't try to dump the padding byte when the size of the content is odd and
133 ## the content ends at the end of a file.
135 # RUN: yaml2obj %s --docnum=6 -DCONTENT="61" -o %t.no.padding.byte.a
136 # RUN: obj2yaml %t.no.padding.byte.a | FileCheck %s --check-prefix=NO-PADDING-BYTE
138 #      NO-PADDING-BYTE: --- !Arch
139 # NO-PADDING-BYTE-NEXT: Members:
140 # NO-PADDING-BYTE-NEXT:   - Size:    '1'
141 # NO-PADDING-BYTE-NEXT:     Content: '61'
142 # NO-PADDING-BYTE-NEXT: ...
144 --- !Arch
145 Members:
146   - Size:    '1'
147     Content: [[CONTENT]]
149 ## Check we dump the padding byte when the size of the content is odd and the content ends
150 ## before the end of a file.
152 # RUN: yaml2obj %s --docnum=6 -DCONTENT="610A" -o %t.padding.byte.a
153 # RUN: obj2yaml %t.padding.byte.a | FileCheck %s --check-prefix=PADDING-BYTE
155 #      PADDING-BYTE: --- !Arch
156 # PADDING-BYTE-NEXT: Members:
157 # PADDING-BYTE-NEXT:   - Size:        '1'
158 # PADDING-BYTE-NEXT:     Content:     '61'
159 # PADDING-BYTE-NEXT:     PaddingByte: 0xA
160 # PADDING-BYTE-NEXT: ...