DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test: register test as failed if setup failed
@ 2017-12-22 10:21 Anatoly Burakov
  2018-01-10 14:24 ` Doherty, Declan
  0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2017-12-22 10:21 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, stable

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test: register test as failed if setup failed
  2017-12-22 10:21 [dpdk-dev] [PATCH] test: register test as failed if setup failed Anatoly Burakov
@ 2018-01-10 14:24 ` Doherty, Declan
  2018-01-17 23:14   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Doherty, Declan @ 2018-01-10 14:24 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: stable

On 22/12/2017 10:21 AM, Anatoly Burakov wrote:
> 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");
>   
> 

Acked-by: Declan Doherty <declan.doherty@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test: register test as failed if setup failed
  2018-01-10 14:24 ` Doherty, Declan
@ 2018-01-17 23:14   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-01-17 23:14 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Doherty, Declan, stable

10/01/2018 15:24, Doherty, Declan:
> On 22/12/2017 10:21 AM, Anatoly Burakov wrote:
> > 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>
> 
> Acked-by: Declan Doherty <declan.doherty@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-17 23:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 10:21 [dpdk-dev] [PATCH] test: register test as failed if setup failed Anatoly Burakov
2018-01-10 14:24 ` Doherty, Declan
2018-01-17 23:14   ` Thomas Monjalon

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).