aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-10-20 15:35:59 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-11-09 14:31:21 +0200
commitc8f70ebb4628ceb6cb29cc9195d9deadf69d2bd7 (patch)
treeda5d5e9ede3c0e61823313c2b4cd5d7b97d0e5a2 /tests
parentxz: Remove the commented-out FORMAT_GZIP, gzip, .gz, and .tgz. (diff)
downloadxz-c8f70ebb4628ceb6cb29cc9195d9deadf69d2bd7.tar.xz
Tests: Add .lz (lzip) test files.
Diffstat (limited to 'tests')
-rw-r--r--tests/files/README109
-rw-r--r--tests/files/bad-1-v0-uncomp-size.lzbin0 -> 42 bytes
-rw-r--r--tests/files/bad-1-v1-crc32.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-dict-1.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-dict-2.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-magic-1.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-magic-2.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-member-size.lzbin0 -> 50 bytes
-rw-r--r--tests/files/bad-1-v1-trailing-magic.lzbin0 -> 54 bytes
-rw-r--r--tests/files/bad-1-v1-uncomp-size.lzbin0 -> 50 bytes
-rw-r--r--tests/files/good-1-v0-trailing-1.lzbin0 -> 59 bytes
-rw-r--r--tests/files/good-1-v0.lzbin0 -> 42 bytes
-rw-r--r--tests/files/good-1-v1-trailing-1.lzbin0 -> 67 bytes
-rw-r--r--tests/files/good-1-v1-trailing-2.lzbin0 -> 70 bytes
-rw-r--r--tests/files/good-1-v1.lzbin0 -> 50 bytes
-rw-r--r--tests/files/good-2-v0-v1.lzbin0 -> 78 bytes
-rw-r--r--tests/files/good-2-v1-v0.lzbin0 -> 78 bytes
-rw-r--r--tests/files/good-2-v1-v1.lzbin0 -> 86 bytes
-rw-r--r--tests/files/unsupported-1-v234.lzbin0 -> 50 bytes
19 files changed, 98 insertions, 11 deletions
diff --git a/tests/files/README b/tests/files/README
index 3e550dfe..4aca0b11 100644
--- a/tests/files/README
+++ b/tests/files/README
@@ -4,25 +4,25 @@
0. Introduction
- This directory contains bunch of files to test handling of .xz
- and .lzma files in decoder implementations. Many of the files have
- been created by hand with a hex editor, thus there is no better
- "source code" than the files themselves. All the test files and
- this README have been put into the public domain.
+ This directory contains bunch of files to test handling of .xz,
+ .lzma (LZMA_Alone), and .lz (lzip) files in decoder implementations.
+ Many of the files have been created by hand with a hex editor, thus
+ there is no better "source code" than the files themselves. All the
+ test files and this README have been put into the public domain.
1. File Types
- Good files (good-*.xz, good-*.lzma) must decode successfully
- without requiring a lot of CPU time or RAM.
+ Good files (good-*) must decode successfully without requiring
+ a lot of CPU time or RAM.
- Unsupported files (unsupported-*.xz) are good files, but headers
+ Unsupported files (unsupported-*) are good files, but headers
indicate features not supported by the current file format
specification.
- Bad files (bad-*.xz, bad-*.lzma) must cause the decoder to give
- an error. Like with the good files, these files must not require
- a lot of CPU time or RAM before they get detected to be broken.
+ Bad files (bad-*) must cause the decoder to give an error. Like
+ with the good files, these files must not require a lot of CPU
+ time or RAM before they get detected to be broken.
2. Descriptions of Individual .xz Files
@@ -313,3 +313,90 @@
bad-too_small_size-without_eopm-3.lzma is like -1 above but instead
of a literal the problem occurs in the middle of a match.
+
+4. Descriptions of Individual .lz (lzip) Files
+
+4.1. Good Files
+
+ good-1-v0.lz contains a single version 0 member. lzip 1.17 and
+ *older* can decompress this; support for version 0 was removed
+ in lzip 1.18.
+
+ good-1-v0-trailing-1.lz is like good-1-v0.lz but contains
+ trailing data that the decompressor must ignore.
+
+ good-1-v1.lz contains a single version 1 member. lzip 1.3 and
+ newer can decompress this.
+
+ good-1-v1-trailing-1.lz is like good-1-v1.lz but contains
+ trailing data that the decompressor must ignore.
+
+ good-1-v1-trailing-2.lz is like good-1-v1.lz but contains
+ trailing data whose first three bytes match the .lz magic bytes.
+ With lzip >= 1.20 this file results in an error unless one uses
+ the command line option --loose-trailing. lzip 1.3 to 1.19 decode
+ this file successfully by default. XZ Utils uses the old behavior
+ because it allows lzma_code() to stop at the first byte of the
+ trailing data as long as the first byte isn't 0x4C (L in US-ASCII);
+ otherwise the first 1-3 bytes that equal to the magic bytes are
+ consumed and lost in lzma_code(), and this is visible in xz too:
+
+ $ ( xz -dc ; cat ) < good-1-v1-trailing-2.lz
+ Hello
+ World!
+ Trailing garbage
+
+ $ ( xz -dc --single-stream ; cat ) < good-1-v1-trailing-2.lz
+ Hello
+ World!
+ LZITrailing garbage
+
+ good-2-v0-v1.lz contains two members of which the first is
+ version 0 and the second version 1. lzip versions 1.3 to 1.17
+ (inclusive) can decompress this.
+
+ good-2-v1-v0.lz contains two members of which the first is
+ version 1 and the second version 0. lzip versions 1.3 to 1.17
+ (inclusive) can decompress this.
+
+ good-2-v1-v1.lz contains two version 1 members. lzip versions 1.3
+ and newer can decompress this.
+
+
+4.2. Unsupported Files
+
+ unsupported-1-v234.lz is like good-1-v1.lz except the version
+ field has been set to 234 (0xEA) which, as of writing, isn't
+ defined or supported by any .lz implementation.
+
+
+4.3. Bad Files
+
+ bad-1-v1-magic-1.lz is like good-1-v1.lz but the first magic byte
+ is wrong.
+
+ bad-1-v1-magic-2.lz is like good-1-v1.lz but the last (fourth)
+ magic byte is wrong.
+
+ bad-1-v1-dict-1.lz has too low value in the dictionary size field.
+
+ bad-1-v1-dict-2.lz has too high value in the dictionary size field.
+
+ bad-1-v1-crc32.lz has wrong CRC32 value.
+
+ bad-1-v0-uncomp-size.lz is version 0 format with incorrect value
+ in the uncompressed size field.
+
+ bad-1-v1-uncomp-size.lz is version 1 format with incorrect value
+ in the uncompressed size field.
+
+ bad-1-v1-member-size.lz has incorrect value in the member size
+ field.
+
+ bad-1-v1-trailing-magic.lz has the four .lz magic bytes as trailing
+ data. This should be detected as a truncated file and thus result
+ in an error. That is, the last four bytes of the file should not be
+ ignored as trailing garbage. lzip >= 1.18 matches this behavior
+ while older versions ignore the last four bytes and don't indicate
+ an error.
+
diff --git a/tests/files/bad-1-v0-uncomp-size.lz b/tests/files/bad-1-v0-uncomp-size.lz
new file mode 100644
index 00000000..6bf4c6c7
--- /dev/null
+++ b/tests/files/bad-1-v0-uncomp-size.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-crc32.lz b/tests/files/bad-1-v1-crc32.lz
new file mode 100644
index 00000000..3387618f
--- /dev/null
+++ b/tests/files/bad-1-v1-crc32.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-dict-1.lz b/tests/files/bad-1-v1-dict-1.lz
new file mode 100644
index 00000000..20768d5f
--- /dev/null
+++ b/tests/files/bad-1-v1-dict-1.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-dict-2.lz b/tests/files/bad-1-v1-dict-2.lz
new file mode 100644
index 00000000..1f22e6d8
--- /dev/null
+++ b/tests/files/bad-1-v1-dict-2.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-magic-1.lz b/tests/files/bad-1-v1-magic-1.lz
new file mode 100644
index 00000000..b5e374db
--- /dev/null
+++ b/tests/files/bad-1-v1-magic-1.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-magic-2.lz b/tests/files/bad-1-v1-magic-2.lz
new file mode 100644
index 00000000..f5d5b974
--- /dev/null
+++ b/tests/files/bad-1-v1-magic-2.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-member-size.lz b/tests/files/bad-1-v1-member-size.lz
new file mode 100644
index 00000000..fd8636ac
--- /dev/null
+++ b/tests/files/bad-1-v1-member-size.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-trailing-magic.lz b/tests/files/bad-1-v1-trailing-magic.lz
new file mode 100644
index 00000000..f7926c5b
--- /dev/null
+++ b/tests/files/bad-1-v1-trailing-magic.lz
Binary files differ
diff --git a/tests/files/bad-1-v1-uncomp-size.lz b/tests/files/bad-1-v1-uncomp-size.lz
new file mode 100644
index 00000000..c89a283f
--- /dev/null
+++ b/tests/files/bad-1-v1-uncomp-size.lz
Binary files differ
diff --git a/tests/files/good-1-v0-trailing-1.lz b/tests/files/good-1-v0-trailing-1.lz
new file mode 100644
index 00000000..91f2b64d
--- /dev/null
+++ b/tests/files/good-1-v0-trailing-1.lz
Binary files differ
diff --git a/tests/files/good-1-v0.lz b/tests/files/good-1-v0.lz
new file mode 100644
index 00000000..99e3f278
--- /dev/null
+++ b/tests/files/good-1-v0.lz
Binary files differ
diff --git a/tests/files/good-1-v1-trailing-1.lz b/tests/files/good-1-v1-trailing-1.lz
new file mode 100644
index 00000000..198e65ca
--- /dev/null
+++ b/tests/files/good-1-v1-trailing-1.lz
Binary files differ
diff --git a/tests/files/good-1-v1-trailing-2.lz b/tests/files/good-1-v1-trailing-2.lz
new file mode 100644
index 00000000..9a028fa6
--- /dev/null
+++ b/tests/files/good-1-v1-trailing-2.lz
Binary files differ
diff --git a/tests/files/good-1-v1.lz b/tests/files/good-1-v1.lz
new file mode 100644
index 00000000..4c9565c8
--- /dev/null
+++ b/tests/files/good-1-v1.lz
Binary files differ
diff --git a/tests/files/good-2-v0-v1.lz b/tests/files/good-2-v0-v1.lz
new file mode 100644
index 00000000..dc3165a0
--- /dev/null
+++ b/tests/files/good-2-v0-v1.lz
Binary files differ
diff --git a/tests/files/good-2-v1-v0.lz b/tests/files/good-2-v1-v0.lz
new file mode 100644
index 00000000..a999582c
--- /dev/null
+++ b/tests/files/good-2-v1-v0.lz
Binary files differ
diff --git a/tests/files/good-2-v1-v1.lz b/tests/files/good-2-v1-v1.lz
new file mode 100644
index 00000000..5381891b
--- /dev/null
+++ b/tests/files/good-2-v1-v1.lz
Binary files differ
diff --git a/tests/files/unsupported-1-v234.lz b/tests/files/unsupported-1-v234.lz
new file mode 100644
index 00000000..e571b0fa
--- /dev/null
+++ b/tests/files/unsupported-1-v234.lz
Binary files differ