diff --git a/scripts/Infrastructure/GeneratorManager.py b/scripts/Infrastructure/GeneratorManager.py index dad021d978f7452b279ae7d9080dcdc6e42a5580..c5cca9e7556adca713fb6cdd99f1bd6c1b859bd9 100644 --- a/scripts/Infrastructure/GeneratorManager.py +++ b/scripts/Infrastructure/GeneratorManager.py @@ -69,8 +69,9 @@ class GeneratorManager: 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, - try_compile:bool=False, max_mpi_version:str="4.0", use_clang_format:bool=True): + 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): """ Generates test cases based on the specified parameters. Parameters: @@ -115,6 +116,9 @@ class GeneratorManager: cases_generated = 0 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): assert isinstance(result_error, TemplateManager) @@ -122,7 +126,7 @@ class GeneratorManager: if not float(result_error.get_version()) > float(max_mpi_version): case_name = result_error.get_short_descr() 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): assert False and "File Already exists" diff --git a/scripts/main.py b/scripts/main.py index acc0a088749b2b88cff4fdaa0fd4acc6e3637b42..80879720149cb9066c56bf62514ba90aa25e1b58 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -6,14 +6,17 @@ from scripts.Infrastructure.GeneratorManager import GeneratorManager if __name__ == "__main__": gencodes_dir = "../gencodes/" - #gm = GeneratorManager("./errors") - gm = GeneratorManager("./errors/devel") + gm = GeneratorManager("./errors") + # gm = GeneratorManager("./errors/devel") + # remove all testcases from previous execution (ease of debugging) - filelist = [f for f in os.listdir(gencodes_dir) if f.endswith(".c")] - for f in filelist: - os.remove(os.path.join(gencodes_dir, f)) + for root, dirs, files in os.walk(gencodes_dir): + for file in files: + 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=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=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 pass