diff options
author | Todd Short <tshort@akamai.com> | 2021-08-09 16:56:37 -0400 |
---|---|---|
committer | Todd Short <todd.short@me.com> | 2022-10-18 09:30:21 -0400 |
commit | caf9317d7d75213990014e07048384be15688889 (patch) | |
tree | 50cf59d363c17f389d6c8dbc2372795e3e53658d /test/bio_comp_test.c | |
parent | 12e96a23604a7aa1cd8f83486b02f1bcab6d468f (diff) |
Add ZSTD compression support (RFC8478bis)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18186)
Diffstat (limited to 'test/bio_comp_test.c')
-rw-r--r-- | test/bio_comp_test.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/test/bio_comp_test.c b/test/bio_comp_test.c index b148d02dd3..5e0888da7f 100644 --- a/test/bio_comp_test.c +++ b/test/bio_comp_test.c @@ -25,8 +25,8 @@ static int sizes[NUM_SIZES] = { 64, 512, 2048, 16 * 1024 }; /* using global buffers */ -uint8_t *original = NULL; -uint8_t *result = NULL; +unsigned char *original = NULL; +unsigned char *result = NULL; /* * For compression: @@ -62,8 +62,7 @@ static int do_bio_comp_test(const BIO_METHOD *meth, size_t size) BIO_push(bexp, bmem); rsize = BIO_read(bexp, result, size); - if (!TEST_int_eq(size, osize) - || !TEST_int_eq(size, rsize) + if (!TEST_int_eq(size, rsize) || !TEST_mem_eq(original, osize, result, rsize)) goto err; @@ -88,20 +87,20 @@ static int do_bio_comp(const BIO_METHOD *meth, int n) switch (type) { case 0: - test_printf_stdout("# zeros of size %d\n", size); + TEST_info("zeros of size %d\n", size); memset(original, 0, BUFFER_SIZE); break; case 1: - test_printf_stdout("# ones of size %d\n", size); - memset(original, 0, BUFFER_SIZE); + TEST_info("ones of size %d\n", size); + memset(original, 1, BUFFER_SIZE); break; case 2: - test_printf_stdout("# sequential of size %d\n", size); + TEST_info("sequential of size %d\n", size); for (i = 0; i < BUFFER_SIZE; i++) original[i] = i & 0xFF; break; case 3: - test_printf_stdout("# random of size %d\n", size); + TEST_info("random of size %d\n", size); if (!TEST_int_gt(RAND_bytes(original, BUFFER_SIZE), 0)) goto err; break; @@ -118,6 +117,12 @@ static int do_bio_comp(const BIO_METHOD *meth, int n) return success; } +#ifndef OPENSSL_NO_ZSTD +static int test_zstd(int n) +{ + return do_bio_comp(BIO_f_zstd(), n); +} +#endif #ifndef OPENSSL_NO_BROTLI static int test_brotli(int n) { @@ -139,5 +144,8 @@ int setup_tests(void) #ifndef OPENSSL_NO_BROTLI ADD_ALL_TESTS(test_brotli, NUM_SIZES * 4); #endif +#ifndef OPENSSL_NO_ZSTD + ADD_ALL_TESTS(test_zstd, NUM_SIZES * 4); +#endif return 1; } |