Skip to contentSkip to conversation

lib: kunit: Fix compilation test when using TEST_BIT_FIELD_COMPILE

PATCH In review Vitor Massaru Iha 3 participants 3 messages Oct 15, 2020 – Oct 16, 2020

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

PATCH 1/1 lib: kunit: Fix compilation test when using TEST_BIT_FIELD_COMPILE

A build condition was missing around a compilation test, this compilation test comes from the original test_bitfield code.

And removed unnecessary code for this test.

Fixes d2585f5164c2 ("lib: kunit: add bitfield test conversion to KUnit")
---
 lib/bitfield_kunit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
lib/bitfield_kunit.c +2 -4
index d63a2be5aff8..1473d8b4bf0f 100644
@@ -125,7 +125,7 @@ static void __init test_bitfields_variables(struct kunit *context)
 	CHECK(u64, 0x0000001f8000000ull);
 }
 
-
+#ifdef TEST_BITFIELD_COMPILE
 static void __init test_bitfields_compile(struct kunit *context)
 {
 	/* these should fail compilation */
@@ -135,13 +135,11 @@ static void __init test_bitfields_compile(struct kunit *context)
 	/* this should at least give a warning */
 	u16_encode_bits(0, 0x60000);
 }
+#endif
 
 static struct kunit_case __refdata bitfields_test_cases[] = {
 	KUNIT_CASE(test_bitfields_constants),
 	KUNIT_CASE(test_bitfields_variables),
-#ifdef TEST_BITFIELD_COMPILE
-	KUNIT_CASE(test_bitfields_compile),
-#endif
 	{}
 };
 

base-commit: d2585f5164c298aaaed14c2c8d313cbe7bd5b253

Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Vitor Massaru Iha

A build condition was missing around a compilation test, this compilation test comes from the original test_bitfield code.

And removed unnecessary code for this test.

Fixes d2585f5164c2 ("lib: kunit: add bitfield test conversion to KUnit")

Thanks for taking care of this so quickly!

maintainer
#2 lore raw
Quoted 7 lines · Brendan Higgins
Quoted 6 lines · Vitor Massaru Iha

A build condition was missing around a compilation test, this compilation test comes from the original test_bitfield code.

And removed unnecessary code for this test.

Quoted 8 lines
Quoted 3 lines
Fixes d2585f5164c2 ("lib: kunit: add bitfield test conversion to KUnit")

Thanks for taking care of this so quickly!

Thank you both.

Applied to linux-kselftest kunit branch
I will send the pull request with this in a day or two.

Added Reported-by for Stephen. Thanks for finding the problem.

thanks,
-- Shuah