15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 9 Temple Place - Suite 330, Boston, MA 02111-1307,
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21
# Modified by David MacKenzie <djm@gnu.ai.mit.edu> from the gcc files
21
# Modified by David MacKenzie <djm@gnu.org> from the gcc files
22
22
# written by Rob Savoye <rob@cygnus.com>.
25
25
# use the local version of find for updatedb
26
set env(find) ../../find/find
27
# We normalise (normalize for those over the water) pathnames
28
# because the updatedb shell script uses "cd", which means that
29
# any relative paths no longer point where we thought they did.
30
set env(find) [file normalize "../../find/find"]
27
32
# use the local help commands for updatedb
28
set env(LIBEXECDIR) ..
33
set env(LIBEXECDIR) [file normalize .. ]
29
35
# do not ignore any file systems for this test
30
36
set env(PRUNEFS) ""
35
41
verbose "UPDATEDB defaulting to $UPDATEDB" 2
46
if ![info exists FRCODE] {
47
set FRCODE [findfile $base_dir/../frcode $base_dir/../frcode [transform frcode]]
48
verbose "FRCODE defaulting to $FRCODE" 2
38
51
global UPDATEDBFLAGS
39
52
if ![info exists UPDATEDBFLAGS] then {
40
53
set UPDATEDBFLAGS ""
76
89
# Run locate and leave the output in $comp_output.
77
90
# Called by individual test scripts.
91
proc locate_textonly { passfail id intext locateoptions outtext } {
95
if {[which $LOCATE] == 0} then {
96
error "$LOCATE, program does not exist"
100
if {[which $FRCODE] == 0} then {
101
error "$FRCODE, program does not exist"
105
set fail_good [string match "f*" $passfail]
107
set scriptname [uplevel {info script}]
108
set testbase [file rootname $scriptname]
109
set testname [file tail $testbase]
110
set listfile "updatedb-paths.txt"
111
set dbfile "locate.db"
112
set outfile "locate.out"
114
# Generate the "frcode" input.
115
catch { file delete -force $listfle }
116
set f [open $listfile w]
121
exec $FRCODE < $listfile > $dbfile
124
set locatecmd "$LOCATE -d $dbfile $locateoptions"
125
send_log "Running $locatecmd \n"
126
catch "exec $locatecmd > $outfile"
129
set f [open "$outfile" r]
130
while { [ gets $f line ] >= 0 } {
131
# send_log "Output fragment is $line\n"
132
append result "$line\n"
136
# send_log "Output is $result\n"
138
if {[string equal $result $outtext]} {
145
send_log "Output mismatch.\n"
146
send_log "Expected: $outtext\n"
147
send_log "Got : $result\n"
154
# Run locate and leave the output in $comp_output.
155
# Called by individual test scripts.
78
156
proc locate_start { passfail updatedb_options locate_options
79
{updatedb_infile ""} {locate_infile ""}} {
157
{updatedb_infile ""} {locate_infile ""}
82
162
global LOCATEFLAGS
144
225
send_log "$cmp_cmd\n"
145
226
catch "exec $cmp_cmd" cmpout
146
227
if {$cmpout != ""} then {
228
#catch "exec diff locate.out $outfile" diffout
147
230
fail "$testname, $cmpout"