OSDN Git Service

kunit: Support skipped tests
authorDavid Gow <davidgow@google.com>
Fri, 25 Jun 2021 06:58:12 +0000 (23:58 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 25 Jun 2021 17:31:03 +0000 (11:31 -0600)
commit6d2426b2f258da19fbe5fa1c93a5695460390eac
treed7d61a00ca25fea95d9e7b0e3534dbd0fa1bd7a6
parent824945a5b0ff8260a568b87968172d728446d8f7
kunit: Support skipped tests

The kunit_mark_skipped() macro marks the current test as "skipped", with
the provided reason. The kunit_skip() macro will mark the test as
skipped, and abort the test.

The TAP specification supports this "SKIP directive" as a comment after
the "ok" / "not ok" for a test. See the "Directives" section of the TAP
spec for details:
https://testanything.org/tap-specification.html#directives

The 'success' field for KUnit tests is replaced with a kunit_status
enum, which can be SUCCESS, FAILURE, or SKIPPED, combined with a
'status_comment' containing information on why a test was skipped.

A new 'kunit_status' test suite is added to test this.

Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Marco Elver <elver@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
include/kunit/test.h
lib/kunit/debugfs.c
lib/kunit/kunit-test.c
lib/kunit/test.c