Commit 74864403 authored by Laura Nao's avatar Laura Nao Committed by Shuah Khan
Browse files

selftests: Warn about skipped tests in result summary

Update the functions that print the test totals at the end of a selftest
to include a warning message when skipped tests are detected. The
message advises users that skipped tests may indicate missing
configuration options and suggests enabling them to improve coverage.

Link: https://lore.kernel.org/r/20241126093710.13314-1-laura.nao@collabora.com


Signed-off-by: default avatarLaura Nao <laura.nao@collabora.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent e8731ecd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -149,6 +149,11 @@ static inline void ksft_set_plan(unsigned int plan)

static inline void ksft_print_cnts(void)
{
	if (ksft_cnt.ksft_xskip > 0)
		printf(
			"# %u skipped test(s) detected. Consider enabling relevant config options to improve coverage.\n",
			ksft_cnt.ksft_xskip
		);
	if (ksft_plan != ksft_test_num())
		printf("# Planned tests != run tests (%u != %u)\n",
			ksft_plan, ksft_test_num());
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ def set_plan(num_tests):


def print_cnts():
    if ksft_cnt['skip'] > 0:
        print(f"# {ksft_cnt['skip']} skipped test(s) detected. Consider enabling relevant config options to improve coverage.")

    print(
        f"# Totals: pass:{ksft_cnt['pass']} fail:{ksft_cnt['fail']} xfail:0 xpass:0 skip:{ksft_cnt['skip']} error:0"
    )
+4 −0
Original line number Diff line number Diff line
@@ -107,5 +107,9 @@ ktap_finished() {
}

ktap_print_totals() {
	if [ "$KTAP_CNT_SKIP" -gt 0 ]; then
		echo "# $KTAP_CNT_SKIP skipped test(s) detected. " \
			"Consider enabling relevant config options to improve coverage."
	fi
	echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
}