mirror of
https://github.com/intel/isa-l.git
synced 2025-02-21 06:37:40 +01:00
igzip: Add inflate std vector test to igzip_rand_test
Change-Id: If84de68e9f096e225b3b7e8b695f84c3ab6fe778 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
89fedafcc9
commit
3bc0efa6c2
@ -66,7 +66,8 @@ other_src += igzip/bitbuf2.asm igzip/data_struct2.asm \
|
||||
include/multibinary.asm \
|
||||
include/test.h \
|
||||
igzip/huffman.h \
|
||||
igzip/igzip_decode_block_stateless.asm
|
||||
igzip/igzip_decode_block_stateless.asm \
|
||||
igzip/inflate_std_vects.h
|
||||
|
||||
examples += igzip/igzip_example igzip/igzip_sync_flush_example
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <assert.h>
|
||||
#include "igzip_lib.h"
|
||||
#include "crc_inflate.h"
|
||||
#include "inflate_std_vects.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifndef RANDOMS
|
||||
@ -434,7 +435,7 @@ int inflate_multi_pass(uint8_t * compress_buf, uint64_t compress_len,
|
||||
|
||||
if (*uncompress_len - uncomp_processed == 0 && state->avail_out == 0
|
||||
&& state->tmp_out_valid - state->tmp_out_processed > 0) {
|
||||
ret = INFLATE_OUT_BUFFER_OVERFLOW;
|
||||
ret = ISAL_OUT_OVERFLOW;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -442,7 +443,7 @@ int inflate_multi_pass(uint8_t * compress_buf, uint64_t compress_len,
|
||||
&& (state->block_state != ISAL_BLOCK_INPUT_DONE)
|
||||
&& state->tmp_out_valid - state->tmp_out_processed == 0) {
|
||||
if (state->read_in_length == read_in_old) {
|
||||
ret = INFLATE_END_OF_INPUT;
|
||||
ret = ISAL_END_INPUT;
|
||||
break;
|
||||
}
|
||||
read_in_old = state->read_in_length;
|
||||
@ -1620,6 +1621,46 @@ int test_full_flush(uint8_t * in_buf, uint32_t in_size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_inflate(struct vect_result *in_vector)
|
||||
{
|
||||
int ret = IGZIP_COMP_OK;
|
||||
uint8_t *compress_buf = in_vector->vector, *out_buf = NULL;
|
||||
uint64_t compress_len = in_vector->vector_length;
|
||||
uint32_t out_size = 0;
|
||||
|
||||
out_size = 10 * in_vector->vector_length;
|
||||
out_buf = malloc(out_size);
|
||||
if (out_buf == NULL)
|
||||
return MALLOC_FAILED;
|
||||
|
||||
ret = inflate_stateless_pass(compress_buf, compress_len, out_buf, &out_size, 0);
|
||||
|
||||
if (ret == INFLATE_LEFTOVER_INPUT)
|
||||
ret = ISAL_DECOMP_OK;
|
||||
|
||||
if (ret != in_vector->expected_error)
|
||||
printf("Inflate return value incorrect, %d != %d\n", ret,
|
||||
in_vector->expected_error);
|
||||
else
|
||||
ret = IGZIP_COMP_OK;
|
||||
|
||||
if (!ret) {
|
||||
ret = inflate_multi_pass(compress_buf, compress_len, out_buf, &out_size, 0);
|
||||
|
||||
if (ret == INFLATE_LEFTOVER_INPUT)
|
||||
ret = ISAL_DECOMP_OK;
|
||||
|
||||
if (ret != in_vector->expected_error)
|
||||
printf("Inflate return value incorrect, %d != %d\n", ret,
|
||||
in_vector->expected_error);
|
||||
else
|
||||
ret = IGZIP_COMP_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int get_filesize(FILE * f)
|
||||
{
|
||||
int curr, end;
|
||||
@ -2013,6 +2054,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
printf("%s\n", ret ? "Fail" : "Pass");
|
||||
|
||||
printf("igzip_rand_test inflate Std Vectors: ");
|
||||
|
||||
for (i = 0; i < sizeof(std_vect_array) / sizeof(struct vect_result); i++) {
|
||||
ret = test_inflate(&std_vect_array[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
printf("................");
|
||||
printf("%s\n", ret ? "Fail" : "Pass");
|
||||
|
||||
printf("igzip rand test finished: %s\n",
|
||||
fin_ret ? "Some tests failed" : "All tests passed");
|
||||
|
||||
|
1540
igzip/inflate_std_vects.h
Normal file
1540
igzip/inflate_std_vects.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user