From 9fb1c95fbdbec46b0ae12dd61401d3f44dd8e2c4 Mon Sep 17 00:00:00 2001 From: Sebastien Valat Date: Tue, 10 Nov 2026 10:41:58 +0100 Subject: [PATCH] test: make such that --init used on ./test.py re-create the init file only for the first config to be executed --- pytools/idfx_test.py | 13 ++++++++++++- pytools/idfx_test_run.py | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pytools/idfx_test.py b/pytools/idfx_test.py index beb3ed80..6fe38240 100644 --- a/pytools/idfx_test.py +++ b/pytools/idfx_test.py @@ -657,7 +657,7 @@ def compareDump(self, file1, file2, tolerance=0): ) sys.stdout.flush() - def makeReference(self, filename): + def makeReference(self, filename, done: list = None): # log and in fake mode do not execute. self.addLog( { @@ -674,6 +674,13 @@ def makeReference(self, filename): print("Creating reference directory") os.makedirs(targetDir, exist_ok=True) fileout = os.path.join(targetDir, self._getReferenceFilename()) + if done is not None and fileout in done: + print( + bcolors.WARNING + + "Reference creation skipped, already done by previous specific config" + + bcolors.ENDC + ) + return if os.path.exists(fileout): ans = input( bcolors.WARNING @@ -690,6 +697,10 @@ def makeReference(self, filename): print(bcolors.OKGREEN + "Reference file " + fileout + " created" + bcolors.ENDC) sys.stdout.flush() + # append + if done is not None: + done.append(fileout) + def _showConfig(self): print("**************************************************************") if self.cuda: diff --git a/pytools/idfx_test_run.py b/pytools/idfx_test_run.py index f4cd4caa..5ca10c05 100644 --- a/pytools/idfx_test_run.py +++ b/pytools/idfx_test_run.py @@ -55,6 +55,7 @@ def __init__(self, parentScriptFile: str): self.parentScritFile = parentScriptFile self.filterSubdir = os.environ.get("IDEFIX_TEST_FILTER_SUBDIR", "./test/") self.testmeSchema = self._loadTestmeSchema() + self.makeReferencesDone: list[str] = [] def _loadTestmeSchema(self) -> dict: scriptDir = os.path.dirname(__file__) @@ -456,7 +457,7 @@ def _runNonRegSingleRun( # regen ref if needed if idefixTest.init: - idefixTest.makeReference(filename=dumpname) + idefixTest.makeReference(filename=dumpname, done=self.makeReferencesDone) # check outputs if standardTest: