Skip to contentSkip to conversation

kunit: fix assert_type for KUNIT_EXPECT_LE_MSG()

PATCH In review Sander Vanheule 1 participant 2 messages Aug 21, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kunit: fix assert_type for KUNIT_EXPECT_LE_MSG()

When replacing KUNIT_BINARY_LE_MSG_ASSERTION() with KUNIT_BINARY_INT_ASSERTION() for KUNIT_EXPECT_LE_MSG(), the assert_type parameter was changed from KUNIT_EXPECTATION to KUNIT_ASSERTION. This causes KUNIT_EXPECT_LE_MSG() and KUNIT_ASSERT_LE_MSG() to behave the same way, and tests after a failed KUNIT_EXPECT_LE_MSG() are not run.

Call KUNIT_BINARY_INT_ASSERTIO() with KUNIT_EXPECTATION for again match the documented behavior for KUNIT_EXPECT_* macros.

Fixes 40f39777ce4f ("kunit: decrease macro layering for integer asserts")
---
 include/kunit/test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/kunit/test.h +1 -1
index c958855681cc..617ec995671d 100644
@@ -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__)
Signature · 1 line
2.37.2
#1 lore raw

Hi everyone,

Quoted 6 lines · Sander Vanheule

When replacing KUNIT_BINARY_LE_MSG_ASSERTION() with KUNIT_BINARY_INT_ASSERTION() for KUNIT_EXPECT_LE_MSG(), the assert_type parameter was changed from KUNIT_EXPECTATION to KUNIT_ASSERTION.  This causes KUNIT_EXPECT_LE_MSG() and KUNIT_ASSERT_LE_MSG() to behave the same way, and tests after a failed KUNIT_EXPECT_LE_MSG() are not run.

Quoted 6 lines

Call KUNIT_BINARY_INT_ASSERTIO() with KUNIT_EXPECTATION for again match the documented behavior for KUNIT_EXPECT_* macros.

Fixes 40f39777ce4f ("kunit: decrease macro layering for integer asserts")

---

My apologies for the sloppiness, but I accidentally sent out an incomplete version of this patch. Please disregards this patch, v2 is already posted.

Sorry for the noise!

Best,
Sander

Quoted 24 lines

 include/kunit/test.h | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
include/kunit/test.h +0 -0
index c958855681cc..617ec995671d 100644
@@ -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__)