DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] test: fix eal_flags_autotest due to missing_n_flag test
Date: Fri,  6 Nov 2015 15:15:13 +0000	[thread overview]
Message-ID: <1446822913-59963-1-git-send-email-pablo.de.lara.guarch@intel.com> (raw)

eal_flags_autotest was broken after commit
19bfa4dd ("eal: make the -n argument optional"),
since the unit test was checking that app would not run
if -n flag was missing, which now it is possible.

Also, subtest test_missing_n_flag() has been renamed
to test_invalid_n_flag(), as now -n flag is not compulsory.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test.c           |  2 +-
 app/test/test_eal_flags.c | 33 +++++++++++++++++++--------------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index e8992f4..b94199a 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -81,7 +81,7 @@ do_recursive_call(void)
 			{ "run_secondary_instances", test_mp_secondary },
 			{ "test_missing_c_flag", no_action },
 			{ "test_master_lcore_flag", no_action },
-			{ "test_missing_n_flag", no_action },
+			{ "test_invalid_n_flag", no_action },
 			{ "test_no_hpet_flag", no_action },
 			{ "test_whitelist_flag", no_action },
 			{ "test_invalid_b_flag", no_action },
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index e0aee2d..d9c0d93 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -674,13 +674,13 @@ test_master_lcore_flag(void)
 }
 
 /*
- * Test that the app doesn't run without the -n flag. In all cases
- * should give an error and fail to run.
+ * Test that the app doesn't run with invalid -n flag option.
+ * Final test ensures it does run with valid options as sanity check
  * Since -n is not compulsory for MP, we instead use --no-huge and --no-shconf
  * flags.
  */
 static int
-test_missing_n_flag(void)
+test_invalid_n_flag(void)
 {
 #ifdef RTE_EXEC_ENV_BSDAPP
 	/* BSD target doesn't support prefixes at this point */
@@ -696,26 +696,31 @@ test_missing_n_flag(void)
 
 	/* -n flag but no value */
 	const char *argv1[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n"};
-	/* No -n flag at all */
-	const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};
 	/* bad numeric value */
-	const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" };
+	const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" };
 	/* out-of-range value */
-	const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "9" };
+	const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "9" };
 	/* sanity test - check with good value */
-	const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" };
+	const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" };
+	/* sanity test - check with no -n flag */
+	const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};
 
 	if (launch_proc(argv1) == 0
 			|| launch_proc(argv2) == 0
-			|| launch_proc(argv3) == 0
-			|| launch_proc(argv4) == 0) {
-		printf("Error - process ran without error when missing -n flag\n");
+			|| launch_proc(argv3) == 0) {
+		printf("Error - process ran without error when"
+		       "invalid -n flag\n");
 		return -1;
 	}
-	if (launch_proc(argv5) != 0) {
+	if (launch_proc(argv4) != 0) {
 		printf("Error - process did not run ok with valid num-channel value\n");
 		return -1;
 	}
+	if (launch_proc(argv5) != 0) {
+		printf("Error - process did not run ok without -n flag\n");
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -1368,9 +1373,9 @@ test_eal_flags(void)
 		return ret;
 	}
 
-	ret = test_missing_n_flag();
+	ret = test_invalid_n_flag();
 	if (ret < 0) {
-		printf("Error in test_missing_n_flag()\n");
+		printf("Error in test_invalid_n_flag()\n");
 		return ret;
 	}
 
-- 
2.5.0

             reply	other threads:[~2015-11-06 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 15:15 Pablo de Lara [this message]
2015-11-06 15:34 ` Thomas Monjalon

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=1446822913-59963-1-git-send-email-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    /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).