OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [testsuite/] [incremental_test.sh] - Blame information for rev 138

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
#!/bin/sh
2
 
3
# incremental_test.sh -- test that incremental linking information is correct.
4
 
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>
8
 
9
# This file is part of gold.
10
 
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.
15
 
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.
20
 
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,
24
# MA 02110-1301, USA.
25
 
26
check_cmp()
27
{
28
    if ! cmp -s "$1" "$2"
29
    then
30
        echo "Actual output differs from expected:"
31
        echo "diff $1 $2"
32
        diff $1 $2
33
        exit 1
34
    fi
35
}
36
 
37
check()
38
{
39
    if ! grep -q "$2" "$1"
40
    then
41
        echo "Did not find expected output in $1:"
42
        echo "   $2"
43
        echo ""
44
        echo "Actual output below:"
45
        cat "$1"
46
        exit 1
47
    fi
48
}
49
 
50
# Extract actual command line from linker's -v output.
51
cat incremental_test.cmdline |
52
  grep "gcctestdir/ld " |
53
  sed "s/--incremental[-a-z]* //g" |
54
  cut -d ' ' -f 2- > actual
55
 
56
# Extract recorded command line from dump of the output file.
57
cat incremental_test.stdout |
58
  grep "Link command line" |
59
  cut -d : -f 2- |
60
  cut -d ' ' -f 3- |
61
  sed "s/'//g" > recorded
62
 
63
# Verify that the command line was recorded correctly.
64
check_cmp actual recorded
65
 
66
rm -f actual recorded
67
 
68
# Filter the incremental-dump output into a format that can be grepped
69
# more easily.
70
 
71
awk '
72
    /^[A-Za-z][A-Za-z ]+:$/ { section = $0; }
73
    /^[[]/ { subsection = $0; }
74
    /^ / { print section, subsection, $0; }
75
' < incremental_test.stdout > incremental_test.dump
76
 
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 "
86
 
87
rm -f incremental_test.dump
88
 
89
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.