diff options
Diffstat (limited to 'tests/zipfs.test')
-rw-r--r-- | tests/zipfs.test | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/tests/zipfs.test b/tests/zipfs.test index cb45b05..705f26f 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -358,10 +358,10 @@ test zipfs-4.5 {zipfs lmkimg: making image from mounted} -constraints zipfs -set test zipfs-5.1 {zipfs mount_data: short data} -constraints zipfs -body { zipfs mount_data {} gorp -} -returnCodes error -result {archive directory end signature not found} +} -returnCodes error -result {illegal file size} test zipfs-5.2 {zipfs mount_data: short data} -constraints zipfs -body { zipfs mount_data gorpGORPgorp gorp -} -returnCodes error -result {archive directory end signature not found} +} -returnCodes error -result {illegal file size} test zipfs-5.3 {zipfs mount_data: short data} -constraints zipfs -body { set data PK\x03\x04..................................... append data PK\x01\x02..................................... @@ -567,7 +567,7 @@ namespace eval test_ns_zipfs { lappend result [string equal $chans [lsort [chan names]]] } -cleanup { cleanup - } -result {1 {decryption failed} 1} + } -result {1 {decryption failed - no password provided} 1} test zipfs-mount-password-3 "mount - verify compressed cipher unreadable without password" -body { zipfs mount [zippath test-password.zip] $defaultMountPoint @@ -578,7 +578,7 @@ namespace eval test_ns_zipfs { lappend result [string equal $chans [lsort [chan names]]] } -cleanup { cleanup - } -result {1 {decryption failed} 1} + } -result {1 {decryption failed - no password provided} 1} test zipfs-mount-nested-1 "mount - nested mount on non-existing path" -setup { mount [zippath test.zip] @@ -966,6 +966,7 @@ namespace eval test_ns_zipfs { testzipfsread stored test.zip test test testzipfsread stored teststored.zip aaaaaaaaaaaaaa testzipfsread deflate testdeflated2.zip aaaaaaaaaaaaaa + testzipfsread bug-23dd83ce7c empty.zip {} empty.txt # Test open modes - see bug [4645658689] testzipfsread stored-rw teststored.zip aaaaaaaaaaaaaa abac-repeat.txt r+ testzipfsread deflate-rw testdeflated2.zip aaaaaaaaaaaaaa abac-repeat.txt r+ @@ -1031,17 +1032,18 @@ namespace eval test_ns_zipfs { } testzipfswrite create-w test.zip "file not found \"//zipfs:/testmount/newfile\": no such file or directory" newfile w -returnCodes error - testzipfswrite create-wr test.zip "file not found \"//zipfs:/testmount/newfile\": no such file or directory" newfile w+ -returnCodes error + testzipfswrite create-w+ test.zip "file not found \"//zipfs:/testmount/newfile\": no such file or directory" newfile w+ -returnCodes error testzipfswrite create-a test.zip "append mode not supported: permission denied" newfile a -returnCodes error - testzipfswrite create-ar test.zip "file not found \"//zipfs:/testmount/newfile\": no such file or directory" newfile a+ -returnCodes error + testzipfswrite create-a+ test.zip "file not found \"//zipfs:/testmount/newfile\": no such file or directory" newfile a+ -returnCodes error testzipfswrite store-w teststored.zip "xyz" abac-repeat.txt w testzipfswrite deflate-w testdeflated2.zip "xyz" abac-repeat.txt w - testzipfswrite store-wr teststored.zip "xyz" abac-repeat.txt w+ - testzipfswrite deflate-wr testdeflated2.zip "xyz" abac-repeat.txt w+ + testzipfswrite store-w+ teststored.zip "xyz" abac-repeat.txt w+ + testzipfswrite deflate-w+ testdeflated2.zip "xyz" abac-repeat.txt w+ testzipfswrite stored-a teststored.zip "append mode not supported: permission denied" abac-repeat.txt a -returnCodes error testzipfswrite deflate-a testdeflated2.zip "append mode not supported: permission denied" abac-repeat.txt a -returnCodes error - testzipfswrite store-ar teststored.zip "aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\nxyz" abac-repeat.txt a+ - testzipfswrite deflate-ar testdeflated2.zip "aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\nxyz" abac-repeat.txt a+ + testzipfswrite store-a+ teststored.zip "aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\nxyz" abac-repeat.txt a+ + testzipfswrite deflate-a+ testdeflated2.zip "aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\nxyz" abac-repeat.txt a+ + testzipfswrite bug-23dd83ce7c-w empty.zip "xyz" empty.txt w test zipfs-write-unreadable "Reads not allowed on file opened for write" -setup { mount [zippath test.zip] @@ -1135,14 +1137,18 @@ namespace eval test_ns_zipfs { append result [gets $fd], set pos [tell $fd] append result $pos, - puts -nonewline $fd "xyz" + puts -nonewline $fd "0123456789" append result [gets $fd], seek $fd $pos append result [gets $fd], seek $fd -6 end + append result [read $fd]| + close $fd + # Reopen after closing - bug [f91ee30d3] + set fd [open $path rb] append result [read $fd] } - test zipfs-readwrite-$id "zipfs read/seek/write $id" -setup { + test zipfs-rw-$id "zipfs read/seek/write $id" -setup { unset -nocomplain fd zipfs mount $zippath $defaultMountPoint } -cleanup { @@ -1154,7 +1160,7 @@ namespace eval test_ns_zipfs { } -body $body -result $expected {*}$args set data [readbin $zippath] - test zipfs-readwrite-memory-$id "zipfs read/seek/write in-memory $id" -setup { + test zipfs-rw-memory-$id "zipfs read/seek/write in-memory $id" -setup { unset -nocomplain fd zipfs mount_data $data $defaultMountPoint } -cleanup { @@ -1166,9 +1172,25 @@ namespace eval test_ns_zipfs { } -body $body -result $expected {*}$args } - testzipfsrw store-r+ teststored.zip "aaaaaaaaaaaaaa,15,bbbbbbbbbbb,xyzbbbbbbbbbbb,ccccc\n" abac-repeat.txt r+ - testzipfsrw store-w+ teststored.zip ",0,,xyz,yz" abac-repeat.txt w+ -constraints bug-00018ec7a0 - testzipfsrw store-a+ teststored.zip ",60,,xyz,cc\nxyz" abac-repeat.txt a+ + testzipfsrw store-r+ teststored.zip "aaaaaaaaaaaaaa,15,bbbb,0123456789bbbb,ccccc\n|aaaaaaaaaaaaaa\n0123456789bbbb\naaaaaaaaaaaaaa\ncccccccccccccc\n" abac-repeat.txt r+ + testzipfsrw store-w+ teststored.zip ",0,,0123456789,456789|0123456789" abac-repeat.txt w+ + testzipfsrw store-a+ teststored.zip ",60,,0123456789,456789|aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\n0123456789" abac-repeat.txt a+ + testzipfsrw deflate-r+ testdeflated2.zip "aaaaaaaaaaaaaa,15,bbbb,0123456789bbbb,ccccc\n|aaaaaaaaaaaaaa\n0123456789bbbb\naaaaaaaaaaaaaa\ncccccccccccccc\n" abac-repeat.txt r+ + testzipfsrw deflate-w+ testdeflated2.zip ",0,,0123456789,456789|0123456789" abac-repeat.txt w+ + testzipfsrw deflate-a+ testdeflated2.zip ",60,,0123456789,456789|aaaaaaaaaaaaaa\nbbbbbbbbbbbbbb\naaaaaaaaaaaaaa\ncccccccccccccc\n0123456789" abac-repeat.txt a+ + test zipfs-rw-bug-f91ee30d33 "Bug f91ee30d33 - truncates at last read" -setup { + mount [zippath test.zip] + } -cleanup { + close $fd + cleanup + } -body { + set path [file join $defaultMountPoint test] + set fd [open $path r+] + puts -nonewline $fd X + close $fd + set fd [open $path r] + read $fd + } -result "Xest\n" # # Password protected @@ -1199,10 +1221,10 @@ namespace eval test_ns_zipfs { testpassword plain-nopassword plain.txt "" plaintext testpassword plain-badpassword plain.txt xxx plaintext testpassword cipher cipher.bin password ciphertext -constraints bug-bbe7c6ff9e - testpassword cipher-nopassword cipher.bin {} "decryption failed" -returnCodes error + testpassword cipher-nopassword cipher.bin {} "decryption failed - no password provided" -returnCodes error testpassword cipher-badpassword cipher.bin xxx "invalid CRC" -returnCodes error testpassword cipher-deflate cipher-deflate.bin password [lseq 100] -constraints bug-bbe7c6ff9e - testpassword cipher-deflate-nopassword cipher-deflate.bin {} "decryption failed" -returnCodes error + testpassword cipher-deflate-nopassword cipher-deflate.bin {} "decryption failed - no password provided" -returnCodes error testpassword cipher-deflate-badpassword cipher-deflate.bin xxx "decompression error" -returnCodes error # |