selftests: fix test group SKIPPED result
Subsystems (3)
PATCH 1/1 selftests: fix test group SKIPPED result
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIP
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OK
--- tools/testing/selftests/bpf/test_progs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_progs.c +9 -2
@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;
@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );
@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns ();
Signature · 1 line
2.30.2
Quoted 11 lines · Domenico Cerasuolo
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIP
Quoted 6 lines
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OK
I'm not sure don't you want to know that some of the tests were skipped? With this change its not knowable from output if everything passed or one passed.
I would prefer the behavior: If anything fails return FAIL, else if anything is skipped SKIP and if _everything_ passes mark it OK.
My preference is to drop this change.
Quoted 45 lines
Signed-off-by Domenico Cerasuolo <[email protected]>--- tools/testing/selftests/bpf/test_progs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_progs.c +9
-2@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns ();Signature · 1 line
2.30.2
Hi John,
Test FAILs when there is an unexpected condition during test/subtest execution, developer does not control it. Hence we propagate FAIL subtest result to be the test result, test_progs result and consequently CI result.
On the other hand, SKIP state is fully controlled by us. E.g. we decide when particular subtest/test should be skipped. We do not propagate SKIP state to the test_progs result. test_progs result can either be OK or FAIL. Also, SKIPPED subtest is not an indication of a problem in a test. Hence, I do not think one SKIPPED subtest should mark the whole test as SKIPPED.
For example, core_reloc_btfgen has 77 subtests (https://github.com/kernel-patches/bpf/actions/runs/3349035937/jobs/5548924891#step:6:4895). Some of them are skipped right now. However, most of them are passing. It is a normal state. For me, marking core_reloc_btfgen as SKIP would mean that something is not right with the whole test. Also, I do not think we are reviewing SKIP tests / subtests right now. Maybe we should. But this would be orthogonal discussion to this patch.
Quoted 78 lines · John Fastabend
Quoted 11 lines · Domenico Cerasuolo
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIPQuoted 6 lines
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OKI'm not sure don't you want to know that some of the tests were skipped? With this change its not knowable from output if everything passed or one passed.
I would prefer the behavior: If anything fails return FAIL, else if anything is skipped SKIP and if _everything_ passes mark it OK.
My preference is to drop this change.
Quoted 45 lines
Signed-off-by Domenico Cerasuolo <[email protected]>---
tools/testing/selftests/bpf/test_progs.c| 11 +++++++++--1 file changed, 9 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_progs.c +9
-2@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns ();Signature · 1 line
2.30.2
Daniel Borkmann
maintainerHi Mykola, hi Domenico,
Quoted 6 lines · Mykola Lysenko
Hi John,
Test FAILs when there is an unexpected condition during test/subtest execution, developer does not control it. Hence we propagate FAIL subtest result to be the test result,
test_progsresult and consequently CI result.
On the other hand, SKIP state is fully controlled by us. E.g. we decide when particular subtest/test should be skipped. We do not propagate SKIP state to thetest_progsresult.test_progsresult can either be OK or FAIL. Also, SKIPPED subtest is not an indication of a problem in a test. Hence, I do not think one SKIPPED subtest should mark the whole test as SKIPPED.For example,
core_reloc_btfgenhas 77 subtests (https://github.com/kernel-patches/bpf/actions/runs/3349035937/jobs/5548924891#step:6:4895). Some of them are skipped right now. However, most of them are passing. It is a normal state. For me, markingcore_reloc_btfgenas SKIP would mean that something is not right with the whole test. Also, I do not think we are reviewing SKIP tests / subtests right now. Maybe we should. But this would be orthogonal discussion to this patch.
I think parts of the above should probably be incorporated into the below commit description to better explain the rationale for the change.
Quoted 8 lines
Quoted 8 lines · John Fastabend
Quoted 5 lines · Domenico Cerasuolo
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as
nit: subtets
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIPQuoted 6 lines
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OKI'm not sure don't you want to know that some of the tests were skipped? With this change its not knowable from output if everything passed or one passed.
Quoted 5 lines
Quoted 5 lines
I would prefer the behavior: If anything fails return FAIL, else if anything is skipped SKIP and if _everything_ passes mark it OK.
My preference is to drop this change.
I guess for manual testing you could just grep for usdt and see all subtest results. I think changing from SKIP to OK is fine, but could we indicate e.g. "usdt:OK (SKIP:1/2)" to differ from "usdt:OK" where nothing had to be skipped? Presumably this would address John's concern, too.
Quoted 47 lines
Quoted 46 lines
Quoted 44 lines
Signed-off-by Domenico Cerasuolo <[email protected]>---
tools/testing/selftests/bpf/test_progs.c| 11 +++++++++--1 file changed, 9 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_progs.c +9
-2@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns ();Signature · 1 line
2.30.2
Quoted 5 lines · Daniel Borkmann
Hi Mykola, hi Domenico,
Thanks for the feedback Daniel! It makes sense and we will look at addressing it.
Quoted 92 lines · Mykola Lysenko
Quoted 4 lines
Hi John,
Test FAILs when there is an unexpected condition during test/subtest execution, developer does not control it. Hence we propagate FAIL subtest result to be the test result,test_progsresult and consequently CI result.
On the other hand, SKIP state is fully controlled by us. E.g. we decide when particular subtest/test should be skipped. We do not propagate SKIP state to thetest_progsresult.test_progsresult can either be OK or FAIL. Also, SKIPPED subtest is not an indication of a problem in a test. Hence, I do not think one SKIPPED subtest should mark the whole test as SKIPPED.
For example,core_reloc_btfgenhas 77 subtests (https://github.com/kernel-patches/bpf/actions/runs/3349035937/jobs/5548924891#step:6:4895). Some of them are skipped right now. However, most of them are passing. It is a normal state. For me, markingcore_reloc_btfgenas SKIP would mean that something is not right with the whole test. Also, I do not think we are reviewing SKIP tests / subtests right now. Maybe we should. But this would be orthogonal discussion to this patch.I think parts of the above should probably be incorporated into the below commit description to better explain the rationale for the change.
Quoted 8 lines
Quoted 8 lines · John Fastabend
Quoted 5 lines · Domenico Cerasuolo
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as
nit: subtets
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIPQuoted 6 lines
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OKI'm not sure don't you want to know that some of the tests were skipped? With this change its not knowable from output if everything passed or one passed.
Quoted 5 lines
Quoted 5 lines
I would prefer the behavior: If anything fails return FAIL, else if anything is skipped SKIP and if _everything_ passes mark it OK.
My preference is to drop this change.
I guess for manual testing you could just grep for usdt and see all subtest results. I think changing from SKIP to OK is fine, but could we indicate e.g. "usdt:OK (SKIP:1/2)" to differ from "usdt:OK" where nothing had to be skipped? Presumably this would address John's concern, too.
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Signed-off-by Domenico Cerasuolo <[email protected]>---
tools/testing/selftests/bpf/test_progs.c| 11 +++++++++--1 file changed, 9 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_progs.c +9
-2@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns ();Signature · 1 line
2.30.2
Quoted 5 lines · Mykola Lysenko
Hi John,
Test FAILs when there is an unexpected condition during test/subtest execution, developer does not control it. Hence we propagate FAIL subtest result to be the test result,
test_progsresult and consequently CI result. On the other hand, SKIP state is fully controlled by us.
So this is not entirely correct. Tests can "skip themselves" if they detect conditions under which they can't run (e.g., hardware perf events support). So in some contexts SKIP might be surprising.
What Daniel proposed looks good to me, we'd be able to quickly tell if a test had some skipped subtests and how many.
Quoted 84 lines
E.g. we decide when particular subtest/test should be skipped. We do not propagate SKIP state to the
test_progsresult.test_progsresult can either be OK or FAIL. Also, SKIPPED subtest is not an indication of a problem in a test. Hence, I do not think one SKIPPED subtest should mark the whole test as SKIPPED.For example,
core_reloc_btfgenhas 77 subtests (https://github.com/kernel-patches/bpf/actions/runs/3349035937/jobs/5548924891#step:6:4895). Some of them are skipped right now. However, most of them are passing. It is a normal state. For me, markingcore_reloc_btfgenas SKIP would mean that something is not right with the whole test. Also, I do not think we are reviewing SKIP tests / subtests right now. Maybe we should. But this would be orthogonal discussion to this patch.Quoted 78 lines · John Fastabend
Quoted 11 lines · Domenico Cerasuolo
From: Domenico Cerasuolo <[email protected]>
When showing the result of a test group, if one of the subtests was skipped, while still having passing subtets, the group result was marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:SKIPQuoted 6 lines
With this change only if all of the subtests were skipped the group test is marked as SKIPPED.
#223/1 usdt/basic:SKIP #223/2 usdt/multispec:OK #223 usdt:OKI'm not sure don't you want to know that some of the tests were skipped? With this change its not knowable from output if everything passed or one passed.
I would prefer the behavior: If anything fails return FAIL, else if anything is skipped SKIP and if _everything_ passes mark it OK.
My preference is to drop this change.
Quoted 45 lines
Signed-off-by Domenico Cerasuolo <[email protected]>---
tools/testing/selftests/bpf/test_progs.c| 11 +++++++++--1 file changed, 9 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_progs.c +9
-3@@ -222,6 +222,11 @@ static char *test_result(bool failed, bool skipped)return failed ?"FAIL" : (skipped ?"SKIP" :"OK" ); } +static char *test_group_result (int tests_count,bool failed,int skipped) +{ +return failed ?"FAIL" : (skipped == tests_count ?"SKIP" :"OK" ); +} +static void print_test_log (char *log_buf,size_t log_cnt) { log_buf[log_cnt] ='\0' ;@@ -308,7 +313,8 @@ static void dump_test_log(const struct prog_test_def *test, }print_test_name (test->test_num, test->test_name, -test_result (test_failed, test_state->skip_cnt)); +test_group_result (test_state->subtest_num, + test_failed, test_state->skip_cnt)); }static void stdio_restore (void );@@ -1071,7 +1077,8 @@ static void run_one_test(int test_num)if (verbose () && env.worker_id ==-1 )print_test_name (test_num +1 , test->test_name, -test_result (state->error_cnt, state->skip_cnt)); +test_group_result (state->subtest_num, + state->error_cnt, state->skip_cnt));reset_affinity ();restore_netns (); --2.30.2