test/compress: rework error checks
[dpdk.git] / app / test / test_compressdev.c
index 13cf26c..167c48f 100644 (file)
@@ -1,9 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  */
 #include <string.h>
 #include <zlib.h>
 #include <math.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include <rte_cycles.h>
 
 #define OUT_OF_SPACE_BUF 1
 
+#define MAX_MBUF_SEGMENT_SIZE 65535
+#define MAX_DATA_MBUF_SIZE (MAX_MBUF_SEGMENT_SIZE - RTE_PKTMBUF_HEADROOM)
+#define NUM_BIG_MBUFS 4
+#define BIG_DATA_TEST_SIZE (MAX_DATA_MBUF_SIZE * NUM_BIG_MBUFS / 2)
+
 const char *
 huffman_type_strings[] = {
        [RTE_COMP_HUFFMAN_DEFAULT]      = "PMD default",
@@ -73,6 +79,7 @@ struct priv_op_data {
 struct comp_testsuite_params {
        struct rte_mempool *large_mbuf_pool;
        struct rte_mempool *small_mbuf_pool;
+       struct rte_mempool *big_mbuf_pool;
        struct rte_mempool *op_pool;
        struct rte_comp_xform *def_comp_xform;
        struct rte_comp_xform *def_decomp_xform;
@@ -92,6 +99,7 @@ struct test_data_params {
        enum varied_buff buff_type;
        enum zlib_direction zlib_dir;
        unsigned int out_of_space;
+       unsigned int big_data;
 };
 
 static struct comp_testsuite_params testsuite_params = { 0 };
@@ -105,11 +113,14 @@ testsuite_teardown(void)
                RTE_LOG(ERR, USER1, "Large mbuf pool still has unfreed bufs\n");
        if (rte_mempool_in_use_count(ts_params->small_mbuf_pool))
                RTE_LOG(ERR, USER1, "Small mbuf pool still has unfreed bufs\n");
+       if (rte_mempool_in_use_count(ts_params->big_mbuf_pool))
+               RTE_LOG(ERR, USER1, "Big mbuf pool still has unfreed bufs\n");
        if (rte_mempool_in_use_count(ts_params->op_pool))
                RTE_LOG(ERR, USER1, "op pool still has unfreed ops\n");
 
        rte_mempool_free(ts_params->large_mbuf_pool);
        rte_mempool_free(ts_params->small_mbuf_pool);
+       rte_mempool_free(ts_params->big_mbuf_pool);
        rte_mempool_free(ts_params->op_pool);
        rte_free(ts_params->def_comp_xform);
        rte_free(ts_params->def_decomp_xform);
@@ -123,8 +134,8 @@ testsuite_setup(void)
        unsigned int i;
 
        if (rte_compressdev_count() == 0) {
-               RTE_LOG(ERR, USER1, "Need at least one compress device\n");
-               return TEST_FAILED;
+               RTE_LOG(WARNING, USER1, "Need at least one compress device\n");
+               return TEST_SKIPPED;
        }
 
        RTE_LOG(NOTICE, USER1, "Running tests on device %s\n",
@@ -162,6 +173,17 @@ testsuite_setup(void)
                goto exit;
        }
 
+       /* Create mempool with big buffers for SGL testing */
+       ts_params->big_mbuf_pool = rte_pktmbuf_pool_create("big_mbuf_pool",
+                       NUM_BIG_MBUFS + 1,
+                       CACHE_SIZE, 0,
+                       MAX_MBUF_SEGMENT_SIZE,
+                       rte_socket_id());
+       if (ts_params->big_mbuf_pool == NULL) {
+               RTE_LOG(ERR, USER1, "Big mbuf pool could not be created\n");
+               goto exit;
+       }
+
        ts_params->op_pool = rte_comp_op_pool_create("op_pool", NUM_OPS,
                                0, sizeof(struct priv_op_data),
                                rte_socket_id());
@@ -598,10 +620,11 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf *head_buf,
                uint32_t total_data_size,
                struct rte_mempool *small_mbuf_pool,
                struct rte_mempool *large_mbuf_pool,
-               uint8_t limit_segs_in_sgl)
+               uint8_t limit_segs_in_sgl,
+               uint16_t seg_size)
 {
        uint32_t remaining_data = total_data_size;
-       uint16_t num_remaining_segs = DIV_CEIL(remaining_data, SMALL_SEG_SIZE);
+       uint16_t num_remaining_segs = DIV_CEIL(remaining_data, seg_size);
        struct rte_mempool *pool;
        struct rte_mbuf *next_seg;
        uint32_t data_size;
@@ -617,10 +640,10 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf *head_buf,
         * Allocate data in the first segment (header) and
         * copy data if test buffer is provided
         */
-       if (remaining_data < SMALL_SEG_SIZE)
+       if (remaining_data < seg_size)
                data_size = remaining_data;
        else
-               data_size = SMALL_SEG_SIZE;
+               data_size = seg_size;
        buf_ptr = rte_pktmbuf_append(head_buf, data_size);
        if (buf_ptr == NULL) {
                RTE_LOG(ERR, USER1,
@@ -644,13 +667,13 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf *head_buf,
 
                if (i == (num_remaining_segs - 1)) {
                        /* last segment */
-                       if (remaining_data > SMALL_SEG_SIZE)
+                       if (remaining_data > seg_size)
                                pool = large_mbuf_pool;
                        else
                                pool = small_mbuf_pool;
                        data_size = remaining_data;
                } else {
-                       data_size = SMALL_SEG_SIZE;
+                       data_size = seg_size;
                        pool = small_mbuf_pool;
                }
 
@@ -704,8 +727,9 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        enum rte_comp_op_type state = test_data->state;
        unsigned int buff_type = test_data->buff_type;
        unsigned int out_of_space = test_data->out_of_space;
+       unsigned int big_data = test_data->big_data;
        enum zlib_direction zlib_dir = test_data->zlib_dir;
-       int ret_status = -1;
+       int ret_status = TEST_FAILED;
        int ret;
        struct rte_mbuf *uncomp_bufs[num_bufs];
        struct rte_mbuf *comp_bufs[num_bufs];
@@ -731,6 +755,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        char *contig_buf = NULL;
        uint64_t compress_checksum[num_bufs];
 
+       if (capa == NULL) {
+               RTE_LOG(ERR, USER1,
+                       "Compress device does not support DEFLATE\n");
+               return -ENOTSUP;
+       }
+
        /* Initialize all arrays to NULL */
        memset(uncomp_bufs, 0, sizeof(struct rte_mbuf *) * num_bufs);
        memset(comp_bufs, 0, sizeof(struct rte_mbuf *) * num_bufs);
@@ -738,7 +768,9 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        memset(ops_processed, 0, sizeof(struct rte_comp_op *) * num_bufs);
        memset(priv_xforms, 0, sizeof(void *) * num_bufs);
 
-       if (buff_type == SGL_BOTH)
+       if (big_data)
+               buf_pool = ts_params->big_mbuf_pool;
+       else if (buff_type == SGL_BOTH)
                buf_pool = ts_params->small_mbuf_pool;
        else
                buf_pool = ts_params->large_mbuf_pool;
@@ -757,17 +789,18 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                for (i = 0; i < num_bufs; i++) {
                        data_size = strlen(test_bufs[i]) + 1;
                        if (prepare_sgl_bufs(test_bufs[i], uncomp_bufs[i],
-                                       data_size,
-                                       ts_params->small_mbuf_pool,
-                                       ts_params->large_mbuf_pool,
-                                       MAX_SEGS) < 0)
+                           data_size,
+                           big_data ? buf_pool : ts_params->small_mbuf_pool,
+                           big_data ? buf_pool : ts_params->large_mbuf_pool,
+                           big_data ? 0 : MAX_SEGS,
+                           big_data ? MAX_DATA_MBUF_SIZE : SMALL_SEG_SIZE) < 0)
                                goto exit;
                }
        } else {
                for (i = 0; i < num_bufs; i++) {
                        data_size = strlen(test_bufs[i]) + 1;
                        buf_ptr = rte_pktmbuf_append(uncomp_bufs[i], data_size);
-                       snprintf(buf_ptr, data_size, "%s", test_bufs[i]);
+                       strlcpy(buf_ptr, test_bufs[i], data_size);
                }
        }
 
@@ -789,10 +822,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                                        COMPRESS_BUF_SIZE_RATIO);
 
                        if (prepare_sgl_bufs(NULL, comp_bufs[i],
-                                       data_size,
-                                       ts_params->small_mbuf_pool,
-                                       ts_params->large_mbuf_pool,
-                                       MAX_SEGS) < 0)
+                             data_size,
+                             big_data ? buf_pool : ts_params->small_mbuf_pool,
+                             big_data ? buf_pool : ts_params->large_mbuf_pool,
+                             big_data ? 0 : MAX_SEGS,
+                             big_data ? MAX_DATA_MBUF_SIZE : SMALL_SEG_SIZE)
+                                       < 0)
                                goto exit;
                }
 
