From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B7E8A046B for ; Tue, 20 Aug 2019 15:14:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 528B51BEC5; Tue, 20 Aug 2019 15:14:45 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E1CD91BEC3 for ; Tue, 20 Aug 2019 15:14:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 06:14:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,408,1559545200"; d="scan'208";a="195769071" Received: from adamdybx-mobl.ger.corp.intel.com (HELO addy-VirtualBox.isw.intel.com) ([10.103.104.111]) by fmsmga001.fm.intel.com with ESMTP; 20 Aug 2019 06:14:39 -0700 From: Adam Dybkowski To: dev@dpdk.org, fiona.trahe@intel.com, pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com Cc: Adam Dybkowski Date: Mon, 19 Aug 2019 22:31:47 +0200 Message-Id: <20190819203147.19693-1-adamx.dybkowski@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] test/compress: return -ENOTSUP on capability get error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes the return value of the test_deflate_comp_decomp function on capabilities retrieval error to be -ENOTSUP. It also fixes passing of the test_deflate_comp_decomp function's return value to the upper level (as the test suite function return value). Signed-off-by: Adam Dybkowski --- app/test/test_compressdev.c | 164 +++++++++++++++++------------------- 1 file changed, 76 insertions(+), 88 deletions(-) diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c index 992eac8e0..167c48f10 100644 --- a/app/test/test_compressdev.c +++ b/app/test/test_compressdev.c @@ -729,7 +729,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data, 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]; @@ -758,7 +758,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data, if (capa == NULL) { RTE_LOG(ERR, USER1, "Compress device does not support DEFLATE\n"); - return -1; + return -ENOTSUP; } /* Initialize all arrays to NULL */ @@ -1007,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"); @@ -1028,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; } @@ -1234,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"); @@ -1255,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; } @@ -1297,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 */ @@ -1367,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; @@ -1438,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; @@ -1465,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; @@ -1488,13 +1483,15 @@ test_compressdev_deflate_stateless_multi_op(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; return TEST_SUCCESS; } @@ -1545,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; - } } } @@ -1571,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 */ @@ -1627,12 +1622,12 @@ test_compressdev_deflate_stateless_multi_xform(void) }; /* 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]); @@ -1647,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); @@ -1678,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 @@ -1744,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, @@ -1756,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, @@ -1794,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; - } } } @@ -1823,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; - } } } @@ -1853,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; - } } } @@ -1912,34 +1904,30 @@ test_compressdev_out_of_space_buffer(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; - } 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; @@ -1954,7 +1942,7 @@ test_compressdev_deflate_stateless_dynamic_big(void) { struct comp_testsuite_params *ts_params = &testsuite_params; uint16_t i = 0; - int ret = TEST_SUCCESS; + int ret; int j; const struct rte_compressdev_capabilities *capab; char *test_buffer = NULL; @@ -2003,19 +1991,19 @@ test_compressdev_deflate_stateless_dynamic_big(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; - goto end; - } + 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; - goto end; - } + ret = test_deflate_comp_decomp(&int_data, &test_data); + if (ret < 0) + goto exit; + + ret = TEST_SUCCESS; -end: +exit: ts_params->def_comp_xform->compress.deflate.huffman = RTE_COMP_HUFFMAN_DEFAULT; rte_free(test_buffer); -- 2.17.1