Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # Copyright 2022 Google LLC |
| 3 | # Written by Simon Glass <sjg@chromium.org> |
| 4 | |
| 5 | import pytest |
| 6 | |
Simon Glass | db0e453 | 2025-02-09 09:07:16 -0700 | [diff] [blame] | 7 | import utils |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 8 | |
| 9 | # This is needed for Azure, since the default '..' directory is not writeable |
| 10 | TMPDIR = '/tmp/test_kconfig' |
| 11 | |
| 12 | @pytest.mark.slow |
| 13 | @pytest.mark.boardspec('sandbox') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 14 | def test_kconfig(ubman): |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 15 | """Test build failures when IF_ENABLED_INT() option is not enabled""" |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 16 | |
| 17 | # This detects build errors in test/lib/kconfig.c |
Simon Glass | db0e453 | 2025-02-09 09:07:16 -0700 | [diff] [blame] | 18 | out = utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 19 | ubman, ['./tools/buildman/buildman', '-m', '--board', 'sandbox', |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 20 | '-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 Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 26 | def test_kconfig_spl(ubman): |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 27 | """Test build failures when IF_ENABLED_INT() option is not enabled""" |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 28 | |
| 29 | # This detects build errors in test/lib/kconfig_spl.c |
Simon Glass | db0e453 | 2025-02-09 09:07:16 -0700 | [diff] [blame] | 30 | out = utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 31 | ubman, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl', |
Simon Glass | 644d807 | 2022-08-01 07:57:59 -0600 | [diff] [blame] | 32 | '-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 |