@@ -946,7 +981,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                enum rte_comp_huffman huffman_type =
                        compress_xform->deflate.huffman;
                char engine[] = "zlib (directly, not PMD)";
-               if (zlib_dir != ZLIB_COMPRESS || zlib_dir != ZLIB_ALL)
+               if (zlib_dir != ZLIB_COMPRESS && zlib_dir != ZLIB_ALL)
                        strlcpy(engine, "PMD", sizeof(engine));
 
                RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to"
@@ -972,8 +1007,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                if (out_of_space && oos_zlib_decompress) {
                        if (ops_processed[i]->status !=
                                        RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED) {
-                               ret_status = -1;
-
+                               ret_status = TEST_FAILED;
                                RTE_LOG(ERR, USER1,
                                        "Operation without expected out of "
                                        "space status error\n");
@@ -993,7 +1027,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        }
 
        if (out_of_space && oos_zlib_decompress) {
-               ret_status = 0;
+               ret_status = TEST_SUCCESS;
                goto exit;
        }
 
@@ -1017,10 +1051,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                                strlen(test_bufs[priv_data->orig_idx]) + 1;
 
                        if (prepare_sgl_bufs(NULL, uncomp_bufs[i],
-                                       data_size,
-                                       ts_params->small_mbuf_pool,
-                                       ts_params->large_mbuf_pool,
-                                       MAX_SEGS) < 0)
+                              data_size,
+                              big_data ? buf_pool : ts_params->small_mbuf_pool,
+                              big_data ? buf_pool : ts_params->large_mbuf_pool,
+                              big_data ? 0 : MAX_SEGS,
+                              big_data ? MAX_DATA_MBUF_SIZE : SMALL_SEG_SIZE)
+                                       < 0)
                                goto exit;
                }
 
