On Thu, Jun 13, 2024, Muhammad Usama Anjum wrote:
As above, AFAICT it comes from Google's internal test infrastructure (KVM selftests came from Google).
Its even better if we use ksft_exit_fail_msg() which will print out "Bail out" meaning the test exited without completing. This string is TAP protocol specific.
This is debatable and not obviously correct. The documentation says:
Bail out! As an emergency measure a test script can decide that further tests are useless (e.g. missing dependencies) and testing should stop immediately. In that case the test script prints the magic words
which suggests that a test should only emit "Bail out!" if it wants to stop entirely. We definitely don't want KVM selftests to bail out if a TEST_ASSERT() fails in one testcase.
But KVM tests are bailing out if assert fails, exit(254) is being called which stops the further execution of the test cases.
Not if the TEST_ASSERT() fires from within a test fixture, in which case the magic in tools/testing/selftests/kselftest_harness.h captures the failure but continues on with the next test.