From 79143208acdeb6dba61e609088ad3936c5361ea3 Mon Sep 17 00:00:00 2001 From: Greg Tucker Date: Wed, 28 Oct 2020 17:28:43 -0700 Subject: [PATCH] test: Add testing for new dictionary functions Change-Id: I0b0a151374acfe9b44c7a2be4bb959df59356d97 Signed-off-by: Greg Tucker --- igzip/igzip_rand_test.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/igzip/igzip_rand_test.c b/igzip/igzip_rand_test.c index 267066b..74195d6 100644 --- a/igzip/igzip_rand_test.c +++ b/igzip/igzip_rand_test.c @@ -1097,6 +1097,7 @@ int compress_multi_pass(uint8_t * data, uint32_t data_size, uint8_t * compressed uint32_t reset_test_flag = 0; uint8_t tmp_symbol; int no_mod = 0; + struct isal_dict dict_str; log_print("Starting Compress Multi Pass\n"); @@ -1147,8 +1148,14 @@ int compress_multi_pass(uint8_t * data, uint32_t data_size, uint8_t * compressed if (reset_test_flag) isal_deflate_reset(stream); - if (dict != NULL) - isal_deflate_set_dict(stream, dict, dict_len); + if (dict != NULL) { + if (rand() % 2 == 0) + isal_deflate_set_dict(stream, dict, dict_len); + else { + isal_deflate_process_dict(stream, &dict_str, dict, dict_len); + isal_deflate_reset_dict(stream, &dict_str); + } + } while (1) { loop_count++; @@ -1288,6 +1295,7 @@ int compress_single_pass(uint8_t * data, uint32_t data_size, uint8_t * compresse uint8_t *level_buf = NULL; struct isal_hufftables *huff_tmp; uint32_t reset_test_flag = 0; + struct isal_dict dict_str; log_print("Starting Compress Single Pass\n"); @@ -1335,8 +1343,14 @@ int compress_single_pass(uint8_t * data, uint32_t data_size, uint8_t * compresse if (reset_test_flag) isal_deflate_reset(&stream); - if (dict != NULL) - isal_deflate_set_dict(&stream, dict, dict_len); + if (dict != NULL) { + if (rand() % 2 == 0) + isal_deflate_set_dict(&stream, dict, dict_len); + else { + isal_deflate_process_dict(&stream, &dict_str, dict, dict_len); + isal_deflate_reset_dict(&stream, &dict_str); + } + } ret = isal_deflate_with_checks(&stream, data_size, *compressed_size, data, data_size,