@@ -1180,7 +1216,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        for (i = 0; i < num_bufs; i++) {
                priv_data = (struct priv_op_data *)(ops_processed[i] + 1);
                char engine[] = "zlib, (directly, no PMD)";
-               if (zlib_dir != ZLIB_DECOMPRESS || zlib_dir != ZLIB_ALL)
+               if (zlib_dir != ZLIB_DECOMPRESS && zlib_dir != ZLIB_ALL)
                        strlcpy(engine, "pmd", sizeof(engine));
                RTE_LOG(DEBUG, USER1,
                        "Buffer %u decompressed by %s from %u to %u bytes\n",
@@ -1197,8 +1233,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                if (out_of_space && oos_zlib_compress) {
                        if (ops_processed[i]->status !=
                                        RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED) {
-                               ret_status = -1;
-
+                               ret_status = TEST_FAILED;
                                RTE_LOG(ERR, USER1,
                                        "Operation without expected out of "
                                        "space status error\n");
@@ -1218,7 +1253,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
        }
 
        if (out_of_space && oos_zlib_compress) {
-               ret_status = 0;
+               ret_status = TEST_SUCCESS;
                goto exit;
        }
 
@@ -1260,7 +1295,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,
                contig_buf = NULL;
        }
 
-       ret_status = 0;
+       ret_status = TEST_SUCCESS;
 
 exit:
        /* Free resources */
@@ -1320,6 +1355,7 @@ test_compressdev_deflate_stateless_fixed(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
@@ -1329,17 +1365,15 @@ test_compressdev_deflate_stateless_fixed(void)
 
                /* Compress with compressdev, decompress with Zlib */
                test_data.zlib_dir = ZLIB_DECOMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
 
                /* Compress with Zlib, decompress with compressdev */
                test_data.zlib_dir = ZLIB_COMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
        }
 
        ret = TEST_SUCCESS;
@@ -1390,6 +1424,7 @@ test_compressdev_deflate_stateless_dynamic(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
@@ -1399,17 +1434,15 @@ test_compressdev_deflate_stateless_dynamic(void)
 
                /* Compress with compressdev, decompress with Zlib */
                test_data.zlib_dir = ZLIB_DECOMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
 
                /* Compress with Zlib, decompress with compressdev */
                test_data.zlib_dir = ZLIB_COMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
        }
 
        ret = TEST_SUCCESS;
@@ -1426,6 +1459,7 @@ test_compressdev_deflate_stateless_multi_op(void)
        uint16_t num_bufs = RTE_DIM(compress_test_bufs);
        uint16_t buf_idx[num_bufs];
        uint16_t i;
+       int ret;
 
        for (i = 0; i < num_bufs; i++)
                buf_idx[i] = i;
@@ -1443,18 +1477,21 @@ test_compressdev_deflate_stateless_multi_op(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
        /* Compress with compressdev, decompress with Zlib */
        test_data.zlib_dir = ZLIB_DECOMPRESS;
-       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-               return TEST_FAILED;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
+               return ret;
 
        /* Compress with Zlib, decompress with compressdev */
        test_data.zlib_dir = ZLIB_COMPRESS;
-       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-               return TEST_FAILED;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
+               return ret;
 
        return TEST_SUCCESS;
 }
@@ -1492,6 +1529,7 @@ test_compressdev_deflate_stateless_multi_level(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
@@ -1504,10 +1542,9 @@ test_compressdev_deflate_stateless_multi_level(void)
                        compress_xform->compress.level = level;
                        /* Compress with compressdev, decompress with Zlib */
                        test_data.zlib_dir = ZLIB_DECOMPRESS;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
                }
        }
 
@@ -1530,7 +1567,6 @@ test_compressdev_deflate_stateless_multi_xform(void)
        uint16_t i;
        unsigned int level = RTE_COMP_LEVEL_MIN;
        uint16_t buf_idx[num_bufs];
-
        int ret;
 
        /* Create multiple xforms with various levels */
@@ -1581,16 +1617,17 @@ test_compressdev_deflate_stateless_multi_xform(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
        /* Compress with compressdev, decompress with Zlib */
-       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-               ret = TEST_FAILED;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
                goto exit;
-       }
 
        ret = TEST_SUCCESS;
+
 exit:
        for (i = 0; i < NUM_XFORMS; i++) {
                rte_free(compress_xforms[i]);
@@ -1605,6 +1642,7 @@ test_compressdev_deflate_stateless_sgl(void)
 {
        struct comp_testsuite_params *ts_params = &testsuite_params;
        uint16_t i;
+       int ret;
        const struct rte_compressdev_capabilities *capab;
 
        capab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);
@@ -1626,6 +1664,7 @@ test_compressdev_deflate_stateless_sgl(void)
                RTE_COMP_OP_STATELESS,
                SGL_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
@@ -1635,47 +1674,50 @@ test_compressdev_deflate_stateless_sgl(void)
 
                /* Compress with compressdev, decompress with Zlib */
                test_data.zlib_dir = ZLIB_DECOMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                       return TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
+                       return ret;
 
                /* Compress with Zlib, decompress with compressdev */
                test_data.zlib_dir = ZLIB_COMPRESS;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                       return TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
+                       return ret;
 
                if (capab->comp_feature_flags & RTE_COMP_FF_OOP_SGL_IN_LB_OUT) {
                        /* Compress with compressdev, decompress with Zlib */
                        test_data.zlib_dir = ZLIB_DECOMPRESS;
                        test_data.buff_type = SGL_TO_LB;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                               return TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
+                               return ret;
 
                        /* Compress with Zlib, decompress with compressdev */
                        test_data.zlib_dir = ZLIB_COMPRESS;
                        test_data.buff_type = SGL_TO_LB;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                               return TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
+                               return ret;
                }
 
                if (capab->comp_feature_flags & RTE_COMP_FF_OOP_LB_IN_SGL_OUT) {
                        /* Compress with compressdev, decompress with Zlib */
                        test_data.zlib_dir = ZLIB_DECOMPRESS;
                        test_data.buff_type = LB_TO_SGL;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                               return TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
+                               return ret;
 
                        /* Compress with Zlib, decompress with compressdev */
                        test_data.zlib_dir = ZLIB_COMPRESS;
                        test_data.buff_type = LB_TO_SGL;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0)
-                               return TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
+                               return ret;
                }
-
-
        }
 
        return TEST_SUCCESS;
