summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-08-17 09:35:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-08-17 09:35:27 +0200
commit41ca85ee6b6cfdc9a6a088f2cfb762e42d962e36 (patch)
tree1b42bd40febe520a1e10e158c0879c1b30c6de12
parentspec: Remove space profile test suite (diff)
downloadrtems-central-41ca85ee6b6cfdc9a6a088f2cfb762e42d962e36.tar.bz2
spec2modules.py: Add target files option
-rw-r--r--rtemsspec/tests/test_validation.py1
-rw-r--r--rtemsspec/validation.py13
-rwxr-xr-xspec2modules.py26
3 files changed, 30 insertions, 10 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index 5314050b..e1b11575 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -60,6 +60,7 @@ def test_validation(tmpdir):
assert len(list(transition_map.get_post_conditions(["RTEMS_SMP"]))) == 9
generate(validation_config, item_cache)
+ generate(validation_config, item_cache, ["ts.c"])
with open(os.path.join(base_directory, "ts.c"), "r") as src:
content = """/* SPDX-License-Identifier: BSD-2-Clause */
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 306a0d9a..5c3f9324 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -1053,7 +1053,9 @@ _GATHER = {
}
-def generate(config: dict, item_cache: ItemCache) -> None:
+def generate(config: dict,
+ item_cache: ItemCache,
+ targets: Optional[List[str]] = None) -> None:
"""
Generates source files and build specification items for validation test
suites and test cases according to the configuration.
@@ -1079,5 +1081,10 @@ def generate(config: dict, item_cache: ItemCache) -> None:
test_case_to_suites.setdefault(test_case.uid,
[]).extend(test_suites)
- for src in source_files.values():
- src.generate(config["base-directory"], test_case_to_suites)
+ if not targets:
+ for src in source_files.values():
+ src.generate(config["base-directory"], test_case_to_suites)
+ else:
+ for target in targets:
+ source_files[target].generate(config["base-directory"],
+ test_case_to_suites)
diff --git a/spec2modules.py b/spec2modules.py
index d652dc38..a848baed 100755
--- a/spec2modules.py
+++ b/spec2modules.py
@@ -25,20 +25,32 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+import argparse
+import sys
+
import rtemsspec
def main() -> None:
""" Generates files of the modules from the specification. """
+ parser = argparse.ArgumentParser()
+ parser.add_argument("targets",
+ metavar="TARGET",
+ nargs="*",
+ help="a target file of a specification item")
+ args = parser.parse_args(sys.argv[1:])
config = rtemsspec.util.load_config("config.yml")
item_cache = rtemsspec.items.ItemCache(config["spec"])
- rtemsspec.interface.generate(config["interface"], item_cache)
- rtemsspec.validation.generate(config["validation"], item_cache)
- rtemsspec.applconfig.generate(config["appl-config"], item_cache)
- rtemsspec.specdoc.document(config["spec-documentation"], item_cache)
- rtemsspec.glossary.generate(config["glossary"], item_cache)
- rtemsspec.interfacedoc.generate(config["interface-documentation"],
- item_cache)
+ rtemsspec.validation.generate(config["validation"], item_cache,
+ args.targets)
+
+ if not args.targets:
+ rtemsspec.interface.generate(config["interface"], item_cache)
+ rtemsspec.applconfig.generate(config["appl-config"], item_cache)
+ rtemsspec.specdoc.document(config["spec-documentation"], item_cache)
+ rtemsspec.glossary.generate(config["glossary"], item_cache)
+ rtemsspec.interfacedoc.generate(config["interface-documentation"],
+ item_cache)
if __name__ == "__main__":