1#! /bin/sh
2# Copyright (C) 2015 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# Random ELF32 testfile
21testfiles testfile4
22
23testrun_compare ${abs_top_builddir}/tests/elfputzdata gnu testfile4 <<\EOF
24Cannot compress 1 .interp
25Cannot compress 2 .note.ABI-tag
26Cannot compress 3 .hash
27Cannot compress 4 .dynsym
28Cannot compress 5 .dynstr
29Cannot compress 6 .gnu.version
30Cannot compress 7 .gnu.version_r
31Cannot compress 8 .rel.got
32Cannot compress 9 .rel.plt
33Cannot compress 10 .init
34Cannot compress 11 .plt
35Cannot compress 12 .text
36Cannot compress 13 .fini
37Cannot compress 14 .rodata
38Cannot compress 15 .data
39Cannot compress 16 .eh_frame
40Cannot compress 17 .gcc_except_table
41Cannot compress 18 .ctors
42Cannot compress 19 .dtors
43Cannot compress 20 .got
44Cannot compress 21 .dynamic
45Lets compress 22 .sbss, size: 0
46Cannot compress 23 .bss
47Lets compress 24 .stab, size: 21540
48Lets compress 25 .stabstr, size: 57297
49Lets compress 26 .comment, size: 648
50Lets compress 27 .debug_aranges, size: 56
51Lets compress 28 .debug_pubnames, size: 93
52Lets compress 29 .debug_info, size: 960
53Lets compress 30 .debug_abbrev, size: 405
54Lets compress 31 .debug_line, size: 189
55Lets compress 32 .note, size: 240
56Lets compress 33 .shstrtab, size: 320
57Lets compress 34 .symtab, size: 5488
58Lets compress 35 .strtab, size: 5727
59EOF
60
61testrun_compare ${abs_top_builddir}/tests/elfputzdata elf testfile4 <<\EOF
62Cannot compress 1 .interp
63Cannot compress 2 .note.ABI-tag
64Cannot compress 3 .hash
65Cannot compress 4 .dynsym
66Cannot compress 5 .dynstr
67Cannot compress 6 .gnu.version
68Cannot compress 7 .gnu.version_r
69Cannot compress 8 .rel.got
70Cannot compress 9 .rel.plt
71Cannot compress 10 .init
72Cannot compress 11 .plt
73Cannot compress 12 .text
74Cannot compress 13 .fini
75Cannot compress 14 .rodata
76Cannot compress 15 .data
77Cannot compress 16 .eh_frame
78Cannot compress 17 .gcc_except_table
79Cannot compress 18 .ctors
80Cannot compress 19 .dtors
81Cannot compress 20 .got
82Cannot compress 21 .dynamic
83Lets compress 22 .sbss, size: 0
84Cannot compress 23 .bss
85Lets compress 24 .stab, size: 21540
86Lets compress 25 .stabstr, size: 57297
87Lets compress 26 .comment, size: 648
88Lets compress 27 .debug_aranges, size: 56
89Lets compress 28 .debug_pubnames, size: 93
90Lets compress 29 .debug_info, size: 960
91Lets compress 30 .debug_abbrev, size: 405
92Lets compress 31 .debug_line, size: 189
93Lets compress 32 .note, size: 240
94Lets compress 33 .shstrtab, size: 320
95Lets compress 34 .symtab, size: 5488
96Lets compress 35 .strtab, size: 5727
97EOF
98
99# Random ELF64 testfile
100testfiles testfile12
101
102testrun_compare ${abs_top_builddir}/tests/elfputzdata gnu testfile12 <<\EOF
103Cannot compress 1 .hash
104Cannot compress 2 .dynsym
105Cannot compress 3 .dynstr
106Cannot compress 4 .gnu.version
107Cannot compress 5 .gnu.version_r
108Cannot compress 6 .rela.dyn
109Cannot compress 7 .rela.plt
110Cannot compress 8 .init
111Cannot compress 9 .plt
112Cannot compress 10 .text
113Cannot compress 11 .fini
114Cannot compress 12 .rodata
115Cannot compress 13 .eh_frame_hdr
116Cannot compress 14 .eh_frame
117Cannot compress 15 .data
118Cannot compress 16 .dynamic
119Cannot compress 17 .ctors
120Cannot compress 18 .dtors
121Cannot compress 19 .jcr
122Cannot compress 20 .got
123Cannot compress 21 .bss
124Lets compress 22 .comment, size: 246
125Lets compress 23 .debug_aranges, size: 192
126Lets compress 24 .debug_pubnames, size: 26
127Lets compress 25 .debug_info, size: 3468
128Lets compress 26 .debug_abbrev, size: 341
129Lets compress 27 .debug_line, size: 709
130Lets compress 28 .debug_frame, size: 56
131Lets compress 29 .debug_str, size: 2235
132Lets compress 30 .debug_macinfo, size: 10518
133Lets compress 31 .shstrtab, size: 308
134Lets compress 32 .symtab, size: 1944
135Lets compress 33 .strtab, size: 757
136EOF
137
138testrun_compare ${abs_top_builddir}/tests/elfputzdata elf testfile12 <<\EOF
139Cannot compress 1 .hash
140Cannot compress 2 .dynsym
141Cannot compress 3 .dynstr
142Cannot compress 4 .gnu.version
143Cannot compress 5 .gnu.version_r
144Cannot compress 6 .rela.dyn
145Cannot compress 7 .rela.plt
146Cannot compress 8 .init
147Cannot compress 9 .plt
148Cannot compress 10 .text
149Cannot compress 11 .fini
150Cannot compress 12 .rodata
151Cannot compress 13 .eh_frame_hdr
152Cannot compress 14 .eh_frame
153Cannot compress 15 .data
154Cannot compress 16 .dynamic
155Cannot compress 17 .ctors
156Cannot compress 18 .dtors
157Cannot compress 19 .jcr
158Cannot compress 20 .got
159Cannot compress 21 .bss
160Lets compress 22 .comment, size: 246
161Lets compress 23 .debug_aranges, size: 192
162Lets compress 24 .debug_pubnames, size: 26
163Lets compress 25 .debug_info, size: 3468
164Lets compress 26 .debug_abbrev, size: 341
165Lets compress 27 .debug_line, size: 709
166Lets compress 28 .debug_frame, size: 56
167Lets compress 29 .debug_str, size: 2235
168Lets compress 30 .debug_macinfo, size: 10518
169Lets compress 31 .shstrtab, size: 308
170Lets compress 32 .symtab, size: 1944
171Lets compress 33 .strtab, size: 757
172EOF
173
174# Random ELF64BE testfile
175testfiles testfileppc64
176
177testrun_compare ${abs_top_builddir}/tests/elfputzdata gnu testfileppc64 <<\EOF
178Cannot compress 1 .interp
179Cannot compress 2 .note.ABI-tag
180Cannot compress 3 .note.gnu.build-id
181Cannot compress 4 .gnu.hash
182Cannot compress 5 .dynsym
183Cannot compress 6 .dynstr
184Cannot compress 7 .gnu.version
185Cannot compress 8 .gnu.version_r
186Cannot compress 9 .rela.plt
187Cannot compress 10 .init
188Cannot compress 11 .text
189Cannot compress 12 .fini
190Cannot compress 13 .rodata
191Cannot compress 14 .eh_frame_hdr
192Cannot compress 15 .eh_frame
193Cannot compress 16 .init_array
194Cannot compress 17 .fini_array
195Cannot compress 18 .jcr
196Cannot compress 19 .dynamic
197Cannot compress 20 .data
198Cannot compress 21 .opd
199Cannot compress 22 .got
200Cannot compress 23 .plt
201Cannot compress 24 .bss
202Lets compress 25 .comment, size: 88
203Lets compress 26 .debug_aranges, size: 96
204Lets compress 27 .debug_info, size: 363
205Lets compress 28 .debug_abbrev, size: 315
206Lets compress 29 .debug_line, size: 119
207Lets compress 30 .debug_frame, size: 96
208Lets compress 31 .debug_str, size: 174
209Lets compress 32 .debug_loc, size: 171
210Lets compress 33 .debug_ranges, size: 32
211Lets compress 34 .shstrtab, size: 352
212Lets compress 35 .symtab, size: 1800
213Lets compress 36 .strtab, size: 602
214EOF
215
216testrun_compare ${abs_top_builddir}/tests/elfputzdata elf testfileppc64 <<\EOF
217Cannot compress 1 .interp
218Cannot compress 2 .note.ABI-tag
219Cannot compress 3 .note.gnu.build-id
220Cannot compress 4 .gnu.hash
221Cannot compress 5 .dynsym
222Cannot compress 6 .dynstr
223Cannot compress 7 .gnu.version
224Cannot compress 8 .gnu.version_r
225Cannot compress 9 .rela.plt
226Cannot compress 10 .init
227Cannot compress 11 .text
228Cannot compress 12 .fini
229Cannot compress 13 .rodata
230Cannot compress 14 .eh_frame_hdr
231Cannot compress 15 .eh_frame
232Cannot compress 16 .init_array
233Cannot compress 17 .fini_array
234Cannot compress 18 .jcr
235Cannot compress 19 .dynamic
236Cannot compress 20 .data
237Cannot compress 21 .opd
238Cannot compress 22 .got
239Cannot compress 23 .plt
240Cannot compress 24 .bss
241Lets compress 25 .comment, size: 88
242Lets compress 26 .debug_aranges, size: 96
243Lets compress 27 .debug_info, size: 363
244Lets compress 28 .debug_abbrev, size: 315
245Lets compress 29 .debug_line, size: 119
246Lets compress 30 .debug_frame, size: 96
247Lets compress 31 .debug_str, size: 174
248Lets compress 32 .debug_loc, size: 171
249Lets compress 33 .debug_ranges, size: 32
250Lets compress 34 .shstrtab, size: 352
251Lets compress 35 .symtab, size: 1800
252Lets compress 36 .strtab, size: 602
253EOF
254
255# Random ELF32BE testfile
256testfiles testfileppc32
257
258testrun_compare ${abs_top_builddir}/tests/elfputzdata gnu testfileppc32 <<\EOF
259Cannot compress 1 .interp
260Cannot compress 2 .note.ABI-tag
261Cannot compress 3 .note.gnu.build-id
262Cannot compress 4 .gnu.hash
263Cannot compress 5 .dynsym
264Cannot compress 6 .dynstr
265Cannot compress 7 .gnu.version
266Cannot compress 8 .gnu.version_r
267Cannot compress 9 .rela.dyn
268Cannot compress 10 .rela.plt
269Cannot compress 11 .init
270Cannot compress 12 .text
271Cannot compress 13 .fini
272Cannot compress 14 .rodata
273Cannot compress 15 .eh_frame_hdr
274Cannot compress 16 .eh_frame
275Cannot compress 17 .init_array
276Cannot compress 18 .fini_array
277Cannot compress 19 .jcr
278Cannot compress 20 .got2
279Cannot compress 21 .dynamic
280Cannot compress 22 .got
281Cannot compress 23 .plt
282Cannot compress 24 .data
283Cannot compress 25 .sdata
284Cannot compress 26 .bss
285Lets compress 27 .comment, size: 88
286Lets compress 28 .debug_aranges, size: 64
287Lets compress 29 .debug_info, size: 319
288Lets compress 30 .debug_abbrev, size: 318
289Lets compress 31 .debug_line, size: 109
290Lets compress 32 .debug_frame, size: 64
291Lets compress 33 .debug_str, size: 179
292Lets compress 34 .debug_loc, size: 99
293Lets compress 35 .debug_ranges, size: 16
294Lets compress 36 .shstrtab, size: 370
295Lets compress 37 .symtab, size: 1232
296Lets compress 38 .strtab, size: 569
297EOF
298
299testrun_compare ${abs_top_builddir}/tests/elfputzdata elf testfileppc32 <<\EOF
300Cannot compress 1 .interp
301Cannot compress 2 .note.ABI-tag
302Cannot compress 3 .note.gnu.build-id
303Cannot compress 4 .gnu.hash
304Cannot compress 5 .dynsym
305Cannot compress 6 .dynstr
306Cannot compress 7 .gnu.version
307Cannot compress 8 .gnu.version_r
308Cannot compress 9 .rela.dyn
309Cannot compress 10 .rela.plt
310Cannot compress 11 .init
311Cannot compress 12 .text
312Cannot compress 13 .fini
313Cannot compress 14 .rodata
314Cannot compress 15 .eh_frame_hdr
315Cannot compress 16 .eh_frame
316Cannot compress 17 .init_array
317Cannot compress 18 .fini_array
318Cannot compress 19 .jcr
319Cannot compress 20 .got2
320Cannot compress 21 .dynamic
321Cannot compress 22 .got
322Cannot compress 23 .plt
323Cannot compress 24 .data
324Cannot compress 25 .sdata
325Cannot compress 26 .bss
326Lets compress 27 .comment, size: 88
327Lets compress 28 .debug_aranges, size: 64
328Lets compress 29 .debug_info, size: 319
329Lets compress 30 .debug_abbrev, size: 318
330Lets compress 31 .debug_line, size: 109
331Lets compress 32 .debug_frame, size: 64
332Lets compress 33 .debug_str, size: 179
333Lets compress 34 .debug_loc, size: 99
334Lets compress 35 .debug_ranges, size: 16
335Lets compress 36 .shstrtab, size: 370
336Lets compress 37 .symtab, size: 1232
337Lets compress 38 .strtab, size: 569
338EOF
339
340exit 0
341