-
 }
 
 static int
@@ -1701,8 +1743,7 @@ test_compressdev_deflate_stateless_checksum(void)
                        rte_malloc(NULL, sizeof(struct rte_comp_xform), 0);
        if (compress_xform == NULL) {
                RTE_LOG(ERR, USER1, "Compress xform could not be created\n");
-               ret = TEST_FAILED;
-               return ret;
+               return TEST_FAILED;
        }
 
        memcpy(compress_xform, ts_params->def_comp_xform,
@@ -1713,8 +1754,7 @@ test_compressdev_deflate_stateless_checksum(void)
        if (decompress_xform == NULL) {
                RTE_LOG(ERR, USER1, "Decompress xform could not be created\n");
                rte_free(compress_xform);
-               ret = TEST_FAILED;
-               return ret;
+               return TEST_FAILED;
        }
 
        memcpy(decompress_xform, ts_params->def_decomp_xform,
@@ -1733,6 +1773,7 @@ test_compressdev_deflate_stateless_checksum(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
+               0,
                0
        };
 
@@ -1750,19 +1791,17 @@ test_compressdev_deflate_stateless_checksum(void)
                         * drivers decompression checksum
                         */
                        test_data.zlib_dir = ZLIB_COMPRESS;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
 
                        /* Generate compression and decompression
                         * checksum of selected driver
                         */
                        test_data.zlib_dir = ZLIB_NONE;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
                }
        }
 
