diff options
author | Simon Glass <sjg@chromium.org> | 2022-08-01 07:57:59 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-10 13:38:30 -0400 |
commit | 29784d62eded89332254307bdb63ad8a7d8249d2 (patch) | |
tree | dec2e9893799a112503202ba10c871dc68bb1aad /test/py | |
parent | 5e2548c1d6e0331edbf94edcfc95d55b5e9a6cab (diff) |
test: Add some tests for kconfig.h
The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.
Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/py')
-rw-r--r-- | test/py/tests/test_kconfig.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/py/tests/test_kconfig.py b/test/py/tests/test_kconfig.py new file mode 100644 index 0000000000..0b9e6bc3bd --- /dev/null +++ b/test/py/tests/test_kconfig.py @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2022 Google LLC +# Written by Simon Glass <sjg@chromium.org> + +import pytest + +import u_boot_utils as util + +# This is needed for Azure, since the default '..' directory is not writeable +TMPDIR = '/tmp/test_kconfig' + +@pytest.mark.slow +@pytest.mark.boardspec('sandbox') +def test_kconfig(u_boot_console): + """Test build failures when IF_ENABLED_INT() option is not enabled""" + cons = u_boot_console + + # This detects build errors in test/lib/kconfig.c + out = util.run_and_log( + cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox', + '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) + assert 'invalid_use_of_IF_ENABLED_INT' in out + assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' in out + +@pytest.mark.slow +@pytest.mark.boardspec('sandbox_spl') +def test_kconfig_spl(u_boot_console): + """Test build failures when IF_ENABLED_INT() option is not enabled""" + cons = u_boot_console + + # This detects build errors in test/lib/kconfig_spl.c + out = util.run_and_log( + cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl', + '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) + assert 'invalid_use_of_IF_ENABLED_INT' in out + + # There is no CONFIG_SPL_TEST_KCONFIG, so the CONFIG_IF_ENABLED_INT() + # line should not generate an error + assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out |