app/test: don't count skipped tests as executed

Message ID 20231113150533.249808-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series app/test: don't count skipped tests as executed |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Bruce Richardson Nov. 13, 2023, 3:05 p.m. UTC
  The logic around skipped tests is a little confusing in the unit test
runner.
* Any explicitly disabled tests are counted as skipped but not
  executed.
* Any tests that return TEST_SKIPPED are counted as both skipped and
  executed, using the same statistics counters.

This makes the stats very strange and hard to correlate, since the
totals don't add up.  One would expect that SKIPPED + EXECUTED +
UNSUPPORTED == TOTAL, and that PASSED + FAILED == EXECUTED.

To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as
not having executed.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Akhil Goyal March 5, 2024, 2:36 p.m. UTC | #1
> Subject: [EXT] [PATCH] app/test: don't count skipped tests as executed
> The logic around skipped tests is a little confusing in the unit test
> runner.
> * Any explicitly disabled tests are counted as skipped but not
>   executed.
> * Any tests that return TEST_SKIPPED are counted as both skipped and
>   executed, using the same statistics counters.
> 
> This makes the stats very strange and hard to correlate, since the
> totals don't add up.  One would expect that SKIPPED + EXECUTED +
> UNSUPPORTED == TOTAL, and that PASSED + FAILED == EXECUTED.
> 
> To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as
> not having executed.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Akhil Goyal <gakhil@marvell.com>

Yes this makes sense.
One would say executed should count the unsupported cases as well.
But I think this makes sense to not include them in executed cases.
This would give better correlation.
Can we backport this as well?
  
Bruce Richardson March 5, 2024, 3:11 p.m. UTC | #2
On Tue, Mar 05, 2024 at 02:36:27PM +0000, Akhil Goyal wrote:
> > Subject: [EXT] [PATCH] app/test: don't count skipped tests as executed
> > The logic around skipped tests is a little confusing in the unit test
> > runner.
> > * Any explicitly disabled tests are counted as skipped but not
> >   executed.
> > * Any tests that return TEST_SKIPPED are counted as both skipped and
> >   executed, using the same statistics counters.
> > 
> > This makes the stats very strange and hard to correlate, since the
> > totals don't add up.  One would expect that SKIPPED + EXECUTED +
> > UNSUPPORTED == TOTAL, and that PASSED + FAILED == EXECUTED.
> > 
> > To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as
> > not having executed.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Acked-by: Akhil Goyal <gakhil@marvell.com>
Cc: stable@dpdk.org

> 
> Yes this makes sense.
> One would say executed should count the unsupported cases as well.
> But I think this makes sense to not include them in executed cases.

It's a good question and there are arguments either way. I'd say that no
test should return ENOTSUP now, and that such tests should return
TEST_SKIPPED. For now, I think it's best to treat them the same.

> This would give better correlation.
> Can we backport this as well?
> 

If LTS maintainers want it, sure. Adding stable on CC.
  
