igzip: fix return value in wrapper header test

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
Pablo de Lara 2023-11-29 13:36:29 +00:00 committed by Tomasz Kantecki
parent 6dc544c661
commit 02aa005c2d

View File

@ -796,7 +796,7 @@ int main(int argc, char *argv[])
{ {
uint8_t *hdr_buf; uint8_t *hdr_buf;
uint32_t hdr_buf_len; uint32_t hdr_buf_len;
int ret = 0, fin_ret = 0; int ret = 0;
struct isal_gzip_header gz_hdr_orig; struct isal_gzip_header gz_hdr_orig;
struct isal_zlib_header z_hdr_orig; struct isal_zlib_header z_hdr_orig;
int i; int i;
@ -815,7 +815,7 @@ int main(int argc, char *argv[])
ret = gen_rand_gzip_header(&gz_hdr_orig); ret = gen_rand_gzip_header(&gz_hdr_orig);
if (ret) { if (ret) {
print_error(ret); print_error(ret);
return (ret == 0); return 1;
} }
hdr_buf_len = gzip_header_size(&gz_hdr_orig); hdr_buf_len = gzip_header_size(&gz_hdr_orig);
@ -823,21 +823,18 @@ int main(int argc, char *argv[])
ret = write_gzip_header(hdr_buf, hdr_buf_len, &gz_hdr_orig); ret = write_gzip_header(hdr_buf, hdr_buf_len, &gz_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
ret = read_gzip_header_simple(hdr_buf, hdr_buf_len, &gz_hdr_orig); ret = read_gzip_header_simple(hdr_buf, hdr_buf_len, &gz_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
ret = read_gzip_header_streaming(hdr_buf, hdr_buf_len, &gz_hdr_orig); ret = read_gzip_header_streaming(hdr_buf, hdr_buf_len, &gz_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
free_gzip_header(&gz_hdr_orig); free_gzip_header(&gz_hdr_orig);
if (hdr_buf != NULL) if (hdr_buf != NULL)
@ -861,21 +858,18 @@ int main(int argc, char *argv[])
ret = write_zlib_header(hdr_buf, hdr_buf_len, &z_hdr_orig); ret = write_zlib_header(hdr_buf, hdr_buf_len, &z_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
ret = read_zlib_header_simple(hdr_buf, hdr_buf_len, &z_hdr_orig); ret = read_zlib_header_simple(hdr_buf, hdr_buf_len, &z_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
ret = read_zlib_header_streaming(hdr_buf, hdr_buf_len, &z_hdr_orig); ret = read_zlib_header_streaming(hdr_buf, hdr_buf_len, &z_hdr_orig);
fin_ret |= ret;
if (ret) if (ret)
return (ret == 0); return 1;
if (hdr_buf != NULL) if (hdr_buf != NULL)
free(hdr_buf); free(hdr_buf);
@ -887,8 +881,7 @@ int main(int argc, char *argv[])
} }
printf("Pass \n"); printf("Pass \n");
printf("igzip wrapper_hdr test finished:%s \n", printf("igzip wrapper_hdr test finished: All tests passed \n");
fin_ret ? " Some tests failed " : " All tests passed");
return 0; return 0;
} }