From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Doherty, Declan" Subject: Re: [PATCH] test: register test as failed if setup failed Date: Wed, 10 Jan 2018 14:24:19 +0000 Message-ID: <4facb05e-9cfa-3bf3-c05a-0323758bdb80@intel.com> References: <432ebfd1f25d903f60b276790a3029c5480e3306.1513867661.git.anatoly.burakov@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: stable@dpdk.org To: Anatoly Burakov , dev@dpdk.org Return-path: In-Reply-To: <432ebfd1f25d903f60b276790a3029c5480e3306.1513867661.git.anatoly.burakov@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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