1# SPDX-License-Identifier: GPL-2.0 2# Copyright 2022 Google LLC 3# Written by Simon Glass <sjg@chromium.org> 4 5import pytest 6 7import u_boot_utils as util 8 9# This is needed for Azure, since the default '..' directory is not writeable 10TMPDIR = '/tmp/test_kconfig' 11 12@pytest.mark.slow 13@pytest.mark.boardspec('sandbox') 14def test_kconfig(u_boot_console): 15 """Test build failures when IF_ENABLED_INT() option is not enabled""" 16 cons = u_boot_console 17 18 # This detects build errors in test/lib/kconfig.c 19 out = util.run_and_log( 20 cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox', 21 '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) 22 assert 'invalid_use_of_IF_ENABLED_INT' in out 23 assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' in out 24 25@pytest.mark.slow 26@pytest.mark.boardspec('sandbox_spl') 27def test_kconfig_spl(u_boot_console): 28 """Test build failures when IF_ENABLED_INT() option is not enabled""" 29 cons = u_boot_console 30 31 # This detects build errors in test/lib/kconfig_spl.c 32 out = util.run_and_log( 33 cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl', 34 '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) 35 assert 'invalid_use_of_IF_ENABLED_INT' in out 36 37 # There is no CONFIG_SPL_TEST_KCONFIG, so the CONFIG_IF_ENABLED_INT() 38 # line should not generate an error 39 assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out 40