@@ -1779,18 +1818,16 @@ test_compressdev_deflate_stateless_checksum(void)
                         * drivers decompression checksum
                         */
                        test_data.zlib_dir = ZLIB_COMPRESS;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
                        /* Generate compression and decompression
                         * checksum of selected driver
                         */
                        test_data.zlib_dir = ZLIB_NONE;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
                }
        }
 
@@ -1809,10 +1846,9 @@ test_compressdev_deflate_stateless_checksum(void)
                         * checksum of selected driver
                         */
                        test_data.zlib_dir = ZLIB_NONE;
-                       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                               ret = TEST_FAILED;
+                       ret = test_deflate_comp_decomp(&int_data, &test_data);
+                       if (ret < 0)
                                goto exit;
-                       }
                }
        }
 
@@ -1832,7 +1868,7 @@ test_compressdev_out_of_space_buffer(void)
        uint16_t i;
        const struct rte_compressdev_capabilities *capab;
 
-       RTE_LOG(INFO, USER1, "This is a negative test errors are expected\n");
+       RTE_LOG(ERR, USER1, "This is a negative test errors are expected\n");
 
        capab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);
        TEST_ASSERT(capab != NULL, "Failed to retrieve device capabilities");
@@ -1863,38 +1899,35 @@ test_compressdev_out_of_space_buffer(void)
                RTE_COMP_OP_STATELESS,
                LB_BOTH,
                ZLIB_DECOMPRESS,
-               1
+               1,  /* run out-of-space test */
+               0
        };
        /* Compress with compressdev, decompress with Zlib */
        test_data.zlib_dir = ZLIB_DECOMPRESS;
-       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-               ret = TEST_FAILED;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
                goto exit;
