3 # incremental_test.sh -- test that incremental linking information is correct.
5 # Copyright (C) 2009-2019 Free Software Foundation, Inc.
6 # Written by Rafael Avila de Espindola <espindola@google.com>
7 # and Cary Coutant <ccoutant@google.com>
9 # This file is part of gold.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
30 echo "Actual output differs from expected:"
39 if ! grep -q "$2" "$1"
41 echo "Did not find expected output in $1:"
44 echo "Actual output below:"
50 # Extract actual command line from linker's -v output.
51 cat incremental_test.cmdline |
52 grep "gcctestdir/\(collect-\)\?ld " |
53 sed "s/--incremental[-a-z]* //g" |
54 cut
-d ' ' -f 2- > actual
56 # Extract recorded command line from dump of the output file.
57 cat incremental_test.stdout |
58 grep "Link command line" |
61 sed "s/'//g" > recorded
63 # Verify that the command line was recorded correctly.
64 check_cmp actual recorded
68 # Filter the incremental-dump output into a format that can be grepped
72 /^[A-Za-z][A-Za-z ]+:$/ { section = $0; }
73 /^[[]/ { subsection = $0; }
74 /^ / { print section, subsection, $0; }
75 ' < incremental_test.stdout
> incremental_test.dump
77 check incremental_test.dump
"Input sections: .* incremental_test_1.o *1 "
78 check incremental_test.dump
"Input sections: .* incremental_test_2.o *1 "
79 check incremental_test.dump
"Global symbol table: .* main .* relocation type "
80 check incremental_test.dump
"Global symbol table: .* a *incremental_test_1.o "
81 check incremental_test.dump
"Global symbol table: .* a .* relocation type "
82 check incremental_test.dump
"Global symbol table: .* b *incremental_test_2.o "
83 check incremental_test.dump
"Global symbol table: .* b .* relocation type "
84 check incremental_test.dump
"Global symbol table: .* t1 *incremental_test_2.o "
85 check incremental_test.dump
"Global symbol table: .* t1 .* relocation type "
87 rm -f incremental_test.dump