app/test: don't count skipped tests as executed
PATCH 1/1 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.
--- app/test/test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
app/test/test.c +5 -3
@@ -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++;
Signature · 1 line
2.39.2
Quoted 8 lines
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 returnTEST_SKIPPEDare counted as both skipped and executed, using the same statistics counters.
Quoted 8 lines
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 <[email protected]>
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?
Quoted 12 lines · Akhil Goyal
Quoted 12 lines
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 returnTEST_SKIPPEDare 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.
Quoted 6 lines
Quoted 4 lines
To achieve this, mark any tests returning
TEST_SKIPPED, or ENOTSUP as not having executed.Signed-off-by Bruce Richardson <[email protected]>Acked-by Akhil Goyal <[email protected]>
Quoted 4 lines
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.
Quoted 3 lines
This would give better correlation.
Can we backport this as well?
If LTS maintainers want it, sure. Adding stable on CC.
Thomas Monjalon
Applied05/03/2024 16:11, Bruce Richardson:
Quoted 30 lines · Akhil Goyal
Quoted 12 lines
Quoted 12 lines
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 returnTEST_SKIPPEDare 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.
Quoted 6 lines
Quoted 4 lines
To achieve this, mark any tests returning
TEST_SKIPPED, or ENOTSUP as not having executed.Signed-off-by Bruce Richardson <[email protected]>Acked-by Akhil Goyal <[email protected]>Quoted 4 lines
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.
Quoted 5 lines
Quoted 3 lines
This would give better correlation.
Can we backport this as well?If LTS maintainers want it, sure. Adding stable on CC.
Applied, thanks.
Hi Bruce,
Quoted 47 lines
-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, November 13, 2023 3:06 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>
Subject: [PATCH] app/test: don't count skipped tests as executedThe 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 returnTEST_SKIPPEDare 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 <[email protected]>--- app/test/test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)app/test/test.c index bfa9ea52e3..7b882a59de renamed from app/test/test.c +0
-0100644
app/test/test.c +5
-4@@ -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++; --
Quoted 1 line
2.39.2
Makes sense - probably something I should have spotted way back when reworking some of the test framework for sub-testsuites. Thanks
Quoted 11 lines · Bruce Richardson
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 returnTEST_SKIPPEDare 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.
Quoted 5 lines
To achieve this, mark any tests returning
TEST_SKIPPED, or ENOTSUP as not having executed.Signed-off-by Bruce Richardson <[email protected]>---
Clearly something that was skipped didn't get executed. Solid change.