-       }
 
        /* Compress with Zlib, decompress with compressdev */
        test_data.zlib_dir = ZLIB_COMPRESS;
-       if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-               ret = TEST_FAILED;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
                goto exit;
-       }
 
        if (capab->comp_feature_flags & RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {
                /* Compress with compressdev, decompress with Zlib */
                test_data.zlib_dir = ZLIB_DECOMPRESS;
                test_data.buff_type = SGL_BOTH;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
 
                /* Compress with Zlib, decompress with compressdev */
                test_data.zlib_dir = ZLIB_COMPRESS;
                test_data.buff_type = SGL_BOTH;
-               if (test_deflate_comp_decomp(&int_data, &test_data) < 0) {
-                       ret = TEST_FAILED;
+               ret = test_deflate_comp_decomp(&int_data, &test_data);
+               if (ret < 0)
                        goto exit;
-               }
        }
 
        ret  = TEST_SUCCESS;
@@ -1904,6 +1937,79 @@ exit:
        return ret;
 }
 
+static int
+test_compressdev_deflate_stateless_dynamic_big(void)
+{
+       struct comp_testsuite_params *ts_params = &testsuite_params;
+       uint16_t i = 0;
+       int ret;
+       int j;
+       const struct rte_compressdev_capabilities *capab;
+       char *test_buffer = NULL;
+
+       capab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);
+       TEST_ASSERT(capab != NULL, "Failed to retrieve device capabilities");
+
+       if ((capab->comp_feature_flags & RTE_COMP_FF_HUFFMAN_DYNAMIC) == 0)
+               return -ENOTSUP;
+
+       if ((capab->comp_feature_flags & RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) == 0)
+               return -ENOTSUP;
+
+       test_buffer = rte_malloc(NULL, BIG_DATA_TEST_SIZE, 0);
+       if (test_buffer == NULL) {
+               RTE_LOG(ERR, USER1,
+                       "Can't allocate buffer for big-data\n");
+               return TEST_FAILED;
+       }
+
+       struct interim_data_params int_data = {
+               (const char * const *)&test_buffer,
+               1,
+               &i,
+               &ts_params->def_comp_xform,
+               &ts_params->def_decomp_xform,
+               1
+       };
+
+       struct test_data_params test_data = {
+               RTE_COMP_OP_STATELESS,
+               SGL_BOTH,
+               ZLIB_DECOMPRESS,
+               0,
+               1
+       };
+
+       ts_params->def_comp_xform->compress.deflate.huffman =
+                                               RTE_COMP_HUFFMAN_DYNAMIC;
+
+       /* fill the buffer with data based on rand. data */
+       srand(BIG_DATA_TEST_SIZE);
+       for (j = 0; j < BIG_DATA_TEST_SIZE - 1; ++j)
+               test_buffer[j] = (uint8_t)(rand() % ((uint8_t)-1)) | 1;
+       test_buffer[BIG_DATA_TEST_SIZE-1] = 0;
+
+       /* Compress with compressdev, decompress with Zlib */
+       test_data.zlib_dir = ZLIB_DECOMPRESS;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
+               goto exit;
+
+       /* Compress with Zlib, decompress with compressdev */
+       test_data.zlib_dir = ZLIB_COMPRESS;
+       ret = test_deflate_comp_decomp(&int_data, &test_data);
+       if (ret < 0)
+               goto exit;
+
+       ret = TEST_SUCCESS;
+
+exit:
+       ts_params->def_comp_xform->compress.deflate.huffman =
+                                               RTE_COMP_HUFFMAN_DEFAULT;
+       rte_free(test_buffer);
+       return ret;
+}
+
 
 static struct unit_test_suite compressdev_testsuite  = {
        .suite_name = "compressdev unit test suite",
@@ -1916,6 +2022,8 @@ static struct unit_test_suite compressdev_testsuite  = {
                        test_compressdev_deflate_stateless_fixed),
                TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
                        test_compressdev_deflate_stateless_dynamic),
+               TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
+                       test_compressdev_deflate_stateless_dynamic_big),
                TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
                        test_compressdev_deflate_stateless_multi_op),
                TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,