old-cross-binutils/gas/testsuite/lib/gas-defs.exp
1993-03-29 13:27:13 +00:00

69 lines
2 KiB
Text

# Copyright (C) 1993 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# DejaGnu@cygnus.com
# This file was written by Ken Raeburn (raeburn@cygnus.com).
proc gas_version {} {
global AS
set tmp [exec $AS -version < /dev/null]
# Should find a way to discard constant parts, keep whatever's
# left, so the version string could be almost anything at all...
regexp " \[0-9\]\[0-9\.a-zA-Z-\]+" $tmp version
set tmp $version
regexp "\[0-9\.a-zA-Z-\]+" $tmp version
clone_output "[which $AS] version $version\n"
unset tmp
unset version
}
proc gas_start { prog } {
global verbose
global AS
global ASFLAGS
global comp_output
if $verbose>1 then {
send_user "Executing $AS $ASFLAGS $prog\n"
}
catch "exec $AS $ASFLAGS $prog" comp_output
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
if $verbose>1 then {
send_user "$comp_output\n"
}
}
}
proc gas_test { arg testname } {
global verbose
global comp_output
gas_start $arg
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
if $verbose>3 then {
send_user "|$comp_output|\n"
}
}
if [string match "" $comp_output] then {
pass "$testname"
} else {
fail "$testname"
}
}