2 # Test
-specific TCL procedures required by DejaGNU.
3 # Copyright
(C
) 2000 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.
, 9 Temple Place
- Suite
330, Boston
, MA
02111-1307,
20 # Modified by Kevin Dalley
<kevind@rahul.net
> from the xargs files.
21 # Modified by David MacKenzie
<djm@gnu.ai.mit.edu
> from the gcc files
22 # written by Rob Savoye
<rob@cygnus.com
>.
27 if ![info exists FIND
] {
28 set FIND
[findfile $base_dir
/..
/find $base_dir
/..
/find
[transform find
]]
29 verbose
"FIND defaulting to $FIND" 2
33 if ![info exists FINDFLAGS
] then {
38 # Extract and print the version number of find.
39 proc find_version
{} {
43 if {[which $FIND
] != 0} then {
44 set tmp
[ eval exec $FIND $FINDFLAGS
--version
</dev
/null
]
45 regexp
"version.*$" $tmp version
46 if [info exists version
] then {
47 clone_output
"[which $FIND] $version\n"
49 warning
"cannot get version from $tmp."
52 warning
"$FIND, program does not exist"
56 # Run find and leave the output in $comp_output.
57 # Called by individual test scripts.
58 proc find_start
{ passfail options
{infile ""}} {
64 if {[which $FIND
] == 0} then {
65 error
"$FIND, program does not exist"
69 set fail_good
[string match
"f*" $passfail]
71 set scriptname
[uplevel
{info script
}]
72 set testbase
[file rootname $scriptname
]
73 set testname
[file tail $testbase
]
75 set outfile "$testbase.xo"
76 if {$
infile != ""} then {
77 set infile "[file dirname [file dirname $testbase]]/inputs/$infile"
82 set cmd
"$FIND $FINDFLAGS $options < $infile > find.out"
85 send_user
"Spawning \"$cmd\"\n"
88 catch
"exec $cmd" comp_output
89 if {$comp_output
!= ""} then {
90 send_log
"$comp_output\n"
92 send_user
"$comp_output\n"
97 fail
"$testname, $comp_output"
102 if [file
exists $
outfile] then {
103 set cmp_cmd
"cmp find.out $outfile"
104 send_log
"$cmp_cmd\n"
105 catch
"exec $cmp_cmd" cmpout
106 if {$cmpout
!= ""} then {
107 fail
"$testname, $cmpout"
111 if {[file size find.out
] != 0} then {
112 fail
"$testname, output should be empty"
120 # Clean up
(remove temporary files
) before runtest exits.
122 catch
"exec rm -f find.out"