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: d2585f5164 ("lib: kunit: add bitfield test conversion to KUnit")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
Link: https://lore.kernel.org/linux-next/20201015163056.56fcc835@canb.auug.org.au/
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Vitor Massaru Iha 2020-10-15 09:08:51 -03:00 committed by Shuah Khan
parent d2585f5164
commit 294a7f1613

View File

@ -125,7 +125,7 @@ static void __init test_bitfields_variables(struct kunit *context)
CHECK(u64, 0x0000001f8000000ull); CHECK(u64, 0x0000001f8000000ull);
} }
#ifdef TEST_BITFIELD_COMPILE
static void __init test_bitfields_compile(struct kunit *context) static void __init test_bitfields_compile(struct kunit *context)
{ {
/* these should fail compilation */ /* these should fail compilation */
@ -135,13 +135,11 @@ static void __init test_bitfields_compile(struct kunit *context)
/* this should at least give a warning */ /* this should at least give a warning */
u16_encode_bits(0, 0x60000); u16_encode_bits(0, 0x60000);
} }
#endif
static struct kunit_case __refdata bitfields_test_cases[] = { static struct kunit_case __refdata bitfields_test_cases[] = {
KUNIT_CASE(test_bitfields_constants), KUNIT_CASE(test_bitfields_constants),
KUNIT_CASE(test_bitfields_variables), KUNIT_CASE(test_bitfields_variables),
#ifdef TEST_BITFIELD_COMPILE
KUNIT_CASE(test_bitfields_compile),
#endif
{} {}
}; };