diff options
author | Tom Rini <trini@konsulko.com> | 2022-08-10 17:49:20 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-10 17:49:20 -0400 |
commit | cdebee1fd9fa04cc4c972f826bae19b28c253eb0 (patch) | |
tree | 97a13d6a54ea8cb825d19cd65d4c9480ffd327dc /test/lib/kconfig_spl.c | |
parent | 3dd4e916324efc825a7ee8e412f5cf1ded839021 (diff) | |
parent | 468091a4602f78aaa11d41190ae66d8b240e144a (diff) |
Merge branch '2022-08-10-assorted-updates'
- An assortment of bugfixes and minor updates
Diffstat (limited to 'test/lib/kconfig_spl.c')
-rw-r--r-- | test/lib/kconfig_spl.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/lib/kconfig_spl.c b/test/lib/kconfig_spl.c new file mode 100644 index 00000000000..c89ceaec66f --- /dev/null +++ b/test/lib/kconfig_spl.c @@ -0,0 +1,44 @@ +// 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); |