1 # Copyright (C) 1995, 1997 Free Software Foundation, Inc.
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.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
20 # Written by Ian Lance Taylor <ian@cygnus.com>
22 if {[which $AR] == 0} then {
23 perror "$AR does not exist"
27 # send_user "Version [binutil_version $AR]"
29 # Test long file name support
31 proc long_filenames { } {
35 set testname "ar long file names"
37 set n1 "abcdefghijklmnopqrstuvwxyz1"
38 set n2 "abcdefghijklmnopqrstuvwxyz2"
40 binutils_remove tmpdir/$n1
41 set status [catch "set f [open tmpdir/$n1 w]" errs]
43 verbose -log "open tmpdir/$n1 returned $errs"
50 binutils_remove tmpdir/$n2
51 set status [catch "set f [open tmpdir/$n2 w]" errs]
53 verbose -log "open tmpdir/$n2 returned $errs"
60 # Some file systems truncate file names at 14 characters, which
61 # makes it impossible to run this test. Check for that now.
62 set f [open tmpdir/$n1 r]
65 if ![string match "first" $string] {
66 verbose -log "reading tmpdir/$n1 returned $string"
71 binutils_remove tmpdir/artest.a
72 set got [binutils_run $AR "rc tmpdir/artest.a tmpdir/$n1 tmpdir/$n2"]
73 if ![string match "" $got] {
78 binutils_remove tmpdir/$n1
79 binutils_remove tmpdir/$n2
81 set got [binutils_run $AR "t tmpdir/artest.a"]
82 if ![string match "$n1*$n2" $got] {
87 verbose -log "cd tmpdir; $AR x artest.a"
88 catch "exec /bin/sh -c \"cd tmpdir; $AR x artest.a\"" exec_output
89 set exec_output [prune_warnings $exec_output]
90 if ![string match "" $exec_output] {
91 verbose -log $exec_output
96 if ![file exists tmpdir/$n1] {
97 verbose -log "tmpdir/$n1 does not exist"
101 if ![file exists tmpdir/$n2] {
102 verbose -log "tmpdir/$n2 does not exist"
107 set f [open tmpdir/$n1 r]
108 if { [gets $f line] == -1 || $line != "first" } {
109 verbose -log "tmpdir/$n1 contents:"
117 set f [open tmpdir/$n2 r]
118 if { [gets $f line] == -1 || $line != "second" } {
119 verbose -log "tmpdir/$n2 contents:"
130 # Test building the symbol table.
132 proc symbol_table { } {
139 set testname "ar symbol table"
141 if ![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
146 binutils_remove tmpdir/artest.a
148 set got [binutils_run $AR "rc tmpdir/artest.a tmpdir/bintest.o"]
149 if ![string match "" $got] {
154 set got [binutils_run $NM "--print-armap tmpdir/artest.a"]
155 if { ![string match "*text_symbol in bintest.o*" $got] \
156 || ![string match "*data_symbol in bintest.o*" $got] \
157 || ![string match "*common_symbol in bintest.o*" $got] \
158 || [string match "*static_text_symbol in bintest.o*" $got] \
159 || [string match "*static_data_symbol in bintest.o*" $got] \
160 || [string match "*external_symbol in bintest.o*" $got] } {