This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / binutils / testsuite / binutils-all / size.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 $SIZE] == 0} then {
24     perror "$SIZE does not exist"
25     return
26 }
27
28 send_user "Version [binutil_version $SIZE]"
29
30
31 if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
32     return
33 }
34
35 set dec "\[0-9\]+"
36 set hex "\[0-9a-fA-F\]+"
37
38 # Test size with no arguments
39
40 set got [binutils_run $SIZE "$SIZEFLAGS tmpdir/bintest.o"]
41
42 set want "($dec)\[      \]+($dec)\[     \]+($dec)\[     \]+($dec)\[     \]+($hex)\[     \]+tmpdir/bintest.o"
43
44 if ![regexp $want $got all text data bss dtot hextot] then {
45     fail "size (no arguments)"
46 } else {
47     if {$text < 8 || $data < 4} then {
48         fail "size (no arguments)"
49     } else {
50         pass "size (no arguments)"
51     }
52 }
53
54 # Test size -A
55
56 set got [binutils_run $SIZE "$SIZEFLAGS -A tmpdir/bintest.o"]
57
58 set want "tmpdir/bintest.o.*(text|TEXT)\[^\n\r\]*\[     \]($dec)\[      \]+$dec.*(data|DATA)\[^\n\r\]*\[        \]($dec)\[      \]+$dec"
59
60 if ![regexp $want $got all textname textsize dataname datasize] then {
61     fail "size -A"
62 } else {
63     verbose "text size: $textsize"
64     verbose "data size: $datasize"
65     if {$textsize < 8 || $datasize < 4} then {
66         fail "size -A"
67     } else {
68         pass "size -A"
69     }
70 }