kunit: Fix result propagation for parameterised tests
authorDavid Gow <davidgow@google.com>
Fri, 11 Jun 2021 03:57:25 +0000 (20:57 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 11 Jun 2021 21:50:38 +0000 (15:50 -0600)
commit384426bd101cb3cd580b18de19d4891ec5ca5bf9
tree776cd8a8fb13a6aa51fdaaaaf3c943015d0c9513
parentd7eab3df8f39b116d934bc17f8070861e18cfb62
kunit: Fix result propagation for parameterised tests

When one parameter of a parameterised test failed, its failure would be
propagated to the overall test, but not to the suite result (unless it
was the last parameter).

This is because test_case->success was being reset to the test->success
result after each parameter was used, so a failing test's result would
be overwritten by a non-failing result. The overall test result was
handled in a third variable, test_result, but this was discarded after
the status line was printed.

Instead, just propagate the result after each parameter run.

Signed-off-by: David Gow <davidgow@google.com>
Fixes: fadb08e7c750 ("kunit: Support for Parameterized Testing")
Reviewed-by: Marco Elver <elver@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/test.c