summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-17 09:49:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-19 11:29:34 +0200
commitf9b689f7414a8c7a91a7e74004cebdef0afdbde2 (patch)
treed3cecf72ff59af6b8d132d2c760ee1b59a3dcff7
parentvalidation: Add test documentation to group (diff)
downloadrtems-central-f9b689f7414a8c7a91a7e74004cebdef0afdbde2.tar.bz2
build: Gather test header files
-rw-r--r--rtemsspec/build.py8
-rw-r--r--rtemsspec/tests/spec-build/tc.yml5
-rw-r--r--rtemsspec/tests/spec-build/x.yml2
-rw-r--r--rtemsspec/tests/spec/build-more.yml20
-rw-r--r--rtemsspec/tests/test_build.py4
5 files changed, 36 insertions, 3 deletions
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
@@ -7,6 +7,26 @@ links:
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
uid: build
spec-description: null
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"]