blob: 0c261d47975409d591de8a3701d740334b03e62c [file] [log] [blame]
Simon Glass644d8072022-08-01 07:57:59 -06001# SPDX-License-Identifier: GPL-2.0
2# Copyright 2022 Google LLC
3# Written by Simon Glass <sjg@chromium.org>
4
5import pytest
6
Simon Glassdb0e4532025-02-09 09:07:16 -07007import utils
Simon Glass644d8072022-08-01 07:57:59 -06008
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')
Simon Glassddba5202025-02-09 09:07:14 -070014def test_kconfig(ubman):
Simon Glass644d8072022-08-01 07:57:59 -060015 """Test build failures when IF_ENABLED_INT() option is not enabled"""
Simon Glass644d8072022-08-01 07:57:59 -060016
17 # This detects build errors in test/lib/kconfig.c
Simon Glassdb0e4532025-02-09 09:07:16 -070018 out = utils.run_and_log(
Simon Glass32701112025-02-09 09:07:17 -070019 ubman, ['./tools/buildman/buildman', '-m', '--board', 'sandbox',
Simon Glass644d8072022-08-01 07:57:59 -060020 '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True)
21 assert 'invalid_use_of_IF_ENABLED_INT' in out
22 assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' in out
23
24@pytest.mark.slow
25@pytest.mark.boardspec('sandbox_spl')
Simon Glassddba5202025-02-09 09:07:14 -070026def test_kconfig_spl(ubman):
Simon Glass644d8072022-08-01 07:57:59 -060027 """Test build failures when IF_ENABLED_INT() option is not enabled"""
Simon Glass644d8072022-08-01 07:57:59 -060028
29 # This detects build errors in test/lib/kconfig_spl.c
Simon Glassdb0e4532025-02-09 09:07:16 -070030 out = utils.run_and_log(
Simon Glass32701112025-02-09 09:07:17 -070031 ubman, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl',
Simon Glass644d8072022-08-01 07:57:59 -060032 '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True)
33 assert 'invalid_use_of_IF_ENABLED_INT' in out
34
35 # There is no CONFIG_SPL_TEST_KCONFIG, so the CONFIG_IF_ENABLED_INT()
36 # line should not generate an error
37 assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out