2 # Test
-specific TCL procedures required by DejaGNU.
3 # Copyright
(C
) 1994 Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
2 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program; if not
, write to the Free Software
17 # Foundation
, Inc.
, 675 Mass Ave
, Cambridge
, MA
02139, USA.
19 # Modified by David MacKenzie
<djm@gnu.ai.mit.edu
> from the gcc files
20 # written by Rob Savoye
<rob@cygnus.com
>.
24 # Extract and print the version number of xargs.
25 proc xargs_version
{} {
29 if {[which $XARGS
] != 0} then {
30 set tmp
[ eval exec $XARGS $XARGSFLAGS
--version
</dev
/null
]
31 regexp
"version.*$" $tmp version
32 if [info exists version
] then {
33 clone_output
"[which $XARGS] $version\n"
35 warning
"cannot get version from $tmp."
38 warning
"$XARGS, program does not exist"
42 # Run xargs and leave the output in $comp_output.
43 # Called by individual test scripts.
44 proc xargs_start
{ passfail options
infile } {
50 if {[which $XARGS
] == 0} then {
51 error
"$XARGS, program does not exist"
55 set fail_good
[string match
"f*" $passfail]
57 set scriptname
[uplevel
{info script
}]
58 set testbase
[file rootname $scriptname
]
59 set testname
[file tail $testbase
]
61 set outfile "$testbase.xo"
62 if {$
infile != ""} then {
63 set infile "[file dirname [file dirname $testbase]]/inputs/$infile"
68 set cmd
"$XARGS $XARGSFLAGS $options < $infile > xargs.out"
71 send_user
"Spawning \"$cmd\"\n"
74 catch
"exec $cmd" comp_output
75 if {$comp_output
!= ""} then {
76 send_log
"$comp_output\n"
78 send_user
"$comp_output\n"
83 fail
"$testname, $comp_output"
88 if [file
exists $
outfile] then {
89 set cmp_cmd
"cmp xargs.out $outfile"
91 catch
"exec $cmp_cmd" cmpout
92 if {$cmpout
!= ""} then {
93 fail
"$testname, $cmpout"
97 if {[file size xargs.out
] != 0} then {
98 fail
"$testname, output should be empty"
106 # Clean up
(remove temporary files
) before runtest exits.
108 catch
"exec rm -f xargs.out"