* binutils-all/readelf.n: Add #pass to cope with targets that add
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / size.exp
CommitLineData
aa820537
AM
1# Copyright 1993, 1994, 1995, 1997, 1998, 2007, 2009
2# Free Software Foundation, Inc.
252b5132
RH
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
32866df7 6# the Free Software Foundation; either version 3 of the License, or
252b5132
RH
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
b43b5d5f 16# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
252b5132
RH
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-dejagnu@prep.ai.mit.edu
20
21# This file was written by Rob Savoye <rob@cygnus.com>
22# and rewritten by Ian Lance Taylor <ian@cygnus.com>
23
24if ![is_remote host] {
25 if {[which $SIZE] == 0} then {
26 perror "$SIZE does not exist"
27 return
28 }
29}
30
31send_user "Version [binutil_version $SIZE]"
32
33
34if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
35 return
36}
37
38if [is_remote host] {
39 set testfile [remote_download host tmpdir/bintest.o]
40} else {
41 set testfile tmpdir/bintest.o
42}
43
44set dec "\[0-9\]+"
45set hex "\[0-9a-fA-F\]+"
46
47# Test size with no arguments
48
49set got [binutils_run $SIZE "$SIZEFLAGS $testfile"]
50
51set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+${testfile}"
52
53if ![regexp $want $got all text data bss dtot hextot] then {
54 fail "size (no arguments)"
55} else {
56 if {$text < 8 || $data < 4} then {
b7b8fb1d
NC
57 # The z80-coff port defaults to a "binary" like output
58 # file format which does not include a data section.
59 setup_xfail "z80-*-coff"
252b5132
RH
60 fail "size (no arguments)"
61 } else {
62 pass "size (no arguments)"
63 }
64}
65
66# Test size -A
67
68set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"]
69
70set want "${testfile}.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec"
71
72if ![regexp $want $got all textname textsize dataname datasize] then {
73 fail "size -A"
74} else {
75 verbose "text size: $textsize"
76 verbose "data size: $datasize"
77 if {$textsize < 8 || $datasize < 4} then {
78 fail "size -A"
79 } else {
80 pass "size -A"
81 }
82}
This page took 0.510863 seconds and 4 git commands to generate.