From f9b689f7414a8c7a91a7e74004cebdef0afdbde2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Aug 2020 09:49:30 +0200 Subject: build: Gather test header files --- rtemsspec/build.py | 8 ++++++++ rtemsspec/tests/spec-build/tc.yml | 5 +++++ rtemsspec/tests/spec-build/x.yml | 2 +- rtemsspec/tests/spec/build-more.yml | 20 ++++++++++++++++++++ rtemsspec/tests/test_build.py | 4 ++-- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 rtemsspec/tests/spec-build/tc.yml diff --git a/rtemsspec/build.py b/rtemsspec/build.py index f1ca2be9..5ead7746 100644 --- a/rtemsspec/build.py +++ b/rtemsspec/build.py @@ -71,6 +71,13 @@ def _gather_source_files(item: Item, enabled: List[str], _EXTEND_SOURCE_FILES[item["build-type"]](item, source_files) +def _gather_test_files(item_cache: ItemCache, source_files: List[str]) -> None: + for item in item_cache.all.values(): + tests = ["test-case", "requirement/functional/action"] + if item.type in tests and item["test-header"]: + source_files.append(item["test-header"]["target"]) + + def gather_files(config: dict, item_cache: ItemCache) -> List[str]: """ Generates a list of files form the build specification. """ bsps = {} # type: BSPMap @@ -85,4 +92,5 @@ def gather_files(config: dict, item_cache: ItemCache) -> List[str]: _gather_source_files(bsps[arch][bsp], enabled, source_files) for uid in config["uids"]: _gather_source_files(item_cache[uid], enabled, source_files) + _gather_test_files(item_cache, source_files) return source_files diff --git a/rtemsspec/tests/spec-build/tc.yml b/rtemsspec/tests/spec-build/tc.yml new file mode 100644 index 00000000..196d6ed8 --- /dev/null +++ b/rtemsspec/tests/spec-build/tc.yml @@ -0,0 +1,5 @@ +enabled-by: true +test-header: + target: th +links: [] +type: test-case diff --git a/rtemsspec/tests/spec-build/x.yml b/rtemsspec/tests/spec-build/x.yml index 26e98206..407a1891 100644 --- a/rtemsspec/tests/spec-build/x.yml +++ b/rtemsspec/tests/spec-build/x.yml @@ -1,3 +1,3 @@ enabled-by: true links: [] -type: nix +type: test-suite diff --git a/rtemsspec/tests/spec/build-more.yml b/rtemsspec/tests/spec/build-more.yml index fb35b357..da7209ac 100644 --- a/rtemsspec/tests/spec/build-more.yml +++ b/rtemsspec/tests/spec/build-more.yml @@ -5,6 +5,26 @@ enabled-by: true links: - role: spec-member uid: root +- role: spec-refinement + spec-key: build-type + spec-value: bsp + uid: build +- role: spec-refinement + spec-key: build-type + spec-value: group + uid: build +- role: spec-refinement + spec-key: build-type + spec-value: objects + uid: build +- role: spec-refinement + spec-key: build-type + spec-value: option + uid: build +- role: spec-refinement + spec-key: build-type + spec-value: start-file + uid: build - role: spec-refinement spec-key: build-type spec-value: test-program diff --git a/rtemsspec/tests/test_build.py b/rtemsspec/tests/test_build.py index 28e971fb..e5290528 100644 --- a/rtemsspec/tests/test_build.py +++ b/rtemsspec/tests/test_build.py @@ -31,7 +31,7 @@ from rtemsspec.tests.util import create_item_cache_config_and_copy_spec def test_build(tmpdir): item_cache_config = create_item_cache_config_and_copy_spec( - tmpdir, "spec-build") + tmpdir, "spec-build", with_spec_types=True) item_cache = ItemCache(item_cache_config) build_config = {} @@ -41,4 +41,4 @@ def test_build(tmpdir): build_config["sources"] = ["a", "b"] build_config["uids"] = ["/g"] files = gather_files(build_config, item_cache) - assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def"] + assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def", "th"] -- cgit v1.2.3