summaryrefslogtreecommitdiffstats
path: root/tests/zlib.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zlib.test')
-rw-r--r--tests/zlib.test74
1 files changed, 70 insertions, 4 deletions
diff --git a/tests/zlib.test b/tests/zlib.test
index 968469d..ae8742b 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -138,6 +138,25 @@ test zlib-7.7 {zlib stream: Bug 25842c161} -constraints zlib -body {
} -cleanup {
catch {$s close}
} -result ""
+# Also causes Tk Bug 10f2e7872b
+test zlib-7.8 {zlib stream: Bug b26e38a3e4} -constraints zlib -setup {
+ expr srand(12345)
+ set randdata {}
+ for {set i 0} {$i<6001} {incr i} {
+ append randdata [binary format c [expr {int(256*rand())}]]
+ }
+} -body {
+ set strm [zlib stream compress]
+ for {set i 1} {$i<3000} {incr i} {
+ $strm put $randdata
+ }
+ $strm put -finalize $randdata
+ set data [$strm get]
+ list [string length $data] [string length [zlib decompress $data]]
+} -cleanup {
+ catch {$strm close}
+ unset -nocomplain randdata data
+} -result {120185 18003000}
test zlib-8.1 {zlib transformation} -constraints zlib -setup {
set file [makeFile {} test.gz]
@@ -251,9 +270,10 @@ test zlib-8.8 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push compress $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
set compressed [read $inSide]
catch {zlib decompress $compressed} err opt
list [string length [zlib compress $spdyHeaders]] \
@@ -269,10 +289,11 @@ test zlib-8.9 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push compress $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
set result [fconfigure $outSide -checksum]
chan pop $outSide
+ chan close $outSide
$strm put -dictionary $spdyDict [read $inSide]
lappend result [string length $spdyHeaders] [string length [$strm get]]
} -cleanup {
@@ -285,9 +306,10 @@ test zlib-8.10 {transformation and fconfigure} -setup {
} -constraints {zlib recentZlib} -body {
zlib push deflate $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
set compressed [read $inSide]
catch {
zlib inflate $compressed
@@ -306,9 +328,10 @@ test zlib-8.11 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push deflate $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
$strm put -dictionary $spdyDict [read $inSide]
list [string length $spdyHeaders] [string length [$strm get]]
} -cleanup {
@@ -401,6 +424,26 @@ test zlib-8.16 {Bug 3603553: buffer transfer with large writes} -setup {
} -cleanup {
removeFile $file
} -result 57647
+test zlib-8.17 {Bug dd260aaf: fconfigure} -setup {
+ lassign [chan pipe] inSide outSide
+} -constraints zlib -body {
+ zlib push inflate $inSide
+ zlib push deflate $outSide
+ list [chan configure $inSide -dictionary] [chan configure $outSide -dictionary]
+} -cleanup {
+ catch {close $inSide}
+ catch {close $outSide}
+} -result {{} {}}
+test zlib-8.18 {Bug dd260aaf: fconfigure} -setup {
+ lassign [chan pipe] inSide outSide
+} -constraints zlib -body {
+ zlib push inflate $inSide -dictionary "one two"
+ zlib push deflate $outSide -dictionary "one two"
+ list [chan configure $inSide -dictionary] [chan configure $outSide -dictionary]
+} -cleanup {
+ catch {close $inSide}
+ catch {close $outSide}
+} -result {{one two} {one two}}
test zlib-9.1 "check fcopy with push" -constraints zlib -setup {
set sfile [makeFile {} testsrc.gz]
@@ -893,6 +936,29 @@ test zlib-12.1 {Tk Bug 9eb55debc5} -constraints zlib -setup {
} -cleanup {
$stream close
} -result {12026 18000}
+test zlib-12.2 {Patrick Dunnigan's issue} -constraints zlib -setup {
+ set filesrc [makeFile {} test.input]
+ set filedst [makeFile {} test.output]
+ set f [open $filesrc "wb"]
+ for {set i 0} {$i < 10000} {incr i} {
+ puts -nonewline $f "x"
+ }
+ close $f
+} -body {
+ set fin [open $filesrc "rb"]
+ set fout [open $filedst "wb"]
+ set header [dict create filename "test.input" time 0]
+ try {
+ fcopy $fin [zlib push gzip $fout -header $header]
+ } finally {
+ close $fin
+ close $fout
+ }
+ file size $filedst
+} -cleanup {
+ removeFile $filesrc
+ removeFile $filedst
+} -result 4152
::tcltest::cleanupTests
return