Update FSF address
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / size.exp
1 # Copyright 1993, 1994, 1995, 1997, 1998 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 ![is_remote host] {
24 if {[which $SIZE] == 0} then {
25 perror "$SIZE does not exist"
26 return
27 }
28 }
29
30 send_user "Version [binutil_version $SIZE]"
31
32
33 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
34 return
35 }
36
37 if [is_remote host] {
38 set testfile [remote_download host tmpdir/bintest.o]
39 } else {
40 set testfile tmpdir/bintest.o
41 }
42
43 set dec "\[0-9\]+"
44 set hex "\[0-9a-fA-F\]+"
45
46 # Test size with no arguments
47
48 set got [binutils_run $SIZE "$SIZEFLAGS $testfile"]
49
50 set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+${testfile}"
51
52 if ![regexp $want $got all text data bss dtot hextot] then {
53 fail "size (no arguments)"
54 } else {
55 if {$text < 8 || $data < 4} then {
56 fail "size (no arguments)"
57 } else {
58 pass "size (no arguments)"
59 }
60 }
61
62 # Test size -A
63
64 set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"]
65
66 set want "${testfile}.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec"
67
68 if ![regexp $want $got all textname textsize dataname datasize] then {
69 fail "size -A"
70 } else {
71 verbose "text size: $textsize"
72 verbose "data size: $datasize"
73 if {$textsize < 8 || $datasize < 4} then {
74 fail "size -A"
75 } else {
76 pass "size -A"
77 }
78 }
This page took 0.035376 seconds and 5 git commands to generate.