mirror of
https://github.com/intel/isa-l.git
synced 2025-11-04 20:30:59 +01:00
igzip: Modify igzip_rand_test to optionally use getopt
Change-Id: I8ad8e7f18f292b54158f1cda2eef9aec3919d175 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
@@ -185,7 +185,7 @@ AC_TYPE_UINT8_T
|
|||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_MALLOC # Used only in tests
|
AC_FUNC_MALLOC # Used only in tests
|
||||||
AC_CHECK_FUNCS([memmove memset])
|
AC_CHECK_FUNCS([memmove memset getopt])
|
||||||
|
|
||||||
my_CFLAGS="\
|
my_CFLAGS="\
|
||||||
-Wall \
|
-Wall \
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include "igzip_lib.h"
|
#include "igzip_lib.h"
|
||||||
#include "checksum_test_ref.h"
|
#include "checksum_test_ref.h"
|
||||||
#include "inflate_std_vects.h"
|
#include "inflate_std_vects.h"
|
||||||
@@ -39,6 +40,10 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "unaligned.h"
|
#include "unaligned.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_GETOPT
|
||||||
|
#include <getopt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef RANDOMS
|
#ifndef RANDOMS
|
||||||
# define RANDOMS 0x40
|
# define RANDOMS 0x40
|
||||||
#endif
|
#endif
|
||||||
@@ -121,6 +126,72 @@ struct isal_hufftables *hufftables_subset = NULL;
|
|||||||
#define MIN_LENGTH 3
|
#define MIN_LENGTH 3
|
||||||
#define MIN_DIST 1
|
#define MIN_DIST 1
|
||||||
|
|
||||||
|
struct test_options {
|
||||||
|
int test_seed;
|
||||||
|
int randoms;
|
||||||
|
int do_large_test;
|
||||||
|
int verbose;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct test_options options;
|
||||||
|
|
||||||
|
void init_options(void)
|
||||||
|
{
|
||||||
|
options.test_seed = TEST_SEED;
|
||||||
|
options.randoms = RANDOMS;
|
||||||
|
options.do_large_test = 1;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
options.verbose = 1;
|
||||||
|
#else
|
||||||
|
options.verbose = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Usage: igzip_rand_test [options] [FILES]\n"
|
||||||
|
" -h help, print this message\n"
|
||||||
|
" -l turn off large input test\n"
|
||||||
|
" -r <iter> number of randoms for each test\n"
|
||||||
|
" -s <seed> set rand() test seed\n"
|
||||||
|
" -v enable verbose test log\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t parse_options(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
init_options();
|
||||||
|
#ifdef HAVE_GETOPT
|
||||||
|
int c;
|
||||||
|
char optstring[] = "hlr:s:v";
|
||||||
|
while ((c = getopt(argc, argv, optstring)) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'l':
|
||||||
|
options.do_large_test = 0;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
options.randoms = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
options.test_seed = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
options.verbose = 1;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return optind;
|
||||||
|
#else
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Create random compressible data. This is achieved by randomly choosing a
|
/* Create random compressible data. This is achieved by randomly choosing a
|
||||||
* random character, or to repeat previous data in the stream for a random
|
* random character, or to repeat previous data in the stream for a random
|
||||||
* length and look back distance. The probability of a random character or a
|
* length and look back distance. The probability of a random character or a
|
||||||
@@ -373,6 +444,29 @@ void print_uint8_t(uint8_t * array, uint64_t length)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void log_print(char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
|
||||||
|
if (options.verbose)
|
||||||
|
vfprintf(stdout, format, args);
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_uint8_t(uint8_t * array, uint64_t length)
|
||||||
|
{
|
||||||
|
if (options.verbose)
|
||||||
|
print_uint8_t(array, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_error(int error_code)
|
||||||
|
{
|
||||||
|
if (options.verbose)
|
||||||
|
print_error(error_code);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t check_gzip_trl(uint64_t gzip_trl, uint32_t inflate_crc, uint8_t * uncompress_buf,
|
uint32_t check_gzip_trl(uint64_t gzip_trl, uint32_t inflate_crc, uint8_t * uncompress_buf,
|
||||||
uint32_t uncompress_len)
|
uint32_t uncompress_len)
|
||||||
{
|
{
|
||||||
@@ -654,31 +748,28 @@ int inflate_multi_pass(uint8_t * compress_buf, uint64_t compress_len,
|
|||||||
state->next_out = uncomp_tmp;
|
state->next_out = uncomp_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("Pre inflate\n");
|
log_print("Pre inflate\n");
|
||||||
printf
|
log_print
|
||||||
("compressed_size = 0x%05lx, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x\n",
|
("compressed_size = 0x%05lx, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x\n",
|
||||||
compress_len, comp_processed, comp_tmp_size, state->avail_in);
|
compress_len, comp_processed, comp_tmp_size, state->avail_in);
|
||||||
printf
|
log_print
|
||||||
("data_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
("data_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
||||||
*uncompress_len, uncomp_processed, uncomp_tmp_size, state->avail_out,
|
*uncompress_len, uncomp_processed, uncomp_tmp_size, state->avail_out,
|
||||||
state->total_out);
|
state->total_out);
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = isal_inflate_with_checks(state, compress_len, *uncompress_len, comp_tmp,
|
ret = isal_inflate_with_checks(state, compress_len, *uncompress_len, comp_tmp,
|
||||||
comp_tmp_size, comp_processed, uncomp_tmp,
|
comp_tmp_size, comp_processed, uncomp_tmp,
|
||||||
uncomp_tmp_size, uncomp_processed);
|
uncomp_tmp_size, uncomp_processed);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Post inflate\n");
|
||||||
printf("Post inflate\n");
|
log_print
|
||||||
printf
|
|
||||||
("compressed_size = 0x%05lx, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x\n",
|
("compressed_size = 0x%05lx, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x\n",
|
||||||
compress_len, comp_processed, comp_tmp_size, state->avail_in);
|
compress_len, comp_processed, comp_tmp_size, state->avail_in);
|
||||||
printf
|
log_print
|
||||||
("data_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
("data_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
||||||
*uncompress_len, uncomp_processed, uncomp_tmp_size, state->avail_out,
|
*uncompress_len, uncomp_processed, uncomp_tmp_size, state->avail_out,
|
||||||
state->total_out);
|
state->total_out);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (state->block_state == ISAL_BLOCK_FINISH || ret != 0) {
|
if (state->block_state == ISAL_BLOCK_FINISH || ret != 0) {
|
||||||
memcpy(uncompress_buf + uncomp_processed, uncomp_tmp, uncomp_tmp_size);
|
memcpy(uncompress_buf + uncomp_processed, uncomp_tmp, uncomp_tmp_size);
|
||||||
@@ -797,18 +888,17 @@ int inflate_check(uint8_t * z_buf, uint32_t z_size, uint8_t * in_buf, uint32_t i
|
|||||||
if (test_buf != NULL)
|
if (test_buf != NULL)
|
||||||
mem_result = memcmp(in_buf, test_buf, in_size);
|
mem_result = memcmp(in_buf, test_buf, in_size);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
if (options.verbose && mem_result) {
|
||||||
int i;
|
int i;
|
||||||
if (mem_result)
|
|
||||||
for (i = 0; i < in_size; i++) {
|
for (i = 0; i < in_size; i++) {
|
||||||
if (in_buf[i] != test_buf[i]) {
|
if (in_buf[i] != test_buf[i]) {
|
||||||
printf
|
log_print
|
||||||
("First incorrect data at 0x%x of 0x%x, 0x%x != 0x%x\n",
|
("First incorrect data at 0x%x of 0x%x, 0x%x != 0x%x\n", i,
|
||||||
i, in_size, in_buf[i], test_buf[i]);
|
in_size, in_buf[i], test_buf[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (test_buf != NULL)
|
if (test_buf != NULL)
|
||||||
free(test_buf);
|
free(test_buf);
|
||||||
@@ -932,28 +1022,24 @@ int isal_deflate_with_checks(struct isal_zstream *stream, uint32_t data_size,
|
|||||||
int ret, stream_check;
|
int ret, stream_check;
|
||||||
struct isal_zstate *state = &stream->internal_state;
|
struct isal_zstate *state = &stream->internal_state;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Pre compression\n");
|
||||||
printf("Pre compression\n");
|
log_print
|
||||||
printf
|
|
||||||
("data_size = 0x%05x, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x, total_in = 0x%05x\n",
|
("data_size = 0x%05x, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x, total_in = 0x%05x\n",
|
||||||
data_size, in_processed, in_size, stream->avail_in, stream->total_in);
|
data_size, in_processed, in_size, stream->avail_in, stream->total_in);
|
||||||
printf
|
log_print
|
||||||
("compressed_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
("compressed_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
||||||
compressed_size, out_processed, out_size, stream->avail_out, stream->total_out);
|
compressed_size, out_processed, out_size, stream->avail_out, stream->total_out);
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = isal_deflate(stream);
|
ret = isal_deflate(stream);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Post compression\n");
|
||||||
printf("Post compression\n");
|
log_print
|
||||||
printf
|
|
||||||
("data_size = 0x%05x, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x, total_in = 0x%05x\n",
|
("data_size = 0x%05x, in_processed = 0x%05x, in_size = 0x%05x, avail_in = 0x%05x, total_in = 0x%05x\n",
|
||||||
data_size, in_processed, in_size, stream->avail_in, stream->total_in);
|
data_size, in_processed, in_size, stream->avail_in, stream->total_in);
|
||||||
printf
|
log_print
|
||||||
("compressed_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
("compressed_size = 0x%05x, out_processed = 0x%05x, out_size = 0x%05x, avail_out = 0x%05x, total_out = 0x%05x\n",
|
||||||
compressed_size, out_processed, out_size, stream->avail_out, stream->total_out);
|
compressed_size, out_processed, out_size, stream->avail_out, stream->total_out);
|
||||||
printf("\n\n");
|
log_print("\n\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Verify the stream is in a valid state */
|
/* Verify the stream is in a valid state */
|
||||||
stream_check = stream_valid_check(stream, in_buf, in_size, out_buf, out_size,
|
stream_check = stream_valid_check(stream, in_buf, in_size, out_buf, out_size,
|
||||||
@@ -1012,9 +1098,7 @@ int compress_multi_pass(uint8_t * data, uint32_t data_size, uint8_t * compressed
|
|||||||
uint8_t tmp_symbol;
|
uint8_t tmp_symbol;
|
||||||
int no_mod = 0;
|
int no_mod = 0;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Compress Multi Pass\n");
|
||||||
printf("Starting Compress Multi Pass\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
stream = malloc(sizeof(*stream));
|
stream = malloc(sizeof(*stream));
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
@@ -1104,12 +1188,10 @@ int compress_multi_pass(uint8_t * data, uint32_t data_size, uint8_t * compressed
|
|||||||
if (rand() % 4 == 0 && !no_mod) {
|
if (rand() % 4 == 0 && !no_mod) {
|
||||||
|
|
||||||
tmp_symbol = rand();
|
tmp_symbol = rand();
|
||||||
#ifdef VERBOSE
|
log_print
|
||||||
printf
|
|
||||||
("Modifying data at index 0x%x from 0x%x to 0x%x before recalling isal_deflate\n",
|
("Modifying data at index 0x%x from 0x%x to 0x%x before recalling isal_deflate\n",
|
||||||
in_processed - stream->avail_in,
|
in_processed - stream->avail_in,
|
||||||
data[in_processed - stream->avail_in], tmp_symbol);
|
data[in_processed - stream->avail_in], tmp_symbol);
|
||||||
#endif
|
|
||||||
*stream->next_in = tmp_symbol;
|
*stream->next_in = tmp_symbol;
|
||||||
data[in_processed - stream->avail_in] = tmp_symbol;
|
data[in_processed - stream->avail_in] = tmp_symbol;
|
||||||
}
|
}
|
||||||
@@ -1207,9 +1289,7 @@ int compress_single_pass(uint8_t * data, uint32_t data_size, uint8_t * compresse
|
|||||||
struct isal_hufftables *huff_tmp;
|
struct isal_hufftables *huff_tmp;
|
||||||
uint32_t reset_test_flag = 0;
|
uint32_t reset_test_flag = 0;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Compress Single Pass\n");
|
||||||
printf("Starting Compress Single Pass\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
||||||
|
|
||||||
@@ -1294,9 +1374,8 @@ int compress_ver_rep_buf(uint8_t * data, uint32_t data_size, uint64_t data_rep_s
|
|||||||
uint32_t out_size, cmp_size;
|
uint32_t out_size, cmp_size;
|
||||||
uint32_t avail_out_start;
|
uint32_t avail_out_start;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Compress and Verify Repeated Buffer\n");
|
||||||
printf("Starting Compress and Verify Repeated Buffer\n");
|
|
||||||
#endif
|
|
||||||
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
||||||
|
|
||||||
/* Setup compression stream */
|
/* Setup compression stream */
|
||||||
@@ -1517,9 +1596,7 @@ int compress_stateless_full_flush(uint8_t * data, uint32_t data_size, uint8_t *
|
|||||||
struct isal_hufftables *huff_tmp;
|
struct isal_hufftables *huff_tmp;
|
||||||
uint32_t reset_test_flag = 0;
|
uint32_t reset_test_flag = 0;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Stateless Compress Full Flush\n");
|
||||||
printf("Starting Stateless Compress Full Flush\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
||||||
|
|
||||||
@@ -1660,9 +1737,7 @@ int compress_full_flush(uint8_t * data, uint32_t data_size, uint8_t * compressed
|
|||||||
struct isal_hufftables *huff_tmp;
|
struct isal_hufftables *huff_tmp;
|
||||||
uint32_t reset_test_flag = 0;
|
uint32_t reset_test_flag = 0;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Compress Full Flush\n");
|
||||||
printf("Starting Compress Full Flush\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
create_rand_repeat_data((uint8_t *) & stream, sizeof(stream));
|
||||||
|
|
||||||
@@ -1799,9 +1874,7 @@ int compress_swap_flush(uint8_t * data, uint32_t data_size, uint8_t * compressed
|
|||||||
uint32_t level_buf_size;
|
uint32_t level_buf_size;
|
||||||
uint8_t *level_buf = NULL;
|
uint8_t *level_buf = NULL;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
log_print("Starting Compress Swap Flush\n");
|
||||||
printf("Starting Compress Swap Flush\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
isal_deflate_init(&stream);
|
isal_deflate_init(&stream);
|
||||||
|
|
||||||
@@ -1946,17 +2019,16 @@ int test_compress_stateless(uint8_t * in_data, uint32_t in_size, uint32_t flush_
|
|||||||
inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0,
|
inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0,
|
||||||
hist_bits);
|
hist_bits);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
if (options.verbose && ret) {
|
||||||
if (ret) {
|
log_print
|
||||||
printf
|
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and window bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and window bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (z_buf != NULL) {
|
if (z_buf != NULL) {
|
||||||
free(z_buf);
|
free(z_buf);
|
||||||
z_buf = NULL;
|
z_buf = NULL;
|
||||||
@@ -1997,17 +2069,15 @@ int test_compress_stateless(uint8_t * in_data, uint32_t in_size, uint32_t flush_
|
|||||||
ret =
|
ret =
|
||||||
inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0,
|
inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0,
|
||||||
hist_bits);
|
hist_bits);
|
||||||
#ifdef VERBOSE
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf
|
log_print
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
free(z_buf);
|
free(z_buf);
|
||||||
@@ -2036,21 +2106,20 @@ int test_compress_stateless(uint8_t * in_data, uint32_t in_size, uint32_t flush_
|
|||||||
NULL, 0, hist_bits);
|
NULL, 0, hist_bits);
|
||||||
|
|
||||||
if (overflow != 0 || ret != 0) {
|
if (overflow != 0 || ret != 0) {
|
||||||
#ifdef VERBOSE
|
log_print("overflow error = %d\n", overflow);
|
||||||
printf("overflow error = %d\n", overflow);
|
log_error(overflow);
|
||||||
print_error(overflow);
|
log_print("inflate ret = %d\n", ret);
|
||||||
printf("inflate ret = %d\n", ret);
|
log_error(ret);
|
||||||
print_error(overflow);
|
|
||||||
|
|
||||||
printf
|
log_print
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
|
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on compress single pass overflow\n");
|
printf("Failed on compress single pass overflow\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
ret = OVERFLOW_TEST_ERROR;
|
ret = OVERFLOW_TEST_ERROR;
|
||||||
@@ -2094,17 +2163,16 @@ int test_compress_stateless(uint8_t * in_data, uint32_t in_size, uint32_t flush_
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
#ifdef VERBOSE
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf
|
log_print
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, FULL_FLUSH, hist_bits);
|
level, gzip_flag, FULL_FLUSH, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (z_buf != NULL)
|
if (z_buf != NULL)
|
||||||
free(z_buf);
|
free(z_buf);
|
||||||
@@ -2174,20 +2242,19 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type)
|
|||||||
hist_bits);
|
hist_bits);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#ifdef VERBOSE
|
log_print
|
||||||
printf
|
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
if (dict != NULL) {
|
if (dict != NULL) {
|
||||||
printf("Using Dictionary: ");
|
log_print("Using Dictionary: ");
|
||||||
print_uint8_t(dict, dict_len);
|
log_uint8_t(dict, dict_len);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
}
|
}
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on compress single pass\n");
|
printf("Failed on compress single pass\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
}
|
}
|
||||||
@@ -2226,20 +2293,19 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type)
|
|||||||
hist_bits);
|
hist_bits);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#ifdef VERBOSE
|
log_print
|
||||||
printf
|
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
if (dict != NULL) {
|
if (dict != NULL) {
|
||||||
printf("Using Dictionary: ");
|
log_print("Using Dictionary: ");
|
||||||
print_uint8_t(dict, dict_len);
|
log_uint8_t(dict, dict_len);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
}
|
}
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on compress multi pass\n");
|
printf("Failed on compress multi pass\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
}
|
}
|
||||||
@@ -2276,20 +2342,19 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type)
|
|||||||
* better than the initial run. This is to stop that
|
* better than the initial run. This is to stop that
|
||||||
* case from erroring. */
|
* case from erroring. */
|
||||||
if (overflow != 0 || ret != 0) {
|
if (overflow != 0 || ret != 0) {
|
||||||
#ifdef VERBOSE
|
log_print("overflow error = %d\n", overflow);
|
||||||
printf("overflow error = %d\n", overflow);
|
log_error(overflow);
|
||||||
print_error(overflow);
|
log_print("inflate ret = %d\n", ret);
|
||||||
printf("inflate ret = %d\n", ret);
|
log_error(ret);
|
||||||
print_error(ret);
|
|
||||||
|
|
||||||
printf
|
log_print
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on compress single pass overflow\n");
|
printf("Failed on compress single pass overflow\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
ret = OVERFLOW_TEST_ERROR;
|
ret = OVERFLOW_TEST_ERROR;
|
||||||
@@ -2317,19 +2382,18 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type)
|
|||||||
* better than the initial run. This is to stop that
|
* better than the initial run. This is to stop that
|
||||||
* case from erroring */
|
* case from erroring */
|
||||||
if (overflow != 0 || ret != 0) {
|
if (overflow != 0 || ret != 0) {
|
||||||
#ifdef VERBOSE
|
log_print("overflow error = %d\n", overflow);
|
||||||
printf("overflow error = %d\n", overflow);
|
log_error(overflow);
|
||||||
print_error(overflow);
|
log_print("inflate ret = %d\n", ret);
|
||||||
printf("inflate ret = %d\n", ret);
|
log_error(ret);
|
||||||
print_error(ret);
|
log_print
|
||||||
printf
|
|
||||||
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
("Compressed array at level %d with gzip flag %d, flush type %d, and hist_bits %d: ",
|
||||||
level, gzip_flag, flush_type, hist_bits);
|
level, gzip_flag, flush_type, hist_bits);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on compress multi pass overflow\n");
|
printf("Failed on compress multi pass overflow\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
ret = OVERFLOW_TEST_ERROR;
|
ret = OVERFLOW_TEST_ERROR;
|
||||||
@@ -2398,13 +2462,13 @@ int test_flush(uint8_t * in_buf, uint32_t in_size)
|
|||||||
ret = inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0, 0);
|
ret = inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0, 0);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#ifdef VERBOSE
|
log_print("Compressed array at level %d with gzip flag %d: ", level,
|
||||||
printf("Compressed array at level %d with gzip flag %d: ", level, gzip_flag);
|
gzip_flag);
|
||||||
print_uint8_t(z_buf, z_size);
|
log_uint8_t(z_buf, z_size);
|
||||||
printf("\n");
|
log_print("\n");
|
||||||
printf("Data: ");
|
log_print("Data: ");
|
||||||
print_uint8_t(in_buf, in_size);
|
log_uint8_t(in_buf, in_size);
|
||||||
#endif
|
|
||||||
printf("Failed on swapping flush type\n");
|
printf("Failed on swapping flush type\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
}
|
}
|
||||||
@@ -2449,15 +2513,13 @@ int test_full_flush(uint8_t * in_buf, uint32_t in_size)
|
|||||||
ret = inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0, 0);
|
ret = inflate_check(z_buf, z_size, in_buf, in_size, gzip_flag, NULL, 0, 0);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#ifdef VERBOSE
|
log_print("Compressed array at level %d with gzip flag %d and flush type %d: ",
|
||||||
printf
|
level, gzip_flag, FULL_FLUSH);
|
||||||
("Compressed array at level %d with gzip flag %d and flush type %d: ",
|
log_uint8_t(z_buf, z_size);
|
||||||
level, gzip_flag, FULL_FLUSH);
|
log_print("\n");
|
||||||
print_uint8_t(z_buf, z_size);
|
log_print("Data: ");
|
||||||
printf("\n");
|
log_uint8_t(in_buf, in_size);
|
||||||
printf("Data: ");
|
|
||||||
print_uint8_t(in_buf, in_size);
|
|
||||||
#endif
|
|
||||||
printf("Failed on compress multi pass\n");
|
printf("Failed on compress multi pass\n");
|
||||||
print_error(ret);
|
print_error(ret);
|
||||||
}
|
}
|
||||||
@@ -2608,7 +2670,8 @@ int test_compress_file(char *file_name)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int argc, char *argv[])
|
int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int file_count,
|
||||||
|
char *files[])
|
||||||
{
|
{
|
||||||
long int file_length;
|
long int file_length;
|
||||||
uint8_t *stream = NULL;
|
uint8_t *stream = NULL;
|
||||||
@@ -2617,9 +2680,9 @@ int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int argc
|
|||||||
|
|
||||||
memset(&histogram, 0, sizeof(histogram));
|
memset(&histogram, 0, sizeof(histogram));
|
||||||
|
|
||||||
while (argc > 1) {
|
for (int i = 0; i < file_count; i++) {
|
||||||
printf("Processing %s\n", argv[argc - 1]);
|
printf("Processing %s\n", files[i]);
|
||||||
file = fopen(argv[argc - 1], "r");
|
file = fopen(files[i], "r");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
printf("Error opening file\n");
|
printf("Error opening file\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -2657,7 +2720,6 @@ int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int argc
|
|||||||
free(stream);
|
free(stream);
|
||||||
stream = NULL;
|
stream = NULL;
|
||||||
}
|
}
|
||||||
argc--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isal_create_hufftables(hufftables_custom, &histogram);
|
return isal_create_hufftables(hufftables_custom, &histogram);
|
||||||
@@ -2671,19 +2733,26 @@ int main(int argc, char *argv[])
|
|||||||
uint8_t *in_buf;
|
uint8_t *in_buf;
|
||||||
struct isal_hufftables hufftables_custom, hufftables_sub;
|
struct isal_hufftables hufftables_custom, hufftables_sub;
|
||||||
uint64_t iterations, large_buf_size;
|
uint64_t iterations, large_buf_size;
|
||||||
|
size_t argv_index;
|
||||||
|
char **input_files;
|
||||||
|
size_t file_count;
|
||||||
|
|
||||||
#ifndef VERBOSE
|
argv_index = parse_options(argc, argv);
|
||||||
setbuf(stdout, NULL);
|
|
||||||
#endif
|
input_files = &argv[argv_index];
|
||||||
|
file_count = argc - argv_index;
|
||||||
|
|
||||||
|
if (options.verbose)
|
||||||
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
||||||
printf("Test Seed : %d\n", TEST_SEED);
|
printf("Test Seed : %d\n", options.test_seed);
|
||||||
printf("Randoms : %d\n", RANDOMS);
|
printf("Randoms : %d\n", options.randoms);
|
||||||
srand(TEST_SEED);
|
srand(options.test_seed);
|
||||||
|
|
||||||
hufftables_subset = &hufftables_sub;
|
hufftables_subset = &hufftables_sub;
|
||||||
if (argc > 1) {
|
if (file_count > 0) {
|
||||||
ret = create_custom_hufftables(&hufftables_custom, argc, argv);
|
ret = create_custom_hufftables(&hufftables_custom, file_count, input_files);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
hufftables = &hufftables_custom;
|
hufftables = &hufftables_custom;
|
||||||
else {
|
else {
|
||||||
@@ -2700,11 +2769,11 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 1) {
|
if (file_count > 1) {
|
||||||
printf("igzip_rand_test files: ");
|
printf("igzip_rand_test files: ");
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 0; i < file_count; i++) {
|
||||||
ret |= test_compress_file(argv[i]);
|
ret |= test_compress_file(input_files[i]);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -2724,7 +2793,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < options.randoms; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2735,14 +2804,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % (RANDOMS / 16) == 0)
|
if (i % (options.randoms / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS / 16; i++) {
|
for (i = 0; i < options.randoms / 16; i++) {
|
||||||
create_rand_repeat_data(in_buf, PAGE_SIZE);
|
create_rand_repeat_data(in_buf, PAGE_SIZE);
|
||||||
ret |= test_compress_stateless(in_buf, PAGE_SIZE, NO_FLUSH); // good for efence
|
ret |= test_compress_stateless(in_buf, PAGE_SIZE, NO_FLUSH); // good for efence
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -2788,7 +2857,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < options.randoms; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2799,14 +2868,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % (RANDOMS / 16) == 0)
|
if (i % (options.randoms / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS / 16; i++) {
|
for (i = 0; i < options.randoms / 16; i++) {
|
||||||
create_rand_repeat_data(in_buf, PAGE_SIZE);
|
create_rand_repeat_data(in_buf, PAGE_SIZE);
|
||||||
ret |= test_compress_stateless(in_buf, PAGE_SIZE, FULL_FLUSH); // good for efence
|
ret |= test_compress_stateless(in_buf, PAGE_SIZE, FULL_FLUSH); // good for efence
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -2828,7 +2897,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < options.randoms; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2839,7 +2908,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % (RANDOMS / 16) == 0)
|
if (i % (options.randoms / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2861,7 +2930,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < options.randoms; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2872,7 +2941,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % (RANDOMS / 16) == 0)
|
if (i % (options.randoms / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2894,7 +2963,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < options.randoms; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2905,13 +2974,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % (RANDOMS / 16) == 0)
|
if (i % (options.randoms / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS / 8; i++) {
|
for (i = 0; i < options.randoms / 8; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2940,7 +3009,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < RANDOMS / 4; i++) {
|
for (i = 0; i < options.randoms / 4; i++) {
|
||||||
in_size = get_rand_data_length();
|
in_size = get_rand_data_length();
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
@@ -2951,7 +3020,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
if (i % ((RANDOMS / 4) / 16) == 0)
|
if (i % ((options.randoms / 4) / 16) == 0)
|
||||||
printf(".");
|
printf(".");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2961,41 +3030,43 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("%s\n", ret ? "Fail" : "Pass");
|
printf("%s\n", ret ? "Fail" : "Pass");
|
||||||
|
|
||||||
printf("igzip_rand_test large input ");
|
if (options.do_large_test) {
|
||||||
|
printf("igzip_rand_test large input ");
|
||||||
|
|
||||||
iterations = RANDOMS / 256 + 1;
|
iterations = options.randoms / 256 + 1;
|
||||||
for (i = 0; i < iterations; i++) {
|
for (i = 0; i < iterations; i++) {
|
||||||
in_size = rand() % (32 * 1024) + 16 * 1024;
|
in_size = rand() % (32 * 1024) + 16 * 1024;
|
||||||
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
offset = rand() % (IBUF_SIZE + 1 - in_size);
|
||||||
in_buf += offset;
|
in_buf += offset;
|
||||||
|
|
||||||
large_buf_size = 1;
|
large_buf_size = 1;
|
||||||
large_buf_size <<= 32;
|
large_buf_size <<= 32;
|
||||||
large_buf_size += rand() % (1024 * 1024) + 1;
|
large_buf_size += rand() % (1024 * 1024) + 1;
|
||||||
create_rand_repeat_data(in_buf, in_size);
|
create_rand_repeat_data(in_buf, in_size);
|
||||||
|
|
||||||
ret |= test_large(in_buf, in_size, large_buf_size);
|
ret |= test_large(in_buf, in_size, large_buf_size);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
in_buf -= offset;
|
in_buf -= offset;
|
||||||
|
|
||||||
|
if (iterations < 16) {
|
||||||
|
for (j = 0; j < 16 / iterations; j++)
|
||||||
|
printf(".");
|
||||||
|
} else if (i % (iterations / 16) == 0)
|
||||||
|
printf(".");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (iterations < 16) {
|
if (iterations < 16) {
|
||||||
for (j = 0; j < 16 / iterations; j++)
|
for (j = (16 / iterations) * iterations; j < 16; j++)
|
||||||
printf(".");
|
printf(".");
|
||||||
} else if (i % (iterations / 16) == 0)
|
}
|
||||||
printf(".");
|
|
||||||
|
|
||||||
|
printf("%s\n", ret ? "Fail" : "Pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iterations < 16) {
|
|
||||||
for (j = (16 / iterations) * iterations; j < 16; j++)
|
|
||||||
printf(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s\n", ret ? "Fail" : "Pass");
|
|
||||||
|
|
||||||
printf("igzip_rand_test inflate Std Vectors: ");
|
printf("igzip_rand_test inflate Std Vectors: ");
|
||||||
|
|
||||||
for (i = 0; i < sizeof(std_vect_array) / sizeof(struct vect_result); i++) {
|
for (i = 0; i < sizeof(std_vect_array) / sizeof(struct vect_result); i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user