From b5bdc1ac9b0c2b50beb559ca39469bd54c9c67ee Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Mon, 17 Jun 2024 09:22:38 +0200 Subject: [PATCH] ci: add idf-build-apps load soc caps test case --- .gitlab/ci/host-test.yml | 6 +++- ...heck_soc_headers_load_in_idf_build_apps.py | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tools/ci/check_soc_headers_load_in_idf_build_apps.py diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index faa080b13c..186671117e 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -385,7 +385,6 @@ test_pytest_macos: --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --app-info-filepattern \"list_job_*.txt\" - test_idf_pytest_plugin: extends: - .host_test_template @@ -400,3 +399,8 @@ test_idf_pytest_plugin: - python -m unittest test_report_generator.py - cd ${IDF_PATH}/tools/ci/idf_pytest - pytest --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml + +test_idf_build_apps_load_soc_caps: + extends: .host_test_template + script: + - python tools/ci/check_soc_headers_load_in_idf_build_apps.py diff --git a/tools/ci/check_soc_headers_load_in_idf_build_apps.py b/tools/ci/check_soc_headers_load_in_idf_build_apps.py new file mode 100644 index 0000000000..ffbc134160 --- /dev/null +++ b/tools/ci/check_soc_headers_load_in_idf_build_apps.py @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 +import os.path +import sys +import unittest + +from idf_build_apps.constants import PREVIEW_TARGETS as IBA_PREVIEW_TARGETS +from idf_build_apps.constants import SUPPORTED_TARGETS as IBA_SUPPORTED_TARGETS +from idf_build_apps.manifest.soc_header import SOC_HEADERS + + +class TestLoadSocHeaders(unittest.TestCase): + def test_targets(self) -> None: + sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) + + from idf_py_actions.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS + + self.assertEqual(IBA_PREVIEW_TARGETS, PREVIEW_TARGETS) + self.assertEqual(IBA_SUPPORTED_TARGETS, SUPPORTED_TARGETS) + + def test_loaded(self) -> None: + # supported_targets and preview_targets are dynamically loaded from idf + # no need to change them while supporting new targets + for target in [*IBA_SUPPORTED_TARGETS, *IBA_PREVIEW_TARGETS]: + # make at least loaded something + self.assertIn(target, SOC_HEADERS) + self.assertIsNotNone(SOC_HEADERS[target]) + + +if __name__ == '__main__': + unittest.main()