DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Cc: fiona.trahe@intel.com, shally.verma@cavium.com,
	ahmed.mansour@nxp.com, Ashish.Gupta@cavium.com,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v2 5/5] test/compress: add invalid configuration tests
Date: Sun,  8 Apr 2018 15:00:08 +0100	[thread overview]
Message-ID: <20180408140008.38747-6-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <20180408140008.38747-1-pablo.de.lara.guarch@intel.com>

Add tests that check if device configuration
is not successful when providing invalid parameters.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 test/test/test_compressdev.c | 49 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index 0cffd85ba..1dbd8779d 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -177,6 +177,51 @@ generic_ut_teardown(void)
 	rte_compressdev_stop(0);
 }
 
+static int
+test_compressdev_invalid_configuration(void)
+{
+	struct rte_compressdev_config invalid_config;
+	struct rte_compressdev_config valid_config = {
+		.socket_id = rte_socket_id(),
+		.nb_queue_pairs = 1,
+		.max_nb_priv_xforms = NUM_MAX_XFORMS,
+		.max_nb_streams = 0
+	};
+	struct rte_compressdev_info dev_info;
+
+	/* Invalid configuration with 0 queue pairs */
+	memcpy(&invalid_config, &valid_config,
+			sizeof(struct rte_compressdev_config));
+	invalid_config.nb_queue_pairs = 0;
+
+	TEST_ASSERT_FAIL(rte_compressdev_configure(0, &invalid_config),
+			"Device configuration was successful "
+			"with no queue pairs (invalid)\n");
+
+	/*
+	 * Invalid configuration with too many queue pairs
+	 * (if there is an actual maximum number of queue pairs)
+	 */
+	rte_compressdev_info_get(0, &dev_info);
+	if (dev_info.max_nb_queue_pairs != 0) {
+		memcpy(&invalid_config, &valid_config,
+			sizeof(struct rte_compressdev_config));
+		invalid_config.nb_queue_pairs = dev_info.max_nb_queue_pairs + 1;
+
+		TEST_ASSERT_FAIL(rte_compressdev_configure(0, &invalid_config),
+				"Device configuration was successful "
+				"with too many queue pairs (invalid)\n");
+	}
+
+	/* Invalid queue pair setup, with no number of queue pairs set */
+	TEST_ASSERT_FAIL(rte_compressdev_queue_pair_setup(0, 0,
+				NUM_MAX_INFLIGHT_OPS, rte_socket_id()),
+			"Queue pair setup was successful "
+			"with no queue pairs set (invalid)\n");
+
+	return TEST_SUCCESS;
+}
+
 static int
 compare_buffers(const char *buffer1, uint32_t buffer1_len,
 		const char *buffer2, uint32_t buffer2_len)
@@ -692,7 +737,7 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 
 			/* Attach non shareable private xform data to ops */
 			for (i = 0; i < num_bufs; i++) {
-				priv_data = (struct priv_op_data *) (ops[i] + 1);
+				priv_data = (struct priv_op_data *)(ops[i] + 1);
 				uint16_t xform_idx = priv_data->orig_idx;
 				ops[i]->private_xform = priv_xforms[xform_idx];
 			}
@@ -1024,6 +1069,8 @@ static struct unit_test_suite compressdev_testsuite  = {
 	.setup = testsuite_setup,
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
+		TEST_CASE_ST(NULL, NULL,
+			test_compressdev_invalid_configuration),
 		TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
 			test_compressdev_deflate_stateless_fixed),
 		TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
-- 
2.14.3

  parent reply	other threads:[~2018-04-08 14:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 14:00 [dpdk-dev] [PATCH 0/5] Initial compressdev unit tests Pablo de Lara
2018-02-28 14:00 ` [dpdk-dev] [PATCH 1/5] compressdev: add const for xform in session init Pablo de Lara
2018-02-28 14:00 ` [dpdk-dev] [PATCH 2/5] test/compress: add initial unit tests Pablo de Lara
2018-02-28 14:00 ` [dpdk-dev] [PATCH 3/5] test/compress: add multi op test Pablo de Lara
2018-02-28 14:00 ` [dpdk-dev] [PATCH 4/5] test/compress: add multi level test Pablo de Lara
2018-02-28 14:00 ` [dpdk-dev] [PATCH 5/5] test/compress: add multi session test Pablo de Lara
2018-04-08 14:00 ` [dpdk-dev] [PATCH v2 0/5] Initial compressdev unit tests Pablo de Lara
2018-04-08 14:00   ` [dpdk-dev] [PATCH v2 1/5] test/compress: add initial " Pablo de Lara
2018-04-08 14:00   ` [dpdk-dev] [PATCH v2 2/5] test/compress: add multi op test Pablo de Lara
2018-04-08 14:00   ` [dpdk-dev] [PATCH v2 3/5] test/compress: add multi level test Pablo de Lara
2018-04-08 14:00   ` [dpdk-dev] [PATCH v2 4/5] test/compress: add multi xform test Pablo de Lara
2018-04-08 14:00   ` Pablo de Lara [this message]
2018-04-27 14:14 ` [dpdk-dev] [PATCH v3 0/5] Initial compressdev unit tests Pablo de Lara
2018-04-27 14:14   ` [dpdk-dev] [PATCH v3 1/5] test/compress: add initial " Pablo de Lara
2018-05-02 13:44     ` Daly, Lee
2018-05-04  8:49       ` De Lara Guarch, Pablo
2018-04-27 14:14   ` [dpdk-dev] [PATCH v3 2/5] test/compress: add multi op test Pablo de Lara
2018-04-27 14:15   ` [dpdk-dev] [PATCH v3 3/5] test/compress: add multi level test Pablo de Lara
2018-04-27 14:15   ` [dpdk-dev] [PATCH v3 4/5] test/compress: add multi xform test Pablo de Lara
2018-05-02 13:49     ` Daly, Lee
2018-04-27 14:15   ` [dpdk-dev] [PATCH v3 5/5] test/compress: add invalid configuration tests Pablo de Lara
2018-05-01 13:00   ` [dpdk-dev] [PATCH v3 0/5] Initial compressdev unit tests Daly, Lee
2018-05-04 10:22 ` [dpdk-dev] [PATCH v4 " Pablo de Lara
2018-05-04 10:22   ` [dpdk-dev] [PATCH v4 1/5] test/compress: add initial " Pablo de Lara
2018-05-14  8:29     ` Verma, Shally
2018-05-14  8:40       ` De Lara Guarch, Pablo
2018-05-04 10:22   ` [dpdk-dev] [PATCH v4 2/5] test/compress: add multi op test Pablo de Lara
2018-05-04 10:22   ` [dpdk-dev] [PATCH v4 3/5] test/compress: add multi level test Pablo de Lara
2018-05-04 10:22   ` [dpdk-dev] [PATCH v4 4/5] test/compress: add multi xform test Pablo de Lara
2018-05-04 10:22   ` [dpdk-dev] [PATCH v4 5/5] test/compress: add invalid configuration tests Pablo de Lara
2018-05-08 15:47   ` [dpdk-dev] [PATCH v4 0/5] Initial compressdev unit tests Trahe, Fiona
2018-05-08 21:26   ` De Lara Guarch, Pablo

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=20180408140008.38747-6-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=Ashish.Gupta@cavium.com \
    --cc=ahmed.mansour@nxp.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=shally.verma@cavium.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).