Power, Ciara March 5, 2024, 3:34 p.m. UTC | #3
Hi Bruce,

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Monday, November 13, 2023 3:06 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH] app/test: don't count skipped tests as executed
> 
> The logic around skipped tests is a little confusing in the unit test runner.
> * Any explicitly disabled tests are counted as skipped but not
>   executed.
> * Any tests that return TEST_SKIPPED are counted as both skipped and
>   executed, using the same statistics counters.
> 
> This makes the stats very strange and hard to correlate, since the totals don't add
> up.  One would expect that SKIPPED + EXECUTED + UNSUPPORTED == TOTAL,
> and that PASSED + FAILED == EXECUTED.
> 
> To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as not
> having executed.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  app/test/test.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test/test.c b/app/test/test.c index bfa9ea52e3..7b882a59de
> 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -375,11 +375,13 @@ unit_test_suite_runner(struct unit_test_suite *suite)
> 
>  			if (test_success == TEST_SUCCESS)
>  				suite->succeeded++;
> -			else if (test_success == TEST_SKIPPED)
> +			else if (test_success == TEST_SKIPPED) {
>  				suite->skipped++;
> -			else if (test_success == -ENOTSUP)
> +				suite->executed--;
> +			} else if (test_success == -ENOTSUP) {
>  				suite->unsupported++;
> -			else
> +				suite->executed--;
> +			} else
>  				suite->failed++;
>  		} else if (test_success == -ENOTSUP) {
>  			suite->unsupported++;
> --
> 2.39.2

Makes sense - probably something I should have spotted way back when reworking some of the test framework for sub-testsuites.
Thanks

Acked-by: Ciara Power <ciara.power@intel.com>
  
Tyler Retzlaff March 5, 2024, 6:08 p.m. UTC | #4
On Mon, Nov 13, 2023 at 03:05:33PM +0000, Bruce Richardson wrote:
> The logic around skipped tests is a little confusing in the unit test
> runner.
> * Any explicitly disabled tests are counted as skipped but not
>   executed.
> * Any tests that return TEST_SKIPPED are counted as both skipped and
>   executed, using the same statistics counters.
> 
> This makes the stats very strange and hard to correlate, since the
> totals don't add up.  One would expect that SKIPPED + EXECUTED +
> UNSUPPORTED == TOTAL, and that PASSED + FAILED == EXECUTED.
> 
> To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as
> not having executed.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Clearly something that was skipped didn't get executed. Solid change.

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
Thomas Monjalon March 6, 2024, 9:34 p.m. UTC | #5
05/03/2024 16:11, Bruce Richardson:
> On Tue, Mar 05, 2024 at 02:36:27PM +0000, Akhil Goyal wrote:
> > > Subject: [EXT] [PATCH] app/test: don't count skipped tests as executed
> > > The logic around skipped tests is a little confusing in the unit test
> > > runner.
> > > * Any explicitly disabled tests are counted as skipped but not
> > >   executed.
> > > * Any tests that return TEST_SKIPPED are counted as both skipped and
> > >   executed, using the same statistics counters.
> > > 
> > > This makes the stats very strange and hard to correlate, since the
> > > totals don't add up.  One would expect that SKIPPED + EXECUTED +
> > > UNSUPPORTED == TOTAL, and that PASSED + FAILED == EXECUTED.
> > > 
> > > To achieve this, mark any tests returning TEST_SKIPPED, or ENOTSUP as
> > > not having executed.
> > > 
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > 
> > Acked-by: Akhil Goyal <gakhil@marvell.com>
> Cc: stable@dpdk.org
> 
> > 
> > Yes this makes sense.
> > One would say executed should count the unsupported cases as well.
> > But I think this makes sense to not include them in executed cases.
> 
> It's a good question and there are arguments either way. I'd say that no
> test should return ENOTSUP now, and that such tests should return
> TEST_SKIPPED. For now, I think it's best to treat them the same.
> 
> > This would give better correlation.
> > Can we backport this as well?
> > 
> 
> If LTS maintainers want it, sure. Adding stable on CC.

Applied, thanks.
  

Patch

diff --git a/app/test/test.c b/app/test/test.c
index bfa9ea52e3..7b882a59de 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -375,11 +375,13 @@  unit_test_suite_runner(struct unit_test_suite *suite)
 
 			if (test_success == TEST_SUCCESS)
 				suite->succeeded++;
-			else if (test_success == TEST_SKIPPED)
+			else if (test_success == TEST_SKIPPED) {
 				suite->skipped++;
-			else if (test_success == -ENOTSUP)
+				suite->executed--;
+			} else if (test_success == -ENOTSUP) {
 				suite->unsupported++;
-			else
+				suite->executed--;
+			} else
 				suite->failed++;
 		} else if (test_success == -ENOTSUP) {
 			suite->unsupported++;