From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com,
pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com
Cc: Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH] test/compress: return -ENOTSUP on capability get error
Date: Mon, 19 Aug 2019 22:31:47 +0200 [thread overview]
Message-ID: <20190819203147.19693-1-adamx.dybkowski@intel.com> (raw)
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 <adamx.dybkowski@intel.com>
---
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
next reply other threads:[~2019-08-20 13:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 20:31 Adam Dybkowski [this message]
2019-09-09 14:00 ` Trybula, ArturX
2019-09-19 15:04 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190819203147.19693-1-adamx.dybkowski@intel.com \
--to=adamx.dybkowski@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=pablo.de.lara.guarch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).