test_kconfig.py 1.4 KB

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