[rtems-central commit] build: Gather test header files

Sebastian Huber sebh at rtems.org
Thu Aug 20 14:13:13 UTC 2020


Module:    rtems-central
Branch:    master
Commit:    f9b689f7414a8c7a91a7e74004cebdef0afdbde2
Changeset: http://git.rtems.org/rtems-central/commit/?id=f9b689f7414a8c7a91a7e74004cebdef0afdbde2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Aug 17 09:49:30 2020 +0200

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(-)

diff --git a/rtemsspec/build.py b/rtemsspec/build.py
index f1ca2be..5ead774 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 0000000..196d6ed
--- /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 26e9820..407a189 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 fb35b35..da7209a 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 28e971f..e529052 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"]



More information about the vc mailing list