1#! /bin/sh
2# Copyright (C) 2018 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# See run-typeiter.sh
21testfiles testfile-debug-types
22
23testrun ${abs_builddir}/unit-info testfile-debug-types
24
25# see run-readelf-dwz-multi.sh
26testfiles testfile_multi_main testfile_multi.dwz
27
28testrun ${abs_builddir}/unit-info testfile_multi_main
29
30# see tests/run-dwflsyms.sh
31testfiles testfilebazdbgppc64.debug
32
33testrun ${abs_builddir}/unit-info testfilebazdbgppc64.debug
34
35# see tests/testfile-dwarf-45.source
36testfiles testfile-dwarf-4 testfile-dwarf-5
37testfiles testfile-splitdwarf-4 testfile-splitdwarf-5
38testfiles testfile-hello4.dwo testfile-hello5.dwo
39testfiles testfile-world4.dwo testfile-world5.dwo
40
41testrun ${abs_builddir}/unit-info testfile-dwarf-4
42testrun ${abs_builddir}/unit-info testfile-dwarf-5
43
44# The consistency checks should find most issue, but make sure the
45# output is also what we expect in case we break dwarf_get_units and
46# dwarf_cu_info at the same time.
47testrun_compare ${abs_builddir}/unit-info \
48		testfile-splitdwarf-4 testfile-splitdwarf-5 <<\EOF
49file: testfile-splitdwarf-4
50Iterate getting all info, compare with dwarf_cu_info.
510 cu dietag: 11, subtag: 11, version 4, unit_type 4
520 subdietag: 11, subtag: 0, version 4, unit_type 5
531 cu dietag: 11, subtag: 11, version 4, unit_type 4
541 subdietag: 11, subtag: 0, version 4, unit_type 5
55rechecking: testfile-splitdwarf-4
56Iterate no info, compare recorded info with dwarf_cu_info.
570 re dietag: 11, subtag: 11, version 4, unit_type 4
580 subdietag: 11, subtag: 0, version 4, unit_type 5
591 re dietag: 11, subtag: 11, version 4, unit_type 4
601 subdietag: 11, subtag: 0, version 4, unit_type 5
61
62file: testfile-splitdwarf-5
63Iterate getting all info, compare with dwarf_cu_info.
640 cu dietag: 4a, subtag: 11, version 5, unit_type 4
650 subdietag: 11, subtag: 0, version 5, unit_type 5
661 cu dietag: 4a, subtag: 11, version 5, unit_type 4
671 subdietag: 11, subtag: 0, version 5, unit_type 5
68rechecking: testfile-splitdwarf-5
69Iterate no info, compare recorded info with dwarf_cu_info.
700 re dietag: 4a, subtag: 11, version 5, unit_type 4
710 subdietag: 11, subtag: 0, version 5, unit_type 5
721 re dietag: 4a, subtag: 11, version 5, unit_type 4
731 subdietag: 11, subtag: 0, version 5, unit_type 5
74
75EOF
76
77# Self test (not on obj files, since those need relocation first).
78testrun_on_self_exe ${abs_builddir}/unit-info
79testrun_on_self_lib ${abs_builddir}/unit-info
80
81exit 0
82