# -*- TCL -*- # Test-specific TCL procedures required by DejaGNU. # Copyright (C) 2000, 2003, 2004, 2005, 2006, 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # Modified by Kevin Dalley from the xargs files. # Modified by David MacKenzie from the gcc files # written by Rob Savoye . global FIND # look for FIND if ![info exists FIND] { set FIND [findfile $base_dir/../find $base_dir/../find [transform find]] verbose "FIND defaulting to $FIND" 2 } global FINDFLAGS if ![info exists FINDFLAGS] then { set FINDFLAGS "" } # Called by runtest. # Extract and print the version number of find. proc find_version {} { global FIND global FINDFLAGS if {[which $FIND] != 0} then { set tmp [ eval exec $FIND $FINDFLAGS --version find.out" send_log "$cmd\n" if $verbose>1 then { send_user "Spawning \"$cmd\"\n" } catch "exec $cmd" comp_output if {$comp_output != ""} then { send_log "$comp_output\n" if $verbose>1 then { send_user "$comp_output\n" } if $fail_good then { pass "$testname" } else { fail "$testname, $comp_output" } return } if [file exists $outfile] then { # We use the 'sort' above to sort the output of find to ensure # that the directory entries appear in a predictable order. # Because in the general case the person compiling and running # "make check" will have a different collating order to the # maintainer, we can't guarantee that our "correct" answer # is already sorted in the correct order. To avoid trying # to figure out how to select a POSIX environment on a # random system, we just sort the data again here, using # the local user's environment. exec sort < $outfile > cmp.out set cmp_cmd "$compareprog find.out cmp.out" send_log "$cmp_cmd\n" catch "exec $cmp_cmd" cmpout if {$cmpout != ""} then { fail "$testname, $cmpout" return } } else { if {[file size find.out] != 0} then { fail "$testname, output should be empty" return } } pass "$testname" } # Called by runtest. # Clean up (remove temporary files) before runtest exits. proc find_exit {} { catch "exec rm -f find.out cmp.out" } proc dot_is_on_path {} { global env; set itemlist [ split $env(PATH) : ] foreach item $itemlist { if { [ string equal $item "" ] } { return 1; } if { [ string equal $item "." ] } { return 1; } } return 0; }