mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-13 06:42:56 +00:00
fa847bb409
Wrap the assert macros in ({ ... }) so they can be safely used both as right side argument as well as in conditionals without curly brackets around them. In the process, find a bunch of missing semicolons, fix them. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
44 lines
1 KiB
C
44 lines
1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Test of linux/kconfig.h macros for SPL
|
|
*
|
|
* Copyright 2022 Google LLC
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <test/lib.h>
|
|
#include <test/test.h>
|
|
#include <test/ut.h>
|
|
|
|
static int lib_test_spl_is_enabled(struct unit_test_state *uts)
|
|
{
|
|
ulong val;
|
|
|
|
ut_asserteq(0, CONFIG_IS_ENABLED(CMDLINE));
|
|
ut_asserteq(1, CONFIG_IS_ENABLED(OF_PLATDATA));
|
|
ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED));
|
|
|
|
/*
|
|
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
|
|
* value is used.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_TEST_KCONFIG)) {
|
|
val = IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
|
|
CONFIG_TEST_KCONFIG_VALUE);
|
|
printf("value %ld\n", val);
|
|
}
|
|
|
|
/*
|
|
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
|
|
* value is used.
|
|
*/
|
|
if (CONFIG_IS_ENABLED(TEST_KCONFIG)) {
|
|
val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
|
|
TEST_KCONFIG_VALUE);
|
|
printf("value2 %ld\n", val);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
LIB_TEST(lib_test_spl_is_enabled, 0);
|