diff --git a/lobster-coda b/lobster-cpptest similarity index 94% rename from lobster-coda rename to lobster-cpptest index 39568395..68576ae2 100644 --- a/lobster-coda +++ b/lobster-cpptest @@ -19,7 +19,7 @@ import sys -from lobster.tools.coda.coda import main +from lobster.tools.cpptest.cpptest import main if __name__ == "__main__": sys.exit(main()) diff --git a/lobster/tools/coda/__init__.py b/lobster/tools/cpptest/__init__.py similarity index 100% rename from lobster/tools/coda/__init__.py rename to lobster/tools/cpptest/__init__.py diff --git a/lobster/tools/coda/coda.py b/lobster/tools/cpptest/cpptest.py similarity index 95% rename from lobster/tools/coda/coda.py rename to lobster/tools/cpptest/cpptest.py index 6fafc23c..35e0a162 100644 --- a/lobster/tools/coda/coda.py +++ b/lobster/tools/cpptest/cpptest.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# lobster_coda - Extract C/C++ tracing tags from commands for LOBSTER +# lobster_cpptest - Extract C++ tracing tags from comments in tests for LOBSTER # Copyright (C) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) # # This program is free software: you can redistribute it and/or modify @@ -27,8 +27,8 @@ from lobster.items import Tracing_Tag, Activity from lobster.location import File_Reference from lobster.io import lobster_write -from lobster.tools.coda.parser.constants import Constants -from lobster.tools.coda.parser.requirements_parser import ParserForRequirements +from lobster.tools.cpptest.parser.constants import Constants +from lobster.tools.cpptest.parser.requirements_parser import ParserForRequirements OUTPUT = "output" CODEBEAMER_URL = "codebeamer_url" @@ -66,7 +66,7 @@ def parse_config_file(file_name: str) -> dict: """ Parse the configuration dictionary from given config file. - The configuration dictionary for coda must contain the OUTPUT and + The configuration dictionary for cpptest must contain the OUTPUT and CODEBEAMER_URL keys. Each output configuration dictionary contains a file name as key and a value dictionary containing the keys MARKERS and KIND. @@ -76,12 +76,12 @@ def parse_config_file(file_name: str) -> dict: Parameters ---------- file_name : str - The file name of the coda config file. + The file name of the cpptest config file. Returns ------- dict - The dictionary containing the configuration for coda. + The dictionary containing the configuration for cpptest. Raises ------ @@ -330,7 +330,7 @@ def write_lobster_items_output_dict(lobster_items_output_dict: dict): print(f'Written {item_count} lobster items to stdout.') -def lobster_coda(file_dir_list: list, config_dict: dict): +def lobster_cpptest(file_dir_list: list, config_dict: dict): """ The main function to parse requirements from comments for the given list of files and/or directories and write the @@ -369,7 +369,7 @@ def lobster_coda(file_dir_list: list, config_dict: dict): def main(): """ Main function to parse arguments, read configuration - and launch lobster_coda. + and launch lobster_cpptest. """ ap = argparse.ArgumentParser() ap.add_argument("files", @@ -387,7 +387,7 @@ def main(): try: config_dict = parse_config_file(options.config_file) - lobster_coda( + lobster_cpptest( file_dir_list=options.files, config_dict=config_dict ) diff --git a/lobster/tools/coda/parser/constants.py b/lobster/tools/cpptest/parser/constants.py similarity index 98% rename from lobster/tools/coda/parser/constants.py rename to lobster/tools/cpptest/parser/constants.py index 30a82fcc..c65ced24 100644 --- a/lobster/tools/coda/parser/constants.py +++ b/lobster/tools/cpptest/parser/constants.py @@ -16,7 +16,7 @@ def __init__(self, codebeamer_url = ''): NON_EXISTING_INFO = "---" - LOBSTER_GENERATOR = "lobster_coda" + LOBSTER_GENERATOR = "lobster-cpptest" VALID_TESTMETHODS = [ "TM_EQUIVALENCE", diff --git a/lobster/tools/coda/parser/requirements_parser.py b/lobster/tools/cpptest/parser/requirements_parser.py similarity index 96% rename from lobster/tools/coda/parser/requirements_parser.py rename to lobster/tools/cpptest/parser/requirements_parser.py index bb9c2def..d621895d 100644 --- a/lobster/tools/coda/parser/requirements_parser.py +++ b/lobster/tools/cpptest/parser/requirements_parser.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import List -from lobster.tools.coda.parser.test_case import TestCase +from lobster.tools.cpptest.parser.test_case import TestCase class ParserForRequirements: diff --git a/lobster/tools/coda/parser/test_case.py b/lobster/tools/cpptest/parser/test_case.py similarity index 99% rename from lobster/tools/coda/parser/test_case.py rename to lobster/tools/cpptest/parser/test_case.py index b2e52376..3ca059a2 100644 --- a/lobster/tools/coda/parser/test_case.py +++ b/lobster/tools/cpptest/parser/test_case.py @@ -1,7 +1,7 @@ import re from typing import List -from lobster.tools.coda.parser.constants import Constants +from lobster.tools.cpptest.parser.constants import Constants class TestCase: diff --git a/packages/lobster-tool-coda/entrypoints b/packages/lobster-tool-coda/entrypoints deleted file mode 100644 index 4c68f430..00000000 --- a/packages/lobster-tool-coda/entrypoints +++ /dev/null @@ -1 +0,0 @@ -lobster-coda = lobster.tools.coda.coda:main \ No newline at end of file diff --git a/packages/lobster-tool-coda/Makefile b/packages/lobster-tool-cpptest/Makefile similarity index 58% rename from packages/lobster-tool-coda/Makefile rename to packages/lobster-tool-cpptest/Makefile index 20d572c7..0c3a26ca 100644 --- a/packages/lobster-tool-coda/Makefile +++ b/packages/lobster-tool-cpptest/Makefile @@ -1,5 +1,5 @@ package: rm -rf lobster mkdir -p lobster/tools - cp -Rv $(LOBSTER_ROOT)/lobster/tools/coda lobster/tools + cp -Rv $(LOBSTER_ROOT)/lobster/tools/cpptest lobster/tools @python3 setup.py sdist bdist_wheel diff --git a/packages/lobster-tool-coda/README.md b/packages/lobster-tool-cpptest/README.md similarity index 95% rename from packages/lobster-tool-coda/README.md rename to packages/lobster-tool-cpptest/README.md index e6514ca8..a4124362 100644 --- a/packages/lobster-tool-coda/README.md +++ b/packages/lobster-tool-cpptest/README.md @@ -11,7 +11,7 @@ from the provided comments in cpp files ## Tools -* `lobster-coda`: Extract requirements with dynamic refrences +* `lobster-cpptest`: Extract requirements with dynamic refrences from comments. ## Usage diff --git a/packages/lobster-tool-cpptest/entrypoints b/packages/lobster-tool-cpptest/entrypoints new file mode 100644 index 00000000..e20b11a0 --- /dev/null +++ b/packages/lobster-tool-cpptest/entrypoints @@ -0,0 +1 @@ +lobster-cpptest = lobster.tools.cpptest.cpptest:main \ No newline at end of file diff --git a/packages/lobster-tool-coda/requirements b/packages/lobster-tool-cpptest/requirements similarity index 100% rename from packages/lobster-tool-coda/requirements rename to packages/lobster-tool-cpptest/requirements diff --git a/packages/lobster-tool-coda/setup.py b/packages/lobster-tool-cpptest/setup.py similarity index 96% rename from packages/lobster-tool-coda/setup.py rename to packages/lobster-tool-cpptest/setup.py index 8d35f1f1..c011a14c 100644 --- a/packages/lobster-tool-coda/setup.py +++ b/packages/lobster-tool-cpptest/setup.py @@ -45,7 +45,7 @@ } setuptools.setup( - name="bmw-lobster-tool-coda", + name="bmw-lobster-tool-cpptest", version=version.LOBSTER_VERSION, author="Bayerische Motoren Werke Aktiengesellschaft (BMW AG)", author_email="philipp.wullstein-kammler@bmw.de", @@ -55,7 +55,7 @@ url=project_urls["Source Code"], project_urls=project_urls, license="GNU Affero General Public License v3", - packages=["lobster.tools.coda"], + packages=["lobster.tools.cpptest"], install_requires=package_requirements, python_requires=">=3.7, <4", classifiers=[ diff --git a/test-unit/lobster-cpptest/__init__.py b/test-unit/lobster-cpptest/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test-unit/lobster-coda/data/test_coda-1.config b/test-unit/lobster-cpptest/data/test_1.config similarity index 100% rename from test-unit/lobster-coda/data/test_coda-1.config rename to test-unit/lobster-cpptest/data/test_1.config diff --git a/test-unit/lobster-coda/data/test_coda-2.config b/test-unit/lobster-cpptest/data/test_2.config similarity index 100% rename from test-unit/lobster-coda/data/test_coda-2.config rename to test-unit/lobster-cpptest/data/test_2.config diff --git a/test-unit/lobster-coda/data/test_case.cpp b/test-unit/lobster-cpptest/data/test_case.cpp similarity index 100% rename from test-unit/lobster-coda/data/test_case.cpp rename to test-unit/lobster-cpptest/data/test_case.cpp diff --git a/test-unit/lobster-coda/test_coda.py b/test-unit/lobster-cpptest/test_cpptest.py similarity index 97% rename from test-unit/lobster-coda/test_coda.py rename to test-unit/lobster-cpptest/test_cpptest.py index e543de26..85fde717 100644 --- a/test-unit/lobster-coda/test_coda.py +++ b/test-unit/lobster-cpptest/test_cpptest.py @@ -2,12 +2,13 @@ import unittest from pathlib import Path -from lobster.tools.coda.coda import * -from lobster.tools.coda.parser.constants import Constants -from lobster.tools.coda.parser.requirements_parser import ParserForRequirements +from lobster.tools.cpptest.cpptest import * +from lobster.tools.cpptest.parser.constants import Constants +from lobster.tools.cpptest.parser.requirements_parser import ParserForRequirements -class LobsterCodaTests(unittest.TestCase): +class LobsterCpptestTests(unittest.TestCase): + # unit tests for lobster-cpptest def setUp(self): self.lobster_generator = Constants.LOBSTER_GENERATOR @@ -17,8 +18,8 @@ def setUp(self): self.test_fake_dir = str(Path('./not_existing')) self.test_data_dir = str(Path('./data')) self.test_case_file = str(Path('./data', 'test_case.cpp')) - self.test_config_1 = str(Path('./data', 'test_coda-1.config')) - self.test_config_2 = str(Path('./data', 'test_coda-2.config')) + self.test_config_1 = str(Path('./data', 'test_1.config')) + self.test_config_2 = str(Path('./data', 'test_2.config')) self.req_test_type = [RequirementTypes.REQS.value] self.req_by_test_type = [RequirementTypes.REQ_BY.value] @@ -207,7 +208,7 @@ def test_get_test_file_list_not_existing_file_dir(self): exception_string = str(test_get_test_file_list.exception) self.assertEqual(f'"{self.test_fake_dir}" is not a file or directory.', exception_string) - def test_lobster_coda_single_file(self): + def test_single_file(self): file_dir_list = [self.test_case_file] if os.path.exists(self.output_file_name): @@ -230,7 +231,7 @@ def test_lobster_coda_single_file(self): CODEBEAMER_URL: "https://codebeamer.com" } - lobster_coda( + lobster_cpptest( file_dir_list=file_dir_list, config_dict=config_dict ) @@ -238,7 +239,7 @@ def test_lobster_coda_single_file(self): file_exists = os.path.exists(self.output_file_name) self.assertTrue(file_exists) - def test_lobster_coda_single_directory(self): + def test_single_directory(self): file_dir_list = [self.test_data_dir] if os.path.exists(self.output_data_file_name): @@ -261,7 +262,7 @@ def test_lobster_coda_single_directory(self): CODEBEAMER_URL: "https://codebeamer.com" } - lobster_coda( + lobster_cpptest( file_dir_list=file_dir_list, config_dict=config_dict ) @@ -269,7 +270,7 @@ def test_lobster_coda_single_directory(self): file_exists = os.path.exists(self.output_data_file_name) self.assertTrue(file_exists) - def test_lobster_coda_not_existing_file_dir(self): + def test_not_existing_file_dir(self): file_dir_list = [self.test_fake_dir] if os.path.exists(self.output_fake_file_name): @@ -288,23 +289,23 @@ def test_lobster_coda_not_existing_file_dir(self): CODEBEAMER_URL: "https://codebeamer.com" } - with self.assertRaises(Exception) as test_lobster_coda: - lobster_coda( + with self.assertRaises(Exception) as wrapper: + lobster_cpptest( file_dir_list=file_dir_list, config_dict=config_dict ) - exception_string = str(test_lobster_coda.exception) + exception_string = str(wrapper.exception) self.assertEqual(f'"{self.test_fake_dir}" is not a file or directory.', exception_string) file_exists = os.path.exists(self.output_fake_file_name) self.assertFalse(file_exists) - def test_lobster_coda_separate_output_config(self): + def test_separate_output_config(self): file_dir_list = [self.test_case_file] config_dict: dict = parse_config_file(self.test_config_1) - lobster_coda( + lobster_cpptest( file_dir_list=file_dir_list, config_dict=config_dict )