Skip to content

Commit ca09ece

Browse files
committed
nit picks
1 parent 32c80f7 commit ca09ece

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

toolchain/mfc/test/test.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ def test():
108108
global nFAIL, nPASS, nSKIP, total_test_count
109109
global errors
110110

111+
# Reset globals to ensure clean state
112+
nFAIL = 0
113+
nPASS = 0
114+
nSKIP = 0
115+
total_test_count = 0
116+
errors = []
117+
abort_tests.clear()
118+
111119
cases = list_cases()
112120

113121
# Delete UUIDs that are not in the list of cases from tests/
@@ -219,7 +227,7 @@ def _process_silo_file(silo_filepath: str, case: TestCase, out_filepath: str):
219227

220228
h5dump = f"{HDF5.get_install_dirpath(case.to_input_file())}/bin/h5dump"
221229

222-
if not os.path.exists(h5dump or ""):
230+
if not os.path.exists(h5dump):
223231
if not does_command_exist("h5dump"):
224232
raise MFCException("h5dump couldn't be found.")
225233
h5dump = shutil.which("h5dump")
@@ -314,6 +322,9 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
314322
cons.print(f" [bold magenta]{case.get_uuid()}[/bold magenta] SKIP {case.trace}")
315323
return
316324

325+
# Track current log file for timeout reporting
326+
current_log_path = os.path.join(case.get_dirpath(), "out_pre_sim.txt")
327+
317328
try:
318329
cmd = case.run([PRE_PROCESS, SIMULATION], gpus=devices, timeout=TEST_TIMEOUT_SECONDS)
319330

@@ -363,9 +374,10 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
363374

364375
# Run full pipeline: this ensures simulation and post_process use
365376
# consistent configuration (parallel_io, file_per_process, etc.)
377+
current_log_path = os.path.join(case.get_dirpath(), "out_post.txt")
366378
cmd = case.run([PRE_PROCESS, SIMULATION, POST_PROCESS], gpus=devices, timeout=TEST_TIMEOUT_SECONDS)
367379

368-
out_post_filepath = os.path.join(case.get_dirpath(), "out_post.txt")
380+
out_post_filepath = current_log_path
369381
common.file_write(out_post_filepath, cmd.stdout)
370382

371383
if cmd.returncode != 0:
@@ -398,12 +410,11 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
398410

399411
except subprocess.TimeoutExpired as exc:
400412
# Subprocess timeout - the process was actually killed
401-
log_path = os.path.join(case.get_dirpath(), 'out_pre_sim.txt')
402-
if os.path.exists(log_path):
403-
log_msg = f"Check the log at: {log_path}"
413+
if os.path.exists(current_log_path):
414+
log_msg = f"Check the log at: {current_log_path}"
404415
else:
405416
log_msg = (
406-
f"Log file ({log_path}) may not exist if the timeout occurred early."
417+
f"Log file ({current_log_path}) may not exist if the timeout occurred early."
407418
)
408419
raise MFCException(
409420
f"Test {case} exceeded 1 hour timeout (process was killed). "
@@ -428,6 +439,9 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
428439
max_attempts = ARG('max_attempts')
429440

430441
while True:
442+
if abort_tests.is_set():
443+
return
444+
431445
nAttempts += 1
432446

433447
try:

0 commit comments

Comments
 (0)