summaryrefslogtreecommitdiff
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
parent731db13e6fa3ad3e3fc786c0ccf6eac4cce6865f (diff)
downloadxz-c8f70ebb4628ceb6cb29cc9195d9deadf69d2bd7.tar.gz
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 3e550df..4aca0b1 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 0000000..6bf4c6c
--- /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 0000000..3387618
--- /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 0000000..20768d5
--- /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 0000000..1f22e6d
--- /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 0000000..b5e374d
--- /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 0000000..f5d5b97
--- /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 0000000..fd8636a
--- /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 0000000..f7926c5
--- /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 0000000..c89a283
--- /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 0000000..91f2b64
--- /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 0000000..99e3f27
--- /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 0000000..198e65c
--- /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 0000000..9a028fa
--- /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 0000000..4c9565c
--- /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 0000000..dc3165a
--- /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 0000000..a999582
--- /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 0000000..5381891
--- /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 0000000..e571b0f
--- /dev/null
+++ b/tests/files/unsupported-1-v234.lz
Binary files differ