1#!/usr/local/bin/bash
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
27testfiles testarchive64.a
28
29testrun_compare ${abs_top_builddir}/src/readelf -c testarchive64.a <<\EOF
30
31Index of archive 'testarchive64.a' has 7 entries:
32Archive member 'aaa.o' contains:
33	aaa
34Archive member 'bbb.o' contains:
35	bbb
36	bbb2
37Archive member 'ccc.o' contains:
38	ccc
39	ccc2
40	ccc3
41EOF
42
43testrun_compare ${abs_top_builddir}/src/nm -P -g testarchive64.a <<\EOF
44testarchive64.a[aaa.o]:
45aaa T 0000000000000000 0000000000000016
46testarchive64.a[bbb.o]:
47bbb T 0000000000000000 0000000000000016
48bbb2 T 0000000000000018 0000000000000016
49testarchive64.a[ccc.o]:
50ccc T 0000000000000000 0000000000000016
51ccc2 T 0000000000000018 0000000000000016
52ccc3 T 0000000000000030 0000000000000016
53EOF
54
55exit 0
56