From c1bda682fe831eab6e951e28fb4d9a0757231b55 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 4 Jun 2021 12:28:26 +0200 Subject: Add test case for Bzip2 stream concatenation, fix XZ test case Signed-off-by: David Oberhollenzer --- tests/libfstream/Makemodule.am | 11 ++++++--- tests/libfstream/uncompress.c | 52 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/tests/libfstream/Makemodule.am b/tests/libfstream/Makemodule.am index c3af095..caf339f 100644 --- a/tests/libfstream/Makemodule.am +++ b/tests/libfstream/Makemodule.am @@ -8,6 +8,11 @@ test_xfrm_bzip2_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_bzip2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_BZIP2=1 +test_xfrm_bzip22_SOURCES = tests/libfstream/uncompress.c tests/test.h +test_xfrm_bzip22_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) +test_xfrm_bzip22_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) +test_xfrm_bzip22_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_BZIP22=1 + test_xfrm_xz_SOURCES = tests/libfstream/uncompress.c tests/test.h test_xfrm_xz_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_xz_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) @@ -16,7 +21,7 @@ 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_xz2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_XZ2=1 test_xfrm_gzip_SOURCES = tests/libfstream/uncompress.c tests/test.h test_xfrm_gzip_LDADD = libfstream.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) @@ -40,8 +45,8 @@ check_PROGRAMS += test_get_line TESTS += test_get_line if WITH_BZIP2 -check_PROGRAMS += test_xfrm_bzip2 -TESTS += test_xfrm_bzip2 +check_PROGRAMS += test_xfrm_bzip2 test_xfrm_bzip22 +TESTS += test_xfrm_bzip2 test_xfrm_bzip22 endif if WITH_XZ diff --git a/tests/libfstream/uncompress.c b/tests/libfstream/uncompress.c index 385af29..33a9c95 100644 --- a/tests/libfstream/uncompress.c +++ b/tests/libfstream/uncompress.c @@ -48,6 +48,56 @@ static sqfs_u8 data_in[] = { 0x65, 0xc3, 0x23, 0x45, 0xec, 0x7f, 0x8b, 0xb9, 0x22, 0x9c, 0x28, 0x48, 0x02, 0x92, 0x14, 0x02, 0x00, +#elif defined(TEST_BZIP22) + 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, + 0x53, 0x59, 0x5d, 0x09, 0x24, 0x1d, 0x00, 0x00, + 0x13, 0xd7, 0x80, 0x00, 0x10, 0x40, 0x05, 0x00, + 0x04, 0x02, 0x00, 0x3e, 0xa7, 0xff, 0x40, 0x30, + 0x00, 0xac, 0x43, 0x54, 0xf5, 0x36, 0x4c, 0xa7, + 0xa8, 0xd3, 0x6a, 0x60, 0x81, 0x40, 0x00, 0xd0, + 0x32, 0x64, 0x0d, 0x53, 0xda, 0x02, 0x09, 0xa2, + 0x68, 0x34, 0xd1, 0x27, 0x4a, 0xdd, 0xf2, 0x0a, + 0x73, 0x43, 0xf9, 0xa2, 0x51, 0x85, 0x76, 0x45, + 0x9a, 0x68, 0x3a, 0xe7, 0x0d, 0xc0, 0x21, 0x4a, + 0xc4, 0xf9, 0xf7, 0x40, 0xc3, 0x10, 0xb2, 0x9b, + 0x58, 0x56, 0x71, 0x50, 0x2f, 0xa4, 0xc5, 0x61, + 0x19, 0xf6, 0x59, 0x06, 0x82, 0x03, 0x7f, 0xeb, + 0xd2, 0x61, 0x88, 0xcd, 0xe8, 0xf7, 0xe8, 0x87, + 0x59, 0x9d, 0xe1, 0xf8, 0x19, 0x6e, 0xad, 0x77, + 0xbf, 0x34, 0x17, 0x21, 0x6b, 0x91, 0xc9, 0x52, + 0xd0, 0x81, 0x1e, 0xb5, 0x0b, 0xee, 0x42, 0x84, + 0x80, 0xd5, 0xa1, 0x8a, 0x04, 0x18, 0x4d, 0xf3, + 0xda, 0x7e, 0x3c, 0x40, 0xa4, 0xdb, 0xe5, 0xf0, + 0x37, 0x40, 0x3a, 0x7d, 0xa7, 0x45, 0x21, 0xf2, + 0x5a, 0x7b, 0x59, 0x56, 0x16, 0xd5, 0xac, 0x9f, + 0x60, 0x85, 0x0e, 0xf5, 0x73, 0xd9, 0x47, 0xe2, + 0xee, 0x48, 0xa7, 0x0a, 0x12, 0x0b, 0xa1, 0x24, + 0x83, 0xa0, + 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, + 0x53, 0x59, 0x2c, 0x24, 0x39, 0xa0, 0x00, 0x00, + 0x1f, 0x55, 0x80, 0x00, 0x10, 0x40, 0x05, 0x06, + 0x00, 0x3f, 0xe7, 0xff, 0x40, 0x30, 0x00, 0xb5, + 0x91, 0x13, 0x4f, 0x54, 0x7a, 0x6a, 0x6d, 0x4d, + 0xa2, 0x68, 0x0c, 0x84, 0x53, 0xf5, 0x30, 0x89, + 0xa3, 0xd4, 0x0d, 0x0f, 0x49, 0xa0, 0xd4, 0xf4, + 0xd1, 0x53, 0xf4, 0x93, 0x69, 0x3c, 0x81, 0x1a, + 0x65, 0x53, 0x90, 0x51, 0x07, 0x2a, 0xad, 0x8f, + 0x63, 0xba, 0x25, 0xc2, 0x0c, 0x8b, 0xb9, 0x95, + 0x15, 0xd8, 0xda, 0x61, 0x5c, 0xa9, 0xe4, 0x0b, + 0x21, 0xc9, 0x97, 0x57, 0x01, 0x28, 0x9b, 0xfb, + 0x94, 0xb9, 0x48, 0xa3, 0x0a, 0xc6, 0x1c, 0x54, + 0x98, 0x9a, 0x39, 0xc3, 0x87, 0x90, 0x33, 0x58, + 0x2d, 0x3e, 0x16, 0xb1, 0xae, 0x26, 0x89, 0x75, + 0xf5, 0x77, 0xa5, 0x8e, 0x5b, 0x8c, 0x8a, 0x39, + 0xbd, 0x75, 0x21, 0x9d, 0x99, 0x18, 0x4a, 0x91, + 0xab, 0xbc, 0x08, 0x87, 0xa4, 0xf1, 0x81, 0xb5, + 0xb4, 0xb0, 0xfe, 0x6b, 0x9f, 0xbe, 0x19, 0x82, + 0xd1, 0x50, 0xe1, 0x5e, 0x13, 0xb5, 0xc6, 0x2c, + 0xa4, 0x82, 0xf2, 0x5c, 0xc3, 0x20, 0x41, 0x13, + 0x56, 0x63, 0x3d, 0xec, 0x71, 0x2a, 0xbf, 0x2c, + 0x60, 0x2f, 0x7a, 0x4d, 0xcb, 0x3f, 0x8b, 0xb9, + 0x22, 0x9c, 0x28, 0x48, 0x16, 0x12, 0x1c, 0xd0, + 0x00, #elif defined(TEST_XZ) 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x00, 0xff, 0x12, 0xd9, 0x41, 0x02, 0x00, 0x21, 0x01, @@ -247,7 +297,7 @@ static const char orig[] = "cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n" "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n"; -#if defined(TEST_BZIP2) +#if defined(TEST_BZIP2) || defined(TEST_BZIP22) #define COMP_NAME "bzip2" #define COMP_ID FSTREAM_COMPRESSOR_BZIP2 #elif defined(TEST_XZ) || defined(TEST_XZ2) -- cgit v1.2.3