diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-02 09:49:41 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-02 09:50:26 +0200 |
commit | 569d2b3c2d1daae96dc86155544376dbd1722aeb (patch) | |
tree | 9ee3c6b8aff9a3d9c5233bf56bd43f7b8d251887 | |
parent | spec: Specify futex operations (diff) | |
download | rtems-central-569d2b3c2d1daae96dc86155544376dbd1722aeb.tar.bz2 |
build: Add option to omit test header files
-rw-r--r-- | rtemsspec/build.py | 12 | ||||
-rw-r--r-- | rtemsspec/tests/test_build.py | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/rtemsspec/build.py b/rtemsspec/build.py index 5dc25822..ce468404 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 b5c3906f..7634ad29 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"] |