~ubuntu-branches/ubuntu/raring/findutils/raring

« back to all changes in this revision

Viewing changes to locate/testsuite/config/unix.exp

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2005-07-04 11:37:37 UTC
  • mto: (11.1.1 lenny) (1.1.10 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050704113737-oxfumqxsqgfz5gay
Tags: upstream-4.2.22
ImportĀ upstreamĀ versionĀ 4.2.22

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
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,
18
18
# USA.
19
19
 
20
20
 
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>.
23
23
 
24
24
 
25
25
# use the local version of find for updatedb
26
 
set env(find) ../../find/find
 
26
#
 
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"]
 
31
 
27
32
# use the local help commands for updatedb
28
 
set env(LIBEXECDIR) ..
 
33
set env(LIBEXECDIR) [file normalize .. ]
 
34
 
29
35
# do not ignore any file systems for this test
30
36
set env(PRUNEFS) ""
31
37
global UPDATEDB
35
41
    verbose "UPDATEDB defaulting to $UPDATEDB" 2
36
42
}
37
43
 
 
44
global FRCODE
 
45
# look for FRCODE
 
46
if ![info exists FRCODE] {
 
47
    set FRCODE [findfile $base_dir/../frcode $base_dir/../frcode [transform frcode]]
 
48
    verbose "FRCODE defaulting to $FRCODE" 2
 
49
}
 
50
 
38
51
global UPDATEDBFLAGS
39
52
if ![info exists UPDATEDBFLAGS] then {
40
53
    set UPDATEDBFLAGS ""
75
88
 
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 } {
 
92
    global LOCATE
 
93
    global FRCODE
 
94
 
 
95
    if {[which $LOCATE] == 0} then {
 
96
        error "$LOCATE, program does not exist"
 
97
        exit 1
 
98
    }
 
99
 
 
100
    if {[which $FRCODE] == 0} then {
 
101
        error "$FRCODE, program does not exist"
 
102
        exit 1
 
103
    }
 
104
 
 
105
    set fail_good [string match "f*" $passfail]
 
106
 
 
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"
 
113
 
 
114
    # Generate the "frcode" input.
 
115
    catch { file delete -force $listfle }
 
116
    set f [open $listfile w]
 
117
    puts $f "$intext"
 
118
    close $f
 
119
 
 
120
    # Run frcode
 
121
    exec $FRCODE < $listfile > $dbfile
 
122
 
 
123
    # Now run locate.
 
124
    set locatecmd "$LOCATE -d $dbfile $locateoptions"
 
125
    send_log "Running $locatecmd \n"
 
126
    catch "exec $locatecmd > $outfile"
 
127
 
 
128
    set result ""
 
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"
 
133
    }
 
134
    close $f
 
135
 
 
136
    # send_log "Output is $result\n"
 
137
 
 
138
    if {[string equal $result $outtext]} {
 
139
        if $fail_good then {
 
140
            fail "$testname-$id"
 
141
        } else {
 
142
            pass "$testname-$id"
 
143
        }
 
144
    } else {
 
145
        send_log "Output mismatch.\n"
 
146
        send_log "Expected: $outtext\n"
 
147
        send_log "Got     : $result\n"
 
148
        fail "$testname-$id"
 
149
    }
 
150
}
 
151
 
 
152
 
 
153
 
 
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 ""}
 
158
                    { between_hook "" }
 
159
                } {
80
160
    global verbose
81
161
    global LOCATE
82
162
    global LOCATEFLAGS
125
205
    }
126
206
 
127
207
    catch "exec $updatedb_cmd" comp_output
 
208
    eval $between_hook
128
209
    catch "exec $locate_cmd" comp_output
129
210
    if {$comp_output != ""} then {
130
211
        send_log "$comp_output\n"
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
 
229
            #puts $diffout
147
230
            fail "$testname, $cmpout"
148
231
            return
149
232
        }
160
243
# Called by runtest.
161
244
# Clean up (remove temporary files) before runtest exits.
162
245
proc locate_exit {} {
163
 
    catch "exec rm -f locate.out"
 
246
    catch "exec rm -f locate.out updatedb-paths.txt locate.db"
164
247
}
165
248
 
166
249
# Called by runtest.