From 1497104de465141e9af4190bea987979519b9a6a Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 5 Mar 2024 11:39:57 +0100 Subject: [PATCH] unittest: update unittest to hwmv2 Follow-up: fe25709a9c twister: add unit_testing soc and board Moving the soc.yml and board.yml to subsys/testsuite tree. Introduce subsys/testsuite/arch/archs.yml with unit_testing arch. Update the Zephyr CMake module unittest.cmake to include HWMv2 and reorder includes to follow same order as zephyr_default.cmake. Signed-off-by: Torsten Rasmussen --- cmake/modules/unittest.cmake | 9 ++++++--- scripts/pylib/twister/twisterlib/environment.py | 2 +- scripts/pylib/twister/twisterlib/testplan.py | 2 +- subsys/testsuite/arch/archs.yml | 3 +++ .../unit_testing/unit_testing/Kconfig.defconfig | 0 .../unit_testing/Kconfig.unit_testing} | 0 .../boards/unit_testing}/unit_testing/board.yml | 0 .../boards/unit_testing}/unit_testing/unit_testing.yaml | 0 .../unit_testing/unit_testing/unit_testing_defconfig | 0 .../unit_testing/unit_testing/Kconfig.soc | 3 +++ .../testsuite/soc/unit_testing}/unit_testing/soc.yml | 0 11 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 subsys/testsuite/arch/archs.yml rename subsys/testsuite/boards/{boards_legacy => }/unit_testing/unit_testing/Kconfig.defconfig (100%) rename subsys/testsuite/boards/{boards_legacy/unit_testing/unit_testing/Kconfig.board => unit_testing/unit_testing/Kconfig.unit_testing} (100%) rename {scripts/pylib/twister/boards/unit => subsys/testsuite/boards/unit_testing}/unit_testing/board.yml (100%) rename {scripts/pylib/twister/boards/unit => subsys/testsuite/boards/unit_testing}/unit_testing/unit_testing.yaml (100%) rename subsys/testsuite/boards/{boards_legacy => }/unit_testing/unit_testing/unit_testing_defconfig (100%) rename subsys/testsuite/soc/{soc_legacy => }/unit_testing/unit_testing/Kconfig.soc (81%) rename {scripts/pylib/twister/soc/unit => subsys/testsuite/soc/unit_testing}/unit_testing/soc.yml (100%) diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index 2551f41832..79e6c269c7 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -2,14 +2,17 @@ cmake_minimum_required(VERSION 3.20.0) +include(extensions) +include(west) include(root) +include(zephyr_module) include(boards) -include(arch_v1) +include(hwm_v2) include(configuration_files) -include(west) -include(zephyr_module) include(kconfig) +include(arch_v2) +include(soc_v2) find_package(TargetTools) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 19d13a8159..66b8b41d65 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -242,7 +242,7 @@ Artificially long but functional example: # Start of individual args place them in alpha-beta order board_root_list = ["%s/boards" % ZEPHYR_BASE, - "%s/scripts/pylib/twister/boards" % ZEPHYR_BASE] + "%s/subsys/testsuite/boards" % ZEPHYR_BASE] modules = zephyr_module.parse_modules(ZEPHYR_BASE) for module in modules: diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 5966e22318..2d24ca9330 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -405,7 +405,7 @@ class TestPlan: # but in Zephyr build system, the board root is without the `boards` in folder path. board_roots = [Path(os.path.dirname(root)) for root in self.env.board_roots] lb_args = Namespace(arch_roots=[Path(ZEPHYR_BASE)], soc_roots=[Path(ZEPHYR_BASE), - Path(ZEPHYR_BASE) / 'scripts' / 'pylib' / 'twister'], + Path(ZEPHYR_BASE) / 'subsys' / 'testsuite'], board_roots=board_roots, board=None, board_dir=None) v1_boards = list_boards.find_boards(lb_args) v2_boards = list_boards.find_v2_boards(lb_args) diff --git a/subsys/testsuite/arch/archs.yml b/subsys/testsuite/arch/archs.yml new file mode 100644 index 0000000000..9d24444dc3 --- /dev/null +++ b/subsys/testsuite/arch/archs.yml @@ -0,0 +1,3 @@ +archs: + - name: unit_testing + path: unit_testing diff --git a/subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/Kconfig.defconfig b/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.defconfig similarity index 100% rename from subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/Kconfig.defconfig rename to subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.defconfig diff --git a/subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/Kconfig.board b/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.unit_testing similarity index 100% rename from subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/Kconfig.board rename to subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.unit_testing diff --git a/scripts/pylib/twister/boards/unit/unit_testing/board.yml b/subsys/testsuite/boards/unit_testing/unit_testing/board.yml similarity index 100% rename from scripts/pylib/twister/boards/unit/unit_testing/board.yml rename to subsys/testsuite/boards/unit_testing/unit_testing/board.yml diff --git a/scripts/pylib/twister/boards/unit/unit_testing/unit_testing.yaml b/subsys/testsuite/boards/unit_testing/unit_testing/unit_testing.yaml similarity index 100% rename from scripts/pylib/twister/boards/unit/unit_testing/unit_testing.yaml rename to subsys/testsuite/boards/unit_testing/unit_testing/unit_testing.yaml diff --git a/subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/unit_testing_defconfig b/subsys/testsuite/boards/unit_testing/unit_testing/unit_testing_defconfig similarity index 100% rename from subsys/testsuite/boards/boards_legacy/unit_testing/unit_testing/unit_testing_defconfig rename to subsys/testsuite/boards/unit_testing/unit_testing/unit_testing_defconfig diff --git a/subsys/testsuite/soc/soc_legacy/unit_testing/unit_testing/Kconfig.soc b/subsys/testsuite/soc/unit_testing/unit_testing/Kconfig.soc similarity index 81% rename from subsys/testsuite/soc/soc_legacy/unit_testing/unit_testing/Kconfig.soc rename to subsys/testsuite/soc/unit_testing/unit_testing/Kconfig.soc index 38c319fc51..6b954b2abc 100644 --- a/subsys/testsuite/soc/soc_legacy/unit_testing/unit_testing/Kconfig.soc +++ b/subsys/testsuite/soc/unit_testing/unit_testing/Kconfig.soc @@ -6,3 +6,6 @@ config SOC_UNIT_TESTING bool "Unit testing SoC" help SoC for unit testing + +config SOC + default "unit_testing" diff --git a/scripts/pylib/twister/soc/unit/unit_testing/soc.yml b/subsys/testsuite/soc/unit_testing/unit_testing/soc.yml similarity index 100% rename from scripts/pylib/twister/soc/unit/unit_testing/soc.yml rename to subsys/testsuite/soc/unit_testing/unit_testing/soc.yml