From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6E47A2BCE for ; Fri, 4 May 2018 12:22:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2018 03:22:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,362,1520924400"; d="scan'208";a="225767752" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga006.fm.intel.com with ESMTP; 04 May 2018 03:22:50 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: fiona.trahe@intel.com, lee.daly@intel.com, shally.verma@cavium.com, ahmed.mansour@nxp.com, Ashish.Gupta@cavium.com, Pablo de Lara Date: Fri, 4 May 2018 11:22:16 +0100 Message-Id: <20180504102218.30672-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504102218.30672-1-pablo.de.lara.guarch@intel.com> References: <20180228140010.27251-1-pablo.de.lara.guarch@intel.com> <20180504102218.30672-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v4 3/5] test/compress: add multi level test 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: , X-List-Received-Date: Fri, 04 May 2018 10:22:53 -0000 Add test that checks if all compression levels are supported and compress a buffer correctly. Signed-off-by: Pablo de Lara Acked-by: Lee Daly --- test/test/test_compressdev.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c index 629509f9b..28e2913e7 100644 --- a/test/test/test_compressdev.c +++ b/test/test/test_compressdev.c @@ -863,6 +863,37 @@ test_compressdev_deflate_stateless_multi_op(void) return TEST_SUCCESS; } + +static int +test_compressdev_deflate_stateless_multi_level(void) +{ + struct comp_testsuite_params *ts_params = &testsuite_params; + const char *test_buffer; + unsigned int level; + uint16_t i; + struct rte_comp_xform compress_xform; + + memcpy(&compress_xform, &ts_params->def_comp_xform, + sizeof(struct rte_comp_xform)); + + for (i = 0; i < RTE_DIM(compress_test_bufs); i++) { + test_buffer = compress_test_bufs[i]; + for (level = RTE_COMP_LEVEL_MIN; level <= RTE_COMP_LEVEL_MAX; + level++) { + compress_xform.compress.level = level; + /* Compress with compressdev, decompress with Zlib */ + if (test_deflate_comp_decomp(&test_buffer, 1, + &i, + &compress_xform, + &ts_params->def_decomp_xform, + RTE_COMP_OP_STATELESS, + ZLIB_DECOMPRESS) < 0) + return TEST_FAILED; + } + } + + return TEST_SUCCESS; +} static struct unit_test_suite compressdev_testsuite = { .suite_name = "compressdev unit test suite", .setup = testsuite_setup, @@ -874,6 +905,8 @@ static struct unit_test_suite compressdev_testsuite = { test_compressdev_deflate_stateless_dynamic), TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, test_compressdev_deflate_stateless_multi_op), + TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, + test_compressdev_deflate_stateless_multi_level), TEST_CASES_END() /**< NULL terminate unit test array */ } }; -- 2.17.0