summaryrefslogtreecommitdiff
path: root/tests/libfstream
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-05-09 14:40:35 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-05-09 14:41:56 +0200
commitf64e2a3b0b701249b02adf2b389bae8576a3441b (patch)
treef228748175b639ee01b9182c506909d4b062c57e /tests/libfstream
parentcfa417a44111e1801b17aa0ab31fd0368794c034 (diff)
Add a test case for XZ stream concatenation
A modified version of the libfstream XZ stream uncompress test case is added that deliberately chops the compressed data up into two independend XZ streams to test the behaviour where the decompressor has to read across stream boundaries, like those resulting from parallel compression. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/libfstream')
-rw-r--r--tests/libfstream/Makemodule.am9
-rw-r--r--tests/libfstream/uncompress.c65
2 files changed, 71 insertions, 3 deletions
diff --git a/tests/libfstream/Makemodule.am b/tests/libfstream/Makemodule.am
index 9303a8a..d943686 100644
--- a/tests/libfstream/Makemodule.am
+++ b/tests/libfstream/Makemodule.am
@@ -13,6 +13,11 @@ test_xfrm_xz_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS)
test_xfrm_xz_LDADD += $(XZ_LIBS) $(ZSTD_LIBS)
test_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_XZ=1
+test_xfrm_xz2_SOURCES = tests/libfstream/uncompress.c tests/test.h
+test_xfrm_xz2_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS)
+test_xfrm_xz2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS)
+test_xfrm_xz2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_XZ=2
+
test_xfrm_gzip_SOURCES = tests/libfstream/uncompress.c tests/test.h
test_xfrm_gzip_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS)
test_xfrm_gzip_LDADD += $(XZ_LIBS) $(ZSTD_LIBS)
@@ -40,8 +45,8 @@ TESTS += test_xfrm_bzip2
endif
if WITH_XZ
-check_PROGRAMS += test_xfrm_xz
-TESTS += test_xfrm_xz
+check_PROGRAMS += test_xfrm_xz test_xfrm_xz2
+TESTS += test_xfrm_xz test_xfrm_xz2
endif
if WITH_GZIP
diff --git a/tests/libfstream/uncompress.c b/tests/libfstream/uncompress.c
index bd7df46..385af29 100644
--- a/tests/libfstream/uncompress.c
+++ b/tests/libfstream/uncompress.c
@@ -97,6 +97,69 @@ static sqfs_u8 data_in[] = {
0xbe, 0x03, 0x00, 0x00, 0xda, 0x2c, 0x45, 0x49,
0xa8, 0x00, 0x0a, 0xfc, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x59, 0x5a
+#elif defined(TEST_XZ2)
+ 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04,
+ 0xe6, 0xd6, 0xb4, 0x46, 0x02, 0x00, 0x21, 0x01,
+ 0x16, 0x00, 0x00, 0x00, 0x74, 0x2f, 0xe5, 0xa3,
+ 0xe0, 0x00, 0xdc, 0x00, 0xb3, 0x5d, 0x00, 0x26,
+ 0x1b, 0xca, 0x46, 0x67, 0x5a, 0xf2, 0x77, 0xb8,
+ 0x7d, 0x86, 0xd8, 0x41, 0xdb, 0x05, 0x35, 0xcd,
+ 0x83, 0xa5, 0x7c, 0x12, 0xa5, 0x05, 0xdb, 0x90,
+ 0xbd, 0x2f, 0x14, 0xd3, 0x71, 0x72, 0x96, 0xa8,
+ 0x8a, 0x7d, 0x84, 0x56, 0x71, 0x8d, 0x6a, 0x22,
+ 0x98, 0xab, 0x9e, 0x3d, 0xc3, 0x55, 0xef, 0xcc,
+ 0xa5, 0xc3, 0xdd, 0x5b, 0x8e, 0xbf, 0x03, 0x81,
+ 0x21, 0x40, 0xd6, 0x26, 0x91, 0x02, 0x45, 0x4e,
+ 0x20, 0x91, 0xcf, 0x8c, 0x51, 0x22, 0x02, 0x70,
+ 0xba, 0x05, 0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85,
+ 0x28, 0xf5, 0xf2, 0x21, 0x00, 0x00, 0x00, 0x00,
+ 0xc8, 0x80, 0x67, 0x40, 0xc3, 0xaa, 0x17, 0x57,
+ 0x00, 0x01, 0xd3, 0x01, 0xe1, 0x01, 0x00, 0x00,
+ 0x86, 0xdf, 0x9e, 0x05, 0xb1, 0xc4, 0x67, 0xfb,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a
#elif defined(TEST_GZIP)
0x1f, 0x8b, 0x08, 0x08, 0x82, 0xd4, 0x97, 0x60,
0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74,
@@ -187,7 +250,7 @@ static const char orig[] =
#if defined(TEST_BZIP2)
#define COMP_NAME "bzip2"
#define COMP_ID FSTREAM_COMPRESSOR_BZIP2
-#elif defined(TEST_XZ)
+#elif defined(TEST_XZ) || defined(TEST_XZ2)
#define COMP_NAME "xz"
#define COMP_ID FSTREAM_COMPRESSOR_XZ
#elif defined(TEST_GZIP)