[PATCH 05/16] lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is enabled

From: Yury Norov
Date: Mon Jul 18 2022 - 15:29:14 EST


CONFIG_DEBUG_BITMAP, when enabled, injects __bitmap_check_params()
into bitmap functions. It prevents compiler from compile-time
optimizations, which makes corresponding test fail.

Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
---
lib/test_bitmap.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index bc48d992d10d..8bd279a7633f 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -877,6 +877,7 @@ static void __init test_bitmap_print_buf(void)

static void __init test_bitmap_const_eval(void)
{
+#ifndef CONFIG_DEBUG_BITMAP
DECLARE_BITMAP(bitmap, BITS_PER_LONG);
unsigned long initvar = BIT(2);
unsigned long bitopvar = 0;
@@ -934,6 +935,7 @@ static void __init test_bitmap_const_eval(void)
/* ~BIT(25) */
BUILD_BUG_ON(!__builtin_constant_p(~var));
BUILD_BUG_ON(~var != ~BIT(25));
+#endif
}

static void __init selftest(void)
--
2.34.1