From 7ee3c177dc58dfc15dc7208a17c8756c99f61429 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 4 Jun 2021 12:40:56 +0200 Subject: Add a test case for concatenated zstd streams Signed-off-by: David Oberhollenzer --- tests/libfstream/Makemodule.am | 9 +++++++-- tests/libfstream/uncompress.c | 44 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/tests/libfstream/Makemodule.am b/tests/libfstream/Makemodule.am index caf339f..65abfc7 100644 --- a/tests/libfstream/Makemodule.am +++ b/tests/libfstream/Makemodule.am @@ -33,6 +33,11 @@ test_xfrm_zstd_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_zstd_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_ZSTD=1 +test_xfrm_zstd2_SOURCES = tests/libfstream/uncompress.c tests/test.h +test_xfrm_zstd2_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) +test_xfrm_zstd2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) +test_xfrm_zstd2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_ZSTD2=1 + if WITH_OWN_ZLIB test_xfrm_bzip2_LDADD += libz.la test_xfrm_xz_LDADD += libz.la @@ -61,8 +66,8 @@ endif if WITH_ZSTD if HAVE_ZSTD_STREAM -check_PROGRAMS += test_xfrm_zstd -TESTS += test_xfrm_zstd +check_PROGRAMS += test_xfrm_zstd test_xfrm_zstd2 +TESTS += test_xfrm_zstd test_xfrm_zstd2 endif endif endif diff --git a/tests/libfstream/uncompress.c b/tests/libfstream/uncompress.c index 33a9c95..3e4679d 100644 --- a/tests/libfstream/uncompress.c +++ b/tests/libfstream/uncompress.c @@ -286,6 +286,48 @@ static sqfs_u8 data_in[] = { 0xcb, 0x0a, 0x0a, 0x69, 0x40, 0xba, 0xb0, 0xc4, 0x2a, 0x9b, 0x1e, 0x0a, 0x51, 0xa6, 0x16, 0x98, 0x76 +#elif defined(TEST_ZSTD2) + 0x28, 0xb5, 0x2f, 0xfd, 0x04, 0x58, 0x75, 0x04, + 0x00, 0xb2, 0x4c, 0x20, 0x17, 0xa0, 0x25, 0x69, + 0x03, 0xf0, 0xb2, 0x37, 0xb1, 0x5e, 0xb9, 0x24, + 0x56, 0x5b, 0x52, 0x22, 0x39, 0x01, 0x44, 0x2b, + 0x03, 0x55, 0xe3, 0x47, 0x03, 0x12, 0x9a, 0xe1, + 0xf0, 0x94, 0x0b, 0xe5, 0xe2, 0xba, 0x7e, 0xfe, + 0x9c, 0xc7, 0x61, 0x43, 0xc8, 0xfa, 0xf0, 0x3a, + 0xfa, 0x51, 0xaa, 0x50, 0xa6, 0x2d, 0x9a, 0x78, + 0xce, 0x2f, 0x61, 0x20, 0x6c, 0x7e, 0x35, 0x60, + 0xfb, 0xdd, 0x4c, 0x63, 0xfb, 0x95, 0x35, 0xc0, + 0x82, 0x59, 0xc2, 0xc9, 0x78, 0x6e, 0x30, 0xe6, + 0xd2, 0x72, 0x15, 0x14, 0x18, 0x62, 0x5d, 0xeb, + 0x2d, 0x9d, 0x3e, 0xee, 0x2e, 0x58, 0x58, 0xe9, + 0x40, 0x68, 0xb9, 0x2f, 0x23, 0x99, 0x2a, 0x4d, + 0xe8, 0x49, 0x79, 0x70, 0x1f, 0xf9, 0xe2, 0x34, + 0x2e, 0xab, 0xa5, 0xa3, 0xf2, 0x70, 0x98, 0xd0, + 0xb2, 0xb1, 0x3e, 0x5d, 0x90, 0x20, 0xd9, 0x36, + 0x8b, 0xdb, 0xaa, 0x20, 0x40, 0x03, 0x14, 0x06, + 0x03, 0x16, 0x2a, 0x9d, 0x31, 0xbd, 0x28, 0x3b, + 0x0c, 0xac, 0x41, + 0x28, 0xb5, 0x2f, 0xfd, 0x04, 0x58, 0xbd, 0x04, + 0x00, 0x62, 0xcd, 0x22, 0x19, 0xa0, 0x25, 0x69, + 0x03, 0x60, 0x72, 0xc9, 0x36, 0xda, 0xd2, 0x8b, + 0xfc, 0xbf, 0x25, 0x42, 0xa9, 0x82, 0x38, 0x70, + 0x1a, 0x2e, 0x54, 0x95, 0x33, 0x02, 0x03, 0x51, + 0x36, 0x51, 0x80, 0xcc, 0x7a, 0x6e, 0x52, 0x2e, + 0x75, 0x64, 0x2d, 0x33, 0x2c, 0xd6, 0xdb, 0xfc, + 0x39, 0x31, 0xd5, 0xa8, 0xa2, 0x40, 0xd7, 0x12, + 0x4c, 0xc6, 0x76, 0xdc, 0x1e, 0x0f, 0xf4, 0x4e, + 0x0a, 0xd3, 0x0c, 0x87, 0x67, 0x25, 0x25, 0x52, + 0x66, 0x87, 0x95, 0xc6, 0x69, 0x0c, 0xb4, 0x5e, + 0x1d, 0xe7, 0x5e, 0xcd, 0x47, 0x41, 0x80, 0x89, + 0x5c, 0xa5, 0x4a, 0x32, 0x26, 0xb3, 0x3d, 0x2b, + 0xd5, 0xc0, 0x16, 0xde, 0xfb, 0x65, 0xcd, 0x6a, + 0x0c, 0x3f, 0xe7, 0xd6, 0xb2, 0x17, 0x7c, 0x25, + 0x35, 0x6b, 0x58, 0xf0, 0x95, 0xb5, 0xf2, 0xe4, + 0x4e, 0xf0, 0x34, 0x4f, 0x5f, 0x39, 0xd1, 0x90, + 0xf8, 0xb9, 0x59, 0xbe, 0x2e, 0xf9, 0xd4, 0x02, + 0x98, 0x50, 0x5a, 0xc2, 0xcf, 0xe1, 0x08, 0x02, + 0x00, 0x0f, 0x1e, 0x44, 0x40, 0x79, 0x50, 0x67, + 0x3d, 0xd3, 0x35, 0x8f #endif }; @@ -306,7 +348,7 @@ static const char orig[] = #elif defined(TEST_GZIP) #define COMP_NAME "gzip" #define COMP_ID FSTREAM_COMPRESSOR_GZIP -#elif defined(TEST_ZSTD) +#elif defined(TEST_ZSTD) || defined(TEST_ZSTD2) #define COMP_NAME "zstd" #define COMP_ID FSTREAM_COMPRESSOR_ZSTD #endif -- cgit v1.2.3