kunit: test: add support for test abort
authorBrendan Higgins <brendanhiggins@google.com>
Mon, 23 Sep 2019 09:02:39 +0000 (02:02 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 30 Sep 2019 23:35:01 +0000 (17:35 -0600)
commit5f3e06208920ee78b68cf3527f40ffbff83cb3bc
tree7282d5a7bd3c57062958e82f4163d6a5c44881c7
parent33adf80f5b52e3f7c55ad66ffcaaff93c6888aaa
kunit: test: add support for test abort

Add support for aborting/bailing out of test cases, which is needed for
implementing assertions.

An assertion is like an expectation, but bails out of the test case
early if the assertion is not met. The idea with assertions is that you
use them to state all the preconditions for your test. Logically
speaking, these are the premises of the test case, so if a premise isn't
true, there is no point in continuing the test case because there are no
conclusions that can be drawn without the premises. Whereas, the
expectation is the thing you are trying to prove.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
include/kunit/test.h
include/kunit/try-catch.h [new file with mode: 0644]
lib/kunit/Makefile
lib/kunit/test.c
lib/kunit/try-catch.c [new file with mode: 0644]