Skip to content
Snippets Groups Projects
Commit d918d38f authored by Jammer, Tim's avatar Jammer, Tim
Browse files

organize generated codes per feature

parent 9749bb20
No related branches found
No related tags found
2 merge requests!13Infrasructure patch 1,!12More improvements to Infrastructure
...@@ -69,7 +69,8 @@ class GeneratorManager: ...@@ -69,7 +69,8 @@ class GeneratorManager:
return case_name + "-" + str(num).zfill(digits_to_use) + suffix return case_name + "-" + str(num).zfill(digits_to_use) + suffix
def generate(self, outpath: str | Path | os.PathLike[str], filterlist_:typing.Sequence[str]=None, print_progress_bar:bool=True, overwrite:bool=True, generate_full_set:bool=False, def generate(self, outpath: str | Path | os.PathLike[str], filterlist_: typing.Sequence[str] = None,
print_progress_bar: bool = True, overwrite: bool = True, generate_full_set: bool = False,
try_compile: bool = False, max_mpi_version: str = "4.0", use_clang_format: bool = True): try_compile: bool = False, max_mpi_version: str = "4.0", use_clang_format: bool = True):
""" """
Generates test cases based on the specified parameters. Generates test cases based on the specified parameters.
...@@ -115,6 +116,9 @@ class GeneratorManager: ...@@ -115,6 +116,9 @@ class GeneratorManager:
cases_generated = 0 cases_generated = 0
for generator in generators_to_use: for generator in generators_to_use:
# use first feature as category if generatro has multiple
categroy_path = os.path.join(outpath, generator.get_feature()[0])
os.makedirs(categroy_path, exist_ok=True)
for result_error in generator.generate(generate_full_set): for result_error in generator.generate(generate_full_set):
assert isinstance(result_error, TemplateManager) assert isinstance(result_error, TemplateManager)
...@@ -122,7 +126,7 @@ class GeneratorManager: ...@@ -122,7 +126,7 @@ class GeneratorManager:
if not float(result_error.get_version()) > float(max_mpi_version): if not float(result_error.get_version()) > float(max_mpi_version):
case_name = result_error.get_short_descr() case_name = result_error.get_short_descr()
fname = self.get_filename(case_name) fname = self.get_filename(case_name)
full_name = os.path.join(outpath, fname) full_name = os.path.join(categroy_path, fname)
if not overwrite and os.path.isfile(full_name): if not overwrite and os.path.isfile(full_name):
assert False and "File Already exists" assert False and "File Already exists"
......
...@@ -6,14 +6,17 @@ from scripts.Infrastructure.GeneratorManager import GeneratorManager ...@@ -6,14 +6,17 @@ from scripts.Infrastructure.GeneratorManager import GeneratorManager
if __name__ == "__main__": if __name__ == "__main__":
gencodes_dir = "../gencodes/" gencodes_dir = "../gencodes/"
#gm = GeneratorManager("./errors") gm = GeneratorManager("./errors")
gm = GeneratorManager("./errors/devel") # gm = GeneratorManager("./errors/devel")
# remove all testcases from previous execution (ease of debugging) # remove all testcases from previous execution (ease of debugging)
filelist = [f for f in os.listdir(gencodes_dir) if f.endswith(".c")] for root, dirs, files in os.walk(gencodes_dir):
for f in filelist: for file in files:
os.remove(os.path.join(gencodes_dir, f)) if file.endswith(".c"):
os.remove(os.path.join(root, file))
# gm.generate(gencodes_dir, try_compile=True, generate_full_set=False) # default # gm.generate(gencodes_dir, try_compile=True, generate_full_set=False) # default
gm.generate(gencodes_dir, try_compile=True, generate_full_set=True, max_mpi_version="3.1") #all cases that can compile for my local mpi installation gm.generate(gencodes_dir, try_compile=True, generate_full_set=True,
max_mpi_version="3.1") # all cases that can compile for my local mpi installation
pass pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment