192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
fconfigure $f -encoding iso2022-jp -buffersize 19
puts -nonewline $f $data
close $f
lappend sizes [file size $path(test2)]
set sizes
} {19 19 19 19 19}
test io-1.10 {WriteChars: large file (> INT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-1.10.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile w]
puts -nonewline $fd [string repeat A 0x80000000]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 2147483648
test io-1.11 {WriteChars: large file (> UINT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-1.11.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile w]
puts -nonewline $fd [string repeat A 0x100000000]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 4294967296
test io-1.12 {WriteChars: large file (== UINT_MAX). Bug 90ff9b7f73} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-1.12.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile w]
# *Exactly* UINT_MAX - separate bug from the general large file tests
puts -nonewline $fd [string repeat A 0xffffffff]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 4294967295
test io-2.1 {WriteBytes} {
# loop until all bytes are written
set f [open $path(test1) w]
fconfigure $f -encoding binary -buffersize 16 -translation crlf
puts $f "abcdefghijklmnopqrstuvwxyz"
|
|
<
<
|
<
|
|
>
>
>
>
|
>
|
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
|
<
<
<
<
<
|
<
<
<
|
<
<
<
<
<
|
<
<
<
|
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
fconfigure $f -encoding iso2022-jp -buffersize 19
puts -nonewline $f $data
close $f
lappend sizes [file size $path(test2)]
set sizes
} {19 19 19 19 19}
proc testreadwrite {size {mode ""} args} {
set tmpfile [file join [temporaryDirectory] io-1.10.tmp]
set w [string repeat A $size]
try {
set fd [open $tmpfile w$mode]
try {
if {[llength $args]} {
fconfigure $fd {*}$args
}
puts -nonewline $fd $w
} finally {
close $fd
}
set fd [open $tmpfile r$mode]
try {
if {[llength $args]} {
fconfigure $fd {*}$args
}
set r [read $fd]
} finally {
close $fd
}
} finally {
file delete $tmpfile
}
string equal $w $r
}
test io-1.10 {WriteChars: large file (> INT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -body {
testreadwrite 0x80000000
} -result 1
test io-1.11 {WriteChars: large file (> UINT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -body {
testreadwrite 0x100000000 "" -buffersize 1000000
} -result 1
test io-1.12 {WriteChars: large file (== UINT_MAX). Bug 90ff9b7f73} -constraints {
pointerIs64bit perf
} -body {
# *Exactly* UINT_MAX - separate bug from the general large file tests
testreadwrite 0xffffffff
} -result 1
test io-2.1 {WriteBytes} {
# loop until all bytes are written
set f [open $path(test1) w]
fconfigure $f -encoding binary -buffersize 16 -translation crlf
puts $f "abcdefghijklmnopqrstuvwxyz"
|
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
fconfigure $f -encoding binary -buffering line -translation lf \
-buffersize 16
puts -nonewline $f "abcdefg\nhijklmnopqrstuvwxyz"
set x [list [contents $path(test1)]]
close $f
lappend x [contents $path(test1)]
} [list "abcdefg\nhijklmno" "abcdefg\nhijklmnopqrstuvwxyz"]
test io-2.5 {WriteBytes: large file (> INT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-2.5.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile wb]
puts -nonewline $fd [string repeat A 0x80000000]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 2147483648
test io-2.6 {WriteBytes: large file (> UINT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-2.6.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile wb]
puts -nonewline $fd [string repeat A 0x100000000]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 4294967296
test io-2.7 {WriteBytes: large file (== UINT_MAX). Bug 90ff9b7f73} -constraints {
pointerIs64bit perf
} -setup {
set tmpfile [file join [temporaryDirectory] io-2.7.tmp]
} -cleanup {
file delete $tmpfile
} -body {
set fd [open $tmpfile wb]
# *Exactly* UINT_MAX - separate bug from the general large file tests
puts -nonewline $fd [string repeat A 0xffffffff]
close $fd
# TODO - Should really read it back in but large reads are not currently working!
file size $tmpfile
} -result 4294967295
test io-3.1 {WriteChars: compatibility with WriteBytes} {
# loop until all bytes are written
set f [open $path(test1) w]
fconfigure $f -encoding ascii -buffersize 16 -translation crlf
puts $f "abcdefghijklmnopqrstuvwxyz"
|
<
<
<
<
<
<
>
|
<
<
<
|
<
<
<
<
<
>
|
<
<
<
|
<
<
<
<
<
|
<
<
<
|
>
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
fconfigure $f -encoding binary -buffering line -translation lf \
-buffersize 16
puts -nonewline $f "abcdefg\nhijklmnopqrstuvwxyz"
set x [list [contents $path(test1)]]
close $f
lappend x [contents $path(test1)]
} [list "abcdefg\nhijklmno" "abcdefg\nhijklmnopqrstuvwxyz"]
test io-2.5 {WriteBytes: large file (> INT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -body {
# Binary mode
testreadwrite 0x80000000 b
} -result 1
test io-2.6 {WriteBytes: large file (> UINT_MAX). Bug 3d01d51bc4} -constraints {
pointerIs64bit perf
} -body {
# Binary mode
testreadwrite 0x100000000 b -buffersize 1000000
} -result 1
test io-2.7 {WriteBytes: large file (== UINT_MAX). Bug 90ff9b7f73} -constraints {
pointerIs64bit perf
} -body {
# *Exactly* UINT_MAX - separate bug from the general large file tests
testreadwrite 0xffffffff b
} -result 1
test io-3.1 {WriteChars: compatibility with WriteBytes} {
# loop until all bytes are written
set f [open $path(test1) w]
fconfigure $f -encoding ascii -buffersize 16 -translation crlf
puts $f "abcdefghijklmnopqrstuvwxyz"
|