Imported Upstream version 0.165
[platform/upstream/elfutils.git] / tests / run-test-archive64.sh
1 #! /bin/sh
2 # Copyright (C) 2012, 2014 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 # The test archive was produced on an s390x machine using the
21 # following command sequence:
22 #  echo 'int aaa(void){}' | gcc -x c /dev/stdin -c -o aaa.o
23 #  echo 'int bbb(void){} int bbb2(void){}' | gcc -x c /dev/stdin -c -o bbb.o
24 #  echo 'int ccc(void){} int ccc2(void){} int ccc3(void){}' \
25 #    | gcc -x c /dev/stdin -c -o ccc.o
26 #  ar cru testarchive64.a aaa.o bbb.o ccc.o
27 testfiles testarchive64.a
28
29 testrun_compare ${abs_top_builddir}/src/readelf -c testarchive64.a <<\EOF
30
31 Index of archive 'testarchive64.a' has 7 entries:
32 Archive member 'aaa.o' contains:
33         aaa
34 Archive member 'bbb.o' contains:
35         bbb
36         bbb2
37 Archive member 'ccc.o' contains:
38         ccc
39         ccc2
40         ccc3
41 EOF
42
43 testrun_compare ${abs_top_builddir}/src/nm -P -g testarchive64.a <<\EOF
44 testarchive64.a[aaa.o]:
45 aaa T 0000000000000000 0000000000000016
46 testarchive64.a[bbb.o]:
47 bbb T 0000000000000000 0000000000000016
48 bbb2 T 0000000000000018 0000000000000016
49 testarchive64.a[ccc.o]:
50 ccc T 0000000000000000 0000000000000016
51 ccc2 T 0000000000000018 0000000000000016
52 ccc3 T 0000000000000030 0000000000000016
53 EOF
54
55 exit 0