]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: fix assert_type for comparison macros
authorSander Vanheule <sander@svanheule.net>
Sun, 21 Aug 2022 15:01:47 +0000 (17:01 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 1 Sep 2022 19:00:32 +0000 (13:00 -0600)
commit2474d86a5ea43c46f1c7c397f0f8d29e22ce42ec
tree4886d43d5c43dd49a626a8abab9d4a3ce6bf9ec6
parent79cfbe979036b3a4225ababf794354e507993621
kunit: fix assert_type for comparison macros

When replacing KUNIT_BINARY_*_MSG_ASSERTION() macros with
KUNIT_BINARY_INT_ASSERTION(), the assert_type parameter was not always
correctly transferred.  Specifically, the following errors were
introduced:
  - KUNIT_EXPECT_LE_MSG() uses KUNIT_ASSERTION
  - KUNIT_ASSERT_LT_MSG() uses KUNIT_EXPECTATION
  - KUNIT_ASSERT_GT_MSG() uses KUNIT_EXPECTATION

A failing KUNIT_EXPECT_LE_MSG() test thus prevents further tests from
running, while failing KUNIT_ASSERT_{LT,GT}_MSG() tests do not prevent
further tests from running.  This is contrary to the documentation,
which states that failing KUNIT_EXPECT_* macros allow further tests to
run, while failing KUNIT_ASSERT_* macros should prevent this.

Revert the KUNIT_{ASSERTION,EXPECTATION} switches to fix the behaviour
for the affected macros.

Fixes: d3600f1e3ae5 ("kunit: decrease macro layering for integer asserts")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
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