DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: declan.doherty@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] test: register test as failed if setup failed
Date: Fri, 22 Dec 2017 10:21:51 +0000	[thread overview]
Message-ID: <432ebfd1f25d903f60b276790a3029c5480e3306.1513867661.git.anatoly.burakov@intel.com> (raw)

If test set up couldn't be completed, the test was previously
shown as succeeding, even though setup failed. Fix this to report
test as failed, and count all tests that should've been executed,
as failed as well.

Fixes: ffac67b1f71b ("app/test: new assert macros and test suite runner")
Cc: declan.doherty@intel.com
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 test/test/test.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/test/test.c b/test/test/test.c
index 0e6ff7c..fe41d40 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -162,8 +162,20 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 	}
 
 	if (suite->setup)
-		if (suite->setup() != 0)
+		if (suite->setup() != 0) {
+			/*
+			 * setup failed, so count all enabled tests and mark
+			 * them as failed
+			 */
+			while (suite->unit_test_cases[total].testcase) {
+				if (!suite->unit_test_cases[total].enabled)
+					skipped++;
+				else
+					failed++;
+				total++;
+			}
 			goto suite_summary;
+		}
 
 	printf(" + ------------------------------------------------------- +\n");
 
-- 
2.7.4

             reply	other threads:[~2017-12-22 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 10:21 Anatoly Burakov [this message]
2018-01-10 14:24 ` Doherty, Declan
2018-01-17 23:14   ` 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=432ebfd1f25d903f60b276790a3029c5480e3306.1513867661.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).