work
[pspp] / tests / libpspp / zip.at
index 1ab57e50d8a85ec9a44f0821993662862e1b7396..bcc550457ab718a96f0280427d010a4ec2fd29d0 100644 (file)
@@ -35,7 +35,6 @@ while test $s -le 8192 ; do
         names="$names $bn";
 done
 
-ASAN_OPTIONS="$ASAN_OPTIONS:detect_odr_violation=0";export ASAN_OPTIONS
 AT_CHECK([cd "$dir1" && zip-test w foo.zip $names])
 
 # If zipinfo is installed, make sure it can read the zipfile.
@@ -58,6 +57,29 @@ AT_CHECK([
 ])
 AT_CLEANUP
 
+AT_SETUP([zip - detect corruption on unzip])
+AT_KEYWORDS([compression])
+mkdir write
+cd write
+AT_DATA([data.txt], [xyzzy
+])
+AT_CHECK([zip-test w ../foo.zip data.txt])
+cd ..
+
+mkdir extract
+cd extract
+AT_CHECK([zip-test r ../foo.zip data.txt])
+AT_CHECK([cat data.txt], [0], [xyzzy
+])
+cd ..
+
+mkdir error
+cd error
+sed 's/xyzzy/XYZZY/' < ../foo.zip > ../corrupted.zip
+AT_CHECK([zip-test r ../corrupted.zip data.txt], [1], [], [dnl
+Unzip failed: ../corrupted.zip: corrupt archive reading member "data.txt": bad CRC 0x2a2bcd20 (expected e1bd2a6e)
+])
+AT_CLEANUP
 
 AT_SETUP([zip to pipe])
 AT_KEYWORDS([compression])
@@ -78,7 +100,6 @@ while test $s -le 8192 ; do
         names="$names $bn";
 done
 
-ASAN_OPTIONS="$ASAN_OPTIONS:detect_odr_violation=0";export ASAN_OPTIONS
 # The pipe through "cat" below is essential because it makes the
 # output file un-seekable.
 AT_CHECK([cd "$dir1" && zip-test w - $names | cat > foo.zip])