First crack at a test suite.
[deliverable/binutils-gdb.git] / gas / testsuite / lib / gas-defs.exp
1 # Copyright (C) 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # DejaGnu@cygnus.com
19
20 # This file was written by Ken Raeburn (raeburn@cygnus.com).
21
22 proc gas_version {} {
23 global AS
24 set tmp [exec $AS -version < /dev/null]
25 # Should find a way to discard constant parts, keep whatever's
26 # left, so the version string could be almost anything at all...
27 regexp " \[0-9\]\[0-9\.a-zA-Z-\]+" $tmp version
28 set tmp $version
29 regexp "\[0-9\.a-zA-Z-\]+" $tmp version
30 clone_output "[which $AS] version $version\n"
31 unset tmp
32 unset version
33 }
34
35 proc gas_start { prog } {
36 global verbose
37 global AS
38 global ASFLAGS
39 global comp_output
40
41 if $verbose>1 then {
42 send_user "Executing $AS $ASFLAGS $prog\n"
43 }
44 catch "exec $AS $ASFLAGS $prog" comp_output
45 if ![string match "" $comp_output] then {
46 send_log "$comp_output\n"
47 if $verbose>1 then {
48 send_user "$comp_output\n"
49 }
50 }
51 }
52
53 proc gas_test { arg testname } {
54 global verbose
55 global comp_output
56
57 gas_start $arg
58 if ![string match "" $comp_output] then {
59 send_log "$comp_output\n"
60 if $verbose>3 then {
61 send_user "|$comp_output|\n"
62 }
63 }
64 if [string match "" $comp_output] then {
65 pass "$testname"
66 } else {
67 fail "$testname"
68 }
69 }
This page took 0.035526 seconds and 5 git commands to generate.