Skip to content

Commit 48bc52f

Browse files
multi threading testing
1 parent 078a8d4 commit 48bc52f

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

ner_environment/build_system/build_system.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,32 @@ def build(profile: str = typer.Option(None, "--profile", "-p", callback=unsuppor
6565
@app.command(help="Run Unity Test source file")
6666
def test(clean: bool = typer.Option(False, "--clean", help="Clean the build directory before building", show_default=True),
6767
list: bool = typer.Option(False, "--list", help="List available tests to run", show_default=True),
68-
files: List[str] = typer.Argument(None, help="Specific test file to run (optional)")):
69-
68+
packages: List[str] = typer.Argument(None, help="Specific test file to run (optional)")):
69+
70+
mock_configs_dir = Path("Tests/mock_configs")
71+
test_packages = [file.stem for file in mock_configs_dir.iterdir() if file.is_file()]
72+
7073
if clean:
7174
command = ["docker", "compose", "run", "--rm", "ner-gcc-arm", "sh", "-c", f"cd Drivers/Embedded-Base/testing/ && make clean"]
7275
run_command(command, stream_output=True)
73-
return
76+
return
7477

7578
if list:
76-
command = ["docker", "compose", "run", "--rm", "ner-gcc-arm", "sh", "-c", f"cd Drivers/Embedded-Base/testing/ && make list"]
77-
run_command(command, stream_output=True)
79+
for tp in test_packages:
80+
print(tp)
7881
return
79-
80-
file_args = " ".join(files) if files else ""
81-
command = ["docker", "compose", "run", "--rm", "ner-gcc-arm", "sh", "-c", f"cd Drivers/Embedded-Base/testing/ && make TEST_FILES='{file_args}'"]
82-
run_command(command, stream_output=True)
83-
8482

83+
if packages == None:
84+
packages = test_packages
85+
86+
processes = []
87+
for package in packages:
88+
command = ["docker", "compose", "run", "--rm", "ner-gcc-arm", "sh", "-c", f"cd Drivers/Embedded-Base/testing/ && make TEST_PACKAGE='{package}'"]
89+
processes.append(subprocess.Popen(command))
90+
91+
for p in processes:
92+
p.wait()
93+
8594

8695
# ==============================================================================
8796
# Clang command

0 commit comments

Comments
 (0)