This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / nm.exp
1 # Copyright (C) 1993, 1994 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye <rob@cygnus.com>
21 # and rewritten by Ian Lance Taylor <ian@cygnus.com>
22
23 if {[which $NM] == 0} then {
24 perror "$NM does not exist"
25 return
26 }
27
28 send_user "Version [binutil_version $NM]"
29
30
31 if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
32 return
33 }
34
35 # Test nm with no arguments.
36
37 # This test does not work correctly on ECOFF targets, because ECOFF
38 # stores most symbols twice, which messes up the nm output.
39 setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
40 setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
41 setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
42
43 set got [binutils_run $NM "$NMFLAGS tmpdir/bintest.o"]
44
45 if [info exists vars] then { unset vars }
46 while {[regexp "(\[a-zA-Z\]) (\[a-z_\]*_symbol)(.*)" $got all type symbol rest]} {
47 set vars($symbol) $type
48 set got $rest
49 }
50
51 if {![info exists vars(text_symbol)] \
52 || $vars(text_symbol) != "T" \
53 || ![info exists vars(data_symbol)] \
54 || $vars(data_symbol) != "D" \
55 || ![info exists vars(common_symbol)] \
56 || $vars(common_symbol) != "C" \
57 || ![info exists vars(external_symbol)] \
58 || $vars(external_symbol) != "U" \
59 || ![info exists vars(static_text_symbol)] \
60 || $vars(static_text_symbol) != "t" \
61 || ![info exists vars(static_data_symbol)] \
62 || $vars(static_data_symbol) != "d"} {
63 fail "nm (no arguments)"
64 } else {
65 pass "nm (no arguments)"
66 }
67
68 # Test nm -g
69
70 set got [binutils_run $NM "$NMFLAGS -g tmpdir/bintest.o"]
71
72 if [info exists vars] then { unset vars }
73 while {[regexp "(\[a-z_\]*_symbol)(.*)" $got all symbol rest]} {
74 set vars($symbol) 1
75 set got $rest
76 }
77
78 if {![info exists vars(text_symbol)] \
79 || ![info exists vars(data_symbol)] \
80 || ![info exists vars(common_symbol)] \
81 || ![info exists vars(external_symbol)] \
82 || [info exists vars(static_text_symbol)] \
83 || [info exists vars(static_data_symbol)]} {
84 fail "nm -g"
85 } else {
86 pass "nm -g"
87 }
88
89 # Test nm -P
90
91 # This test does not work correctly on ECOFF targets, because ECOFF
92 # stores most symbols twice, which messes up the nm output.
93 setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
94 setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
95 setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
96
97 set got [binutils_run $NM "$NMFLAGS -P tmpdir/bintest.o"]
98
99 set want "common_symbol C \[0\]*4.*data_symbol D \[0-9a-fA-F\]*.*external_symbol U.*static_data_symbol d \[0-9a-fA-F\]*.*static_text_symbol t \[0-9a-fA-F\]*.*text_symbol T \[0-9a-fA-F\]*"
100
101 if [regexp $want $got] then {
102 pass "nm -P"
103 } else {
104 fail "nm -P"
105 }
106
107 # There are certainly other tests that could be run.
This page took 0.0493 seconds and 5 git commands to generate.