[rtems-central commit] build: Add option to omit test header files

Sebastian Huber sebh at rtems.org
Thu Sep 2 11:31:20 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep  2 09:49:41 2021 +0200

build: Add option to omit test header files

---

 rtemsspec/build.py            | 12 ++++++++----
 rtemsspec/tests/test_build.py |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/rtemsspec/build.py b/rtemsspec/build.py
index 5dc2582..ce46840 100644
--- a/rtemsspec/build.py
+++ b/rtemsspec/build.py
@@ -77,26 +77,30 @@ 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:
+def _gather_test_header(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]:
+def gather_files(config: dict,
+                 item_cache: ItemCache,
+                 test_header: bool = True) -> List[str]:
     """ Generates a list of files form the build specification. """
     bsps = {}  # type: BSPMap
     for item in item_cache.all.values():
         if item["type"] == "build" and item["build-type"] == "bsp":
             arch_bsps = bsps.setdefault(item["arch"].strip(), {})
             arch_bsps[item["bsp"].strip()] = item
-    source_files = config["sources"]  # type: List[str]
+    source_files = list(config["sources"])  # type: List[str]
     arch = config["arch"]
     bsp = config["bsp"]
     enabled = [arch, arch + "/" + bsp] + config["enabled"]
     _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)
+    if test_header:
+        _gather_test_header(item_cache, source_files)
     return source_files
diff --git a/rtemsspec/tests/test_build.py b/rtemsspec/tests/test_build.py
index b5c3906..7634ad2 100644
--- a/rtemsspec/tests/test_build.py
+++ b/rtemsspec/tests/test_build.py
@@ -42,3 +42,5 @@ def test_build(tmpdir):
     build_config["uids"] = ["/g"]
     files = gather_files(build_config, item_cache)
     assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def", "ghi", "th"]
+    files = gather_files(build_config, item_cache, test_header=False)
+    assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def", "ghi"]



More information about the vc mailing list