* [PATCH v2] kunit: fix assert_type for comparison macros
@ 2022-08-21 15:01 Sander Vanheule
2022-08-22 17:22 ` Daniel Latypov
2022-08-29 22:43 ` Brendan Higgins
0 siblings, 2 replies; 3+ messages in thread
From: Sander Vanheule @ 2022-08-21 15:01 UTC (permalink / raw)
To: Brendan Higgins, David Gow, Daniel Latypov, Shuah Khan,
linux-kselftest, kunit-dev
Cc: linux-kernel, Sander Vanheule
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: 40f39777ce4f ("kunit: decrease macro layering for integer asserts")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
include/kunit/test.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/kunit/test.h b/include/kunit/test.h
index c958855681cc..840a2c375065 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -826,7 +826,7 @@ do { \
#define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \
KUNIT_BINARY_INT_ASSERTION(test, \
- KUNIT_ASSERTION, \
+ KUNIT_EXPECTATION, \
left, <=, right, \
fmt, \
##__VA_ARGS__)
@@ -1116,7 +1116,7 @@ do { \
#define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \
KUNIT_BINARY_INT_ASSERTION(test, \
- KUNIT_EXPECTATION, \
+ KUNIT_ASSERTION, \
left, <, right, \
fmt, \
##__VA_ARGS__)
@@ -1157,7 +1157,7 @@ do { \
#define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \
KUNIT_BINARY_INT_ASSERTION(test, \
- KUNIT_EXPECTATION, \
+ KUNIT_ASSERTION, \
left, >, right, \
fmt, \
##__VA_ARGS__)
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kunit: fix assert_type for comparison macros
2022-08-21 15:01 [PATCH v2] kunit: fix assert_type for comparison macros Sander Vanheule
@ 2022-08-22 17:22 ` Daniel Latypov
2022-08-29 22:43 ` Brendan Higgins
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Latypov @ 2022-08-22 17:22 UTC (permalink / raw)
To: Sander Vanheule
Cc: Brendan Higgins, David Gow, Shuah Khan, linux-kselftest,
kunit-dev, linux-kernel
On Sun, Aug 21, 2022 at 8:02 AM Sander Vanheule <sander@svanheule.net> wrote:
>
> 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: 40f39777ce4f ("kunit: decrease macro layering for integer asserts")
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
Thanks for catching this!
I scanned over the file again looking for other errors. I think this
patch fixes all of them.
Reviewed-by: Daniel Latypov <dlatypov@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kunit: fix assert_type for comparison macros
2022-08-21 15:01 [PATCH v2] kunit: fix assert_type for comparison macros Sander Vanheule
2022-08-22 17:22 ` Daniel Latypov
@ 2022-08-29 22:43 ` Brendan Higgins
1 sibling, 0 replies; 3+ messages in thread
From: Brendan Higgins @ 2022-08-29 22:43 UTC (permalink / raw)
To: Sander Vanheule
Cc: Brendan Higgins, David Gow, Daniel Latypov, Shuah Khan,
linux-kselftest, kunit-dev, linux-kernel
On Sun, Aug 21, 2022 at 8:02 AM Sander Vanheule <sander@svanheule.net> wrote:
>
> 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: 40f39777ce4f ("kunit: decrease macro layering for integer asserts")
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
Thanks for fixing this!
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-29 22:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-21 15:01 [PATCH v2] kunit: fix assert_type for comparison macros Sander Vanheule
2022-08-22 17:22 ` Daniel Latypov
2022-08-29 22:43 ` Brendan Higgins
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.