mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	Having CONFIG_OF_EMBED=y && CONFIG_BLOBLIST=n leads to the link
error:
```
ld: /tmp/ccRVty.ltrans40.ltrans.o: in function `lib_test_is_enabled':
test/lib/kconfig.c:24: undefined reference to \
                                       `invalid_use_of_IF_ENABLED_INT'
ld: test/lib/kconfig.c:26: undefined reference to \
                                `invalid_use_of_CONFIG_IF_ENABLED_INT'
```
Fixes: 29784d62ede ("test: Add some tests for kconfig.h")
Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
		
	
			
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0+
 | 
						|
/*
 | 
						|
 * Test of linux/kconfig.h macros
 | 
						|
 *
 | 
						|
 * Copyright 2022 Google LLC
 | 
						|
 * Written by Simon Glass <sjg@chromium.org>
 | 
						|
 */
 | 
						|
 | 
						|
#include <test/lib.h>
 | 
						|
#include <test/test.h>
 | 
						|
#include <test/ut.h>
 | 
						|
 | 
						|
static int lib_test_is_enabled(struct unit_test_state *uts)
 | 
						|
{
 | 
						|
	ulong val;
 | 
						|
 | 
						|
	ut_asserteq(1, IS_ENABLED(CONFIG_CMDLINE));
 | 
						|
	ut_asserteq(0, IS_ENABLED(CONFIG__UNDEFINED));
 | 
						|
 | 
						|
	ut_asserteq(1, CONFIG_IS_ENABLED(CMDLINE));
 | 
						|
	ut_asserteq(0, CONFIG_IS_ENABLED(OF_PLATDATA));
 | 
						|
	ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED));
 | 
						|
 | 
						|
	if (IS_ENABLED(CONFIG_BLOBLIST)) {
 | 
						|
		ut_asserteq(0xb000, IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
 | 
						|
						   CONFIG_BLOBLIST_ADDR));
 | 
						|
		ut_asserteq(0xb000, CONFIG_IF_ENABLED_INT(BLOBLIST_FIXED,
 | 
						|
							  BLOBLIST_ADDR));
 | 
						|
	}
 | 
						|
 | 
						|
	/*
 | 
						|
	 * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
 | 
						|
	 * value is used. Disable for SPL so that the errors in kconfig_spl.c
 | 
						|
	 * are detected, since otherwise a build error when building U-Boot may
 | 
						|
	 * cause SPL to not be built.
 | 
						|
	 */
 | 
						|
	if (!IS_ENABLED(CONFIG_SANDBOX_SPL) &&
 | 
						|
	    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. Disable for SPL so that the errors in kconfig_spl.c
 | 
						|
	 * are detected, since otherwise a build error when building U-Boot may
 | 
						|
	 * cause SPL to not be built.
 | 
						|
	 */
 | 
						|
	if (!IS_ENABLED(CONFIG_SANDBOX_SPL) &&
 | 
						|
	    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_is_enabled, 0);
 |