3 # incremental_test.sh -- test that incremental linking information is correct.
5 # Copyright 2009, 2010 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/ld " |
53 cut
-d ' ' -f 2- > actual
55 # Extract recorded command line from dump of the output file.
56 cat incremental_test.stdout |
57 grep "Link command line" |
60 sed "s/'//g" > recorded
62 # Verify that the command line was recorded correctly.
63 check_cmp actual recorded
67 # Filter the incremental-dump output into a format that can be grepped
71 /^[A-Za-z][A-Za-z ]+:$/ { section = $0; }
72 /^[[]/ { subsection = $0; }
73 /^ / { print section, subsection, $0; }
74 ' < incremental_test.stdout
> incremental_test.dump
76 check incremental_test.dump
"Input sections: .* incremental_test_1.o *1 "
77 check incremental_test.dump
"Input sections: .* incremental_test_2.o *1 "
78 check incremental_test.dump
"Global symbol table: .* main .* relocation type "
79 check incremental_test.dump
"Global symbol table: .* a *incremental_test_1.o "
80 check incremental_test.dump
"Global symbol table: .* a .* relocation type "
81 check incremental_test.dump
"Global symbol table: .* b *incremental_test_2.o "
82 check incremental_test.dump
"Global symbol table: .* b .* relocation type "
83 check incremental_test.dump
"Global symbol table: .* t1 *incremental_test_2.o "
84 check incremental_test.dump
"Global symbol table: .* t1 .* relocation type "
86 rm -f incremental_test.dump