xref: /aosp_15_r20/external/elfutils/tests/run-declfiles.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1#! /bin/sh
2# Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
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 tests/testfile-dwarf-45.source
21testfiles testfile-dwarf-4 testfile-dwarf-5
22testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
23testfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo
24
25testrun_compare ${abs_builddir}/declfiles testfile-dwarf-4 << EOF
26file: testfile-dwarf-4
27 cu: hello.c
28  wchar_t@/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h:328:24
29  m@/var/tmp/hello/hello.h:1:12
30  m@/var/tmp/hello/hello.c:5:5
31  foo@/var/tmp/hello/hello.c:20:1
32   f@/var/tmp/hello/hello.c:20:14
33  baz@/var/tmp/hello/hello.c:8:5
34   x@/var/tmp/hello/hello.c:8:14
35   r@/var/tmp/hello/hello.c:10:7
36  frob@/var/tmp/hello/hello.h:5:1
37   a@/var/tmp/hello/hello.h:5:11
38   b@/var/tmp/hello/hello.h:5:18
39   c@/var/tmp/hello/hello.h:7:7
40  foo@/var/tmp/hello/hello.c:20:1
41   f@/var/tmp/hello/hello.c:20:14
42   frob@/var/tmp/hello/hello.h:5:1
43    b@/var/tmp/hello/hello.h:5:18
44    a@/var/tmp/hello/hello.h:5:11
45    c@/var/tmp/hello/hello.h:7:7
46    baz@/var/tmp/hello/hello.c:8:5
47     x@/var/tmp/hello/hello.c:8:14
48     r@/var/tmp/hello/hello.c:10:7
49   foo@/var/tmp/hello/hello.c:20:1
50    f@/var/tmp/hello/hello.c:20:14
51    main@/var/tmp/hello/hello.c:4:12
52  baz@/var/tmp/hello/hello.c:8:5
53   x@/var/tmp/hello/hello.c:8:14
54   r@/var/tmp/hello/hello.c:10:7
55   foo@/var/tmp/hello/hello.c:20:1
56  main@/var/tmp/hello/hello.c:4:12
57 cu: world.c
58  m@/var/tmp/hello/hello.h:1:12
59  main@/var/tmp/hello/world.c:14:1
60   argc@/var/tmp/hello/world.c:14:11
61   argv@/var/tmp/hello/world.c:14:30
62   n@/var/tmp/hello/world.c:16:15
63   calc@/var/tmp/hello/world.c:5:1
64   exit@/usr/include/stdlib.h:542:13
65  calc@/var/tmp/hello/world.c:5:1
66   word@/var/tmp/hello/world.c:5:19
67   frob@/var/tmp/hello/hello.h:5:1
68    b@/var/tmp/hello/hello.h:5:18
69    a@/var/tmp/hello/hello.h:5:11
70    c@/var/tmp/hello/hello.h:7:7
71    baz@/var/tmp/hello/hello.h:2:12
72  frob@/var/tmp/hello/hello.h:5:1
73   a@/var/tmp/hello/hello.h:5:11
74   b@/var/tmp/hello/hello.h:5:18
75   c@/var/tmp/hello/hello.h:7:7
76  exit@/usr/include/stdlib.h:542:13
77  baz@/var/tmp/hello/hello.h:2:12
78EOF
79
80testrun_compare ${abs_builddir}/declfiles testfile-dwarf-5 << EOF
81file: testfile-dwarf-5
82 cu: hello.c
83  wchar_t@/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h:328:24
84  m@/var/tmp/hello/hello.h:1:12
85  m@/var/tmp/hello/hello.c:5:5
86  foo@/var/tmp/hello/hello.c:20:1
87   f@/var/tmp/hello/hello.c:20:14
88  baz@/var/tmp/hello/hello.c:8:5
89   x@/var/tmp/hello/hello.c:8:14
90   r@/var/tmp/hello/hello.c:10:7
91  frob@/var/tmp/hello/hello.h:5:1
92   a@/var/tmp/hello/hello.h:5:11
93   b@/var/tmp/hello/hello.h:5:18
94   c@/var/tmp/hello/hello.h:7:7
95  foo@/var/tmp/hello/hello.c:20:1
96   f@/var/tmp/hello/hello.c:20:14
97   frob@/var/tmp/hello/hello.h:5:1
98    b@/var/tmp/hello/hello.h:5:18
99    a@/var/tmp/hello/hello.h:5:11
100    c@/var/tmp/hello/hello.h:7:7
101    baz@/var/tmp/hello/hello.c:8:5
102     x@/var/tmp/hello/hello.c:8:14
103     r@/var/tmp/hello/hello.c:10:7
104   foo@/var/tmp/hello/hello.c:20:1
105    f@/var/tmp/hello/hello.c:20:14
106  baz@/var/tmp/hello/hello.c:8:5
107   x@/var/tmp/hello/hello.c:8:14
108   r@/var/tmp/hello/hello.c:10:7
109  main@/var/tmp/hello/hello.c:4:12
110 cu: world.c
111  m@/var/tmp/hello/hello.h:1:12
112  main@/var/tmp/hello/world.c:14:1
113   argc@/var/tmp/hello/world.c:14:11
114   argv@/var/tmp/hello/world.c:14:30
115   n@/var/tmp/hello/world.c:16:15
116  calc@/var/tmp/hello/world.c:5:1
117   word@/var/tmp/hello/world.c:5:19
118   frob@/var/tmp/hello/hello.h:5:1
119    b@/var/tmp/hello/hello.h:5:18
120    a@/var/tmp/hello/hello.h:5:11
121    c@/var/tmp/hello/hello.h:7:7
122  frob@/var/tmp/hello/hello.h:5:1
123   a@/var/tmp/hello/hello.h:5:11
124   b@/var/tmp/hello/hello.h:5:18
125   c@/var/tmp/hello/hello.h:7:7
126  exit@/usr/include/stdlib.h:542:13
127  baz@/var/tmp/hello/hello.h:2:12
128EOF
129
130testrun_compare ${abs_builddir}/declfiles testfile-splitdwarf-4 << EOF
131file: testfile-splitdwarf-4
132 cu: hello.c
133  wchar_t@/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h:328:24
134  m@/home/mark/src/elfutils/tests/hello.h:1:12
135  m@/home/mark/src/elfutils/tests/hello.c:5:5
136  foo@/home/mark/src/elfutils/tests/hello.c:20:1
137   f@/home/mark/src/elfutils/tests/hello.c:20:14
138  baz@/home/mark/src/elfutils/tests/hello.c:8:5
139   x@/home/mark/src/elfutils/tests/hello.c:8:14
140   r@/home/mark/src/elfutils/tests/hello.c:10:7
141  frob@/home/mark/src/elfutils/tests/hello.h:5:1
142   a@/home/mark/src/elfutils/tests/hello.h:5:11
143   b@/home/mark/src/elfutils/tests/hello.h:5:18
144   c@/home/mark/src/elfutils/tests/hello.h:7:7
145  foo@/home/mark/src/elfutils/tests/hello.c:20:1
146   f@/home/mark/src/elfutils/tests/hello.c:20:14
147   frob@/home/mark/src/elfutils/tests/hello.h:5:1
148    b@/home/mark/src/elfutils/tests/hello.h:5:18
149    a@/home/mark/src/elfutils/tests/hello.h:5:11
150    c@/home/mark/src/elfutils/tests/hello.h:7:7
151    baz@/home/mark/src/elfutils/tests/hello.c:8:5
152     x@/home/mark/src/elfutils/tests/hello.c:8:14
153     r@/home/mark/src/elfutils/tests/hello.c:10:7
154   foo@/home/mark/src/elfutils/tests/hello.c:20:1
155    f@/home/mark/src/elfutils/tests/hello.c:20:14
156    main@/home/mark/src/elfutils/tests/hello.c:4:12
157  baz@/home/mark/src/elfutils/tests/hello.c:8:5
158   x@/home/mark/src/elfutils/tests/hello.c:8:14
159   r@/home/mark/src/elfutils/tests/hello.c:10:7
160   foo@/home/mark/src/elfutils/tests/hello.c:20:1
161  main@/home/mark/src/elfutils/tests/hello.c:4:12
162 cu: world.c
163  m@/home/mark/src/elfutils/tests/hello.h:1:12
164  main@/home/mark/src/elfutils/tests/world.c:14:1
165   argc@/home/mark/src/elfutils/tests/world.c:14:11
166   argv@/home/mark/src/elfutils/tests/world.c:14:30
167   n@/home/mark/src/elfutils/tests/world.c:16:15
168   calc@/home/mark/src/elfutils/tests/world.c:5:1
169   exit@/usr/include/stdlib.h:542:13
170  calc@/home/mark/src/elfutils/tests/world.c:5:1
171   word@/home/mark/src/elfutils/tests/world.c:5:19
172   frob@/home/mark/src/elfutils/tests/hello.h:5:1
173    b@/home/mark/src/elfutils/tests/hello.h:5:18
174    a@/home/mark/src/elfutils/tests/hello.h:5:11
175    c@/home/mark/src/elfutils/tests/hello.h:7:7
176    baz@/home/mark/src/elfutils/tests/hello.h:2:12
177  frob@/home/mark/src/elfutils/tests/hello.h:5:1
178   a@/home/mark/src/elfutils/tests/hello.h:5:11
179   b@/home/mark/src/elfutils/tests/hello.h:5:18
180   c@/home/mark/src/elfutils/tests/hello.h:7:7
181  exit@/usr/include/stdlib.h:542:13
182  baz@/home/mark/src/elfutils/tests/hello.h:2:12
183EOF
184
185testrun_compare ${abs_builddir}/declfiles testfile-splitdwarf-5 << EOF
186file: testfile-splitdwarf-5
187 cu: hello.c
188  wchar_t@/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h:328:24
189  m@/home/mark/src/elfutils/tests/hello.h:1:12
190  m@/home/mark/src/elfutils/tests/hello.c:5:5
191  foo@/home/mark/src/elfutils/tests/hello.c:20:1
192   f@/home/mark/src/elfutils/tests/hello.c:20:14
193  baz@/home/mark/src/elfutils/tests/hello.c:8:5
194   x@/home/mark/src/elfutils/tests/hello.c:8:14
195   r@/home/mark/src/elfutils/tests/hello.c:10:7
196  frob@/home/mark/src/elfutils/tests/hello.h:5:1
197   a@/home/mark/src/elfutils/tests/hello.h:5:11
198   b@/home/mark/src/elfutils/tests/hello.h:5:18
199   c@/home/mark/src/elfutils/tests/hello.h:7:7
200  foo@/home/mark/src/elfutils/tests/hello.c:20:1
201   f@/home/mark/src/elfutils/tests/hello.c:20:14
202   frob@/home/mark/src/elfutils/tests/hello.h:5:1
203    b@/home/mark/src/elfutils/tests/hello.h:5:18
204    a@/home/mark/src/elfutils/tests/hello.h:5:11
205    c@/home/mark/src/elfutils/tests/hello.h:7:7
206    baz@/home/mark/src/elfutils/tests/hello.c:8:5
207     x@/home/mark/src/elfutils/tests/hello.c:8:14
208     r@/home/mark/src/elfutils/tests/hello.c:10:7
209   foo@/home/mark/src/elfutils/tests/hello.c:20:1
210    f@/home/mark/src/elfutils/tests/hello.c:20:14
211  baz@/home/mark/src/elfutils/tests/hello.c:8:5
212   x@/home/mark/src/elfutils/tests/hello.c:8:14
213   r@/home/mark/src/elfutils/tests/hello.c:10:7
214  main@/home/mark/src/elfutils/tests/hello.c:4:12
215 cu: world.c
216  m@/home/mark/src/elfutils/tests/hello.h:1:12
217  main@/home/mark/src/elfutils/tests/world.c:14:1
218   argc@/home/mark/src/elfutils/tests/world.c:14:11
219   argv@/home/mark/src/elfutils/tests/world.c:14:30
220   n@/home/mark/src/elfutils/tests/world.c:16:15
221  calc@/home/mark/src/elfutils/tests/world.c:5:1
222   word@/home/mark/src/elfutils/tests/world.c:5:19
223   frob@/home/mark/src/elfutils/tests/hello.h:5:1
224    b@/home/mark/src/elfutils/tests/hello.h:5:18
225    a@/home/mark/src/elfutils/tests/hello.h:5:11
226    c@/home/mark/src/elfutils/tests/hello.h:7:7
227  frob@/home/mark/src/elfutils/tests/hello.h:5:1
228   a@/home/mark/src/elfutils/tests/hello.h:5:11
229   b@/home/mark/src/elfutils/tests/hello.h:5:18
230   c@/home/mark/src/elfutils/tests/hello.h:7:7
231  exit@/usr/include/stdlib.h:542:13
232  baz@/home/mark/src/elfutils/tests/hello.h:2:12
233EOF
234
235# See testfile-dwp.source.
236testfiles testfile-dwp-5 testfile-dwp-5.dwp
237testfiles testfile-dwp-4 testfile-dwp-4.dwp
238
239testrun_compare ${abs_builddir}/declfiles testfile-dwp-5 << EOF
240file: testfile-dwp-5
241 cu: foo.cc
242  foo@/home/osandov/src/elfutils/tests/foobar.h:4:7
243  foo@/home/osandov/src/elfutils/tests/foo.cc:14:1
244   x@/home/osandov/src/elfutils/tests/foo.cc:16:7
245   x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
246    x@/home/osandov/src/elfutils/tests/foo.cc:6:10
247    i@/home/osandov/src/elfutils/tests/foo.cc:8:12
248  x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
249   x@/home/osandov/src/elfutils/tests/foo.cc:6:10
250   i@/home/osandov/src/elfutils/tests/foo.cc:8:12
251  x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
252   x@/home/osandov/src/elfutils/tests/foo.cc:6:10
253   i@/home/osandov/src/elfutils/tests/foo.cc:8:12
254 cu: bar.cc
255  bar@/home/osandov/src/elfutils/tests/foobar.h:10:8
256  bar@/home/osandov/src/elfutils/tests/bar.cc:6:1
257 cu: main.cc
258  foo@/home/osandov/src/elfutils/tests/foobar.h:4:7
259  bar@/home/osandov/src/elfutils/tests/foobar.h:10:8
260  main@/home/osandov/src/elfutils/tests/main.cc:6:1
261   argc@/home/osandov/src/elfutils/tests/main.cc:6:6
262   argv@/home/osandov/src/elfutils/tests/main.cc:6:6
263   myfoo@/home/osandov/src/elfutils/tests/main.cc:8:14
264   mybar@/home/osandov/src/elfutils/tests/main.cc:9:14
265   fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
266    n@/home/osandov/src/elfutils/tests/foobar.h:17:25
267    fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
268     n@/home/osandov/src/elfutils/tests/foobar.h:17:25
269     a@/home/osandov/src/elfutils/tests/foobar.h:23:12
270     b@/home/osandov/src/elfutils/tests/foobar.h:24:12
271     i@/home/osandov/src/elfutils/tests/foobar.h:25:25
272     tmp@/home/osandov/src/elfutils/tests/foobar.h:27:9
273  fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
274   n@/home/osandov/src/elfutils/tests/foobar.h:17:25
275   a@/home/osandov/src/elfutils/tests/foobar.h:23:12
276   b@/home/osandov/src/elfutils/tests/foobar.h:24:12
277   i@/home/osandov/src/elfutils/tests/foobar.h:25:25
278   tmp@/home/osandov/src/elfutils/tests/foobar.h:27:9
279EOF
280
281testrun_compare ${abs_builddir}/declfiles testfile-dwp-4 << EOF
282file: testfile-dwp-4
283 cu: foo.cc
284  foo@/home/osandov/src/elfutils/tests/foobar.h:4:7
285  foo@/home/osandov/src/elfutils/tests/foo.cc:14:1
286   x@/home/osandov/src/elfutils/tests/foo.cc:16:7
287   x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
288    x@/home/osandov/src/elfutils/tests/foo.cc:6:10
289    i@/home/osandov/src/elfutils/tests/foo.cc:8:12
290  x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
291   x@/home/osandov/src/elfutils/tests/foo.cc:6:10
292   i@/home/osandov/src/elfutils/tests/foo.cc:8:12
293  x_x@/home/osandov/src/elfutils/tests/foo.cc:6:1
294   x@/home/osandov/src/elfutils/tests/foo.cc:6:10
295   i@/home/osandov/src/elfutils/tests/foo.cc:8:12
296 cu: bar.cc
297  bar@/home/osandov/src/elfutils/tests/foobar.h:10:8
298  bar@/home/osandov/src/elfutils/tests/bar.cc:6:1
299 cu: main.cc
300  foo@/home/osandov/src/elfutils/tests/foobar.h:4:7
301  bar@/home/osandov/src/elfutils/tests/foobar.h:10:8
302  main@/home/osandov/src/elfutils/tests/main.cc:6:1
303   argc@/home/osandov/src/elfutils/tests/main.cc:6:6
304   argv@/home/osandov/src/elfutils/tests/main.cc:6:6
305   myfoo@/home/osandov/src/elfutils/tests/main.cc:8:14
306   mybar@/home/osandov/src/elfutils/tests/main.cc:9:14
307   fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
308    n@/home/osandov/src/elfutils/tests/foobar.h:17:25
309    fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
310     n@/home/osandov/src/elfutils/tests/foobar.h:17:25
311     a@/home/osandov/src/elfutils/tests/foobar.h:23:12
312     b@/home/osandov/src/elfutils/tests/foobar.h:24:12
313     i@/home/osandov/src/elfutils/tests/foobar.h:25:25
314     tmp@/home/osandov/src/elfutils/tests/foobar.h:27:9
315   foo@/home/osandov/src/elfutils/tests/foobar.h:4:7
316   bar@/home/osandov/src/elfutils/tests/foobar.h:10:8
317  fibonacci@/home/osandov/src/elfutils/tests/foobar.h:17:1
318   n@/home/osandov/src/elfutils/tests/foobar.h:17:25
319   a@/home/osandov/src/elfutils/tests/foobar.h:23:12
320   b@/home/osandov/src/elfutils/tests/foobar.h:24:12
321   i@/home/osandov/src/elfutils/tests/foobar.h:25:25
322   tmp@/home/osandov/src/elfutils/tests/foobar.h:27:9
323EOF
324