File: regular.yaml

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (163 lines) | stat: -rw-r--r-- 5,147 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
## Check how obj2yaml dumps regular archives.

## Check how we dump an empty archive.

# RUN: yaml2obj %s --docnum=1 -o %t.empty.a
# RUN: obj2yaml %t.empty.a > %t.stdout.yaml
# RUN: obj2yaml %t.empty.a -o %t.file.yaml 2>&1 | count 0
# RUN: FileCheck --input-file=%t.stdout.yaml %s --check-prefix=EMPTY
# RUN: diff %t.stdout.yaml %t.file.yaml

# EMPTY:      --- !Arch
# EMPTY-NEXT: Members: []
# EMPTY-NEXT: ...

--- !Arch
Members: []

## Check how we dump archives with multiple members.
## Check we don't dump excessive spaces when dumping fields.
## Check we don't dump fields with values that are equal to default values.
## Check how we dump empty field values.

# RUN: yaml2obj %s --docnum=2 -o %t.multiple.a
# RUN: obj2yaml %t.multiple.a | FileCheck %s --check-prefix=MULTIPLE

# MULTIPLE:      --- !Arch
# MULTIPLE-NEXT: Members:
# MULTIPLE-NEXT:   - Name:         'bbb/'
# MULTIPLE-NEXT:     LastModified: '1'
# MULTIPLE-NEXT:     UID:          '2'
# MULTIPLE-NEXT:     GID:          '3'
# MULTIPLE-NEXT:     AccessMode:   '644'
# MULTIPLE-NEXT:     Size:         '6'
# MULTIPLE-NEXT:     Content:      20616161200A
# MULTIPLE-NEXT:   - Name:         'dddd/'
# MULTIPLE-NEXT:     LastModified: '4'
# MULTIPLE-NEXT:     UID:          '5'
# MULTIPLE-NEXT:     GID:          '6'
# MULTIPLE-NEXT:     AccessMode:   '987'
# MULTIPLE-NEXT:     Size:         '7'
# MULTIPLE-NEXT:     Content:      2063636363200A
# MULTIPLE-NEXT:     PaddingByte:  0xA
# MULTIPLE-NEXT:   - LastModified: ''
# MULTIPLE-NEXT:     UID:          ''
# MULTIPLE-NEXT:     GID:          ''
# MULTIPLE-NEXT:     AccessMode:   ''
# MULTIPLE-NEXT:     Terminator:   ''
# MULTIPLE-NEXT:     Content:      ''
# MULTIPLE-NEXT:   - {}
# MULTIPLE-NEXT: ...

--- !Arch
Members:
  - Name:         'bbb/'
    LastModified: '1'
    UID:          '2'
    GID:          '3'
    AccessMode:   '644'
    Size:         '6'
    Terminator:   "`\n"
    Content:      20616161200A ## " aaa \n"
  - Name:         'dddd/'
    LastModified: '4'
    UID:          '5'
    GID:          '6'
    AccessMode:   '987'
    Size:         '7'
    Terminator:   "`\n"
    Content:      2063636363200A ## " cccc \n"
    PaddingByte:  0x0A
## All fields are empty (where possible).
  - Name:         ''
    LastModified: ''
    UID:          ''
    GID:          ''
    AccessMode:   ''
    Size:         '0'
    Terminator:   ''
    Content:      ''
## All fields are explicitly set to the default values.
  - Name:         ''
    LastModified: '0'
    UID:          '0'
    GID:          '0'
    AccessMode:   '0'
    Size:         '0'
    Terminator:   "`\n"
    Content:      ""
...

## Check we report an error for non-regular archives.

# RUN: yaml2obj %s --docnum=3 -o %t.not.regular.a
# RUN: not obj2yaml %t.not.regular.a 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.not.regular.a --check-prefix=NOT-REGULAR-ERR

# NOT-REGULAR-ERR: Error reading file: [[FILE]]: only regular archives are supported

--- !Arch
Magic: "!<thin>\n"
Members:
  - {}

## Check we report an error when unable to read the header of an archive member.

# RUN: yaml2obj %s --docnum=4 -o %t.truncated.a
# RUN: not obj2yaml %t.truncated.a 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.truncated.a --check-prefix=TRUNCATED-ERR

# TRUNCATED-ERR: Error reading file: [[FILE]]: unable to read the header of a child at offset 0x8

--- !Arch
Content: "00"

## Check we report an error when unable to read the data of an archive member.

# RUN: yaml2obj %s --docnum=5 -o %t.entdata.a
# RUN: not obj2yaml %t.entdata.a 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.entdata.a --check-prefix=ENTDATA-ERR

# 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

--- !Arch
Members:
  - Size: [[SIZE='1']]

## Check we report an error when unable to read the size of an archive member.

# RUN: yaml2obj %s --docnum=5 -DSIZE='x' -o %t.entsize.a
# RUN: not obj2yaml %t.entsize.a 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.entsize.a --check-prefix=ENTSIZE-ERR

# ENTSIZE-ERR: Error reading file: [[FILE]]: unable to read the size of a child at offset 0x8 as integer: "x"

## Check we don't try to dump the padding byte when the size of the content is odd and
## the content ends at the end of a file.

# RUN: yaml2obj %s --docnum=6 -DCONTENT="61" -o %t.no.padding.byte.a
# RUN: obj2yaml %t.no.padding.byte.a | FileCheck %s --check-prefix=NO-PADDING-BYTE

#      NO-PADDING-BYTE: --- !Arch
# NO-PADDING-BYTE-NEXT: Members:
# NO-PADDING-BYTE-NEXT:   - Size:    '1'
# NO-PADDING-BYTE-NEXT:     Content: '61'
# NO-PADDING-BYTE-NEXT: ...

--- !Arch
Members:
  - Size:    '1'
    Content: [[CONTENT]]

## Check we dump the padding byte when the size of the content is odd and the content ends
## before the end of a file.

# RUN: yaml2obj %s --docnum=6 -DCONTENT="610A" -o %t.padding.byte.a
# RUN: obj2yaml %t.padding.byte.a | FileCheck %s --check-prefix=PADDING-BYTE

#      PADDING-BYTE: --- !Arch
# PADDING-BYTE-NEXT: Members:
# PADDING-BYTE-NEXT:   - Size:        '1'
# PADDING-BYTE-NEXT:     Content:     '61'
# PADDING-BYTE-NEXT:     PaddingByte: 0xA
# PADDING-BYTE-NEXT: ...