@@ -393,13 +393,17 @@ def run_test(testsuite, avocado_bin, runner, linux_src_path, resume_job_dir=None
393393 :param resume_job_dir: Prior avocado job dir for resume mode (or None)
394394 """
395395 if resume_job_dir :
396- # avocado replay <job_id> re-runs only not-passed tests from that job.
397- # The job_id is the trailing hex in the job dir name e.g.
398- # job-2026-07-28T04.29-07add70 → job_id = 07add70
399- job_id = os .path .basename (resume_job_dir ).rsplit ('-' , 1 )[- 1 ]
396+ # Pass the full absolute path so avocado can resolve the job directory
397+ # unambiguously without hash prefix matching (which raises ValueError
398+ # "hash is not unique enough" when multiple jobs share the same 7-char
399+ # suffix). avocado's get_job_results_dir() accepts a direct path when
400+ # the directory exists and contains an 'id' file.
401+ replay_path = os .path .abspath (resume_job_dir )
402+ # --resume tells avocado to skip tests that already passed/were skipped
403+ # in the source job, so only the remaining/interrupted tests are re-run.
400404 logger .info ("Resuming suite %s via avocado replay %s" ,
401- testsuite .name , job_id )
402- cmd = "%s replay %s" % (avocado_bin , job_id )
405+ testsuite .name , replay_path )
406+ cmd = "%s replay %s --resume " % (avocado_bin , replay_path )
403407 else :
404408 nrun = True
405409 if runner :
@@ -966,12 +970,17 @@ def _suite_completed(suite_name):
966970
967971 def _suite_replay_dir (suite_name ):
968972 """Return the prior job dir to replay for this suite, or None.
969- Returns None when suite has no prior job dir (never ran)
970- so it gets a normal fresh run instead of a replay.
973+
974+ Priority order:
975+ 1. Suite has its own matched job dir and it is not complete → replay it.
976+ 2. An unmatched interrupted job dir exists and this suite has no own
977+ job dir (i.e. it was the suite running when the job was killed and
978+ no results.json was written) → claim that dir for replay.
979+ 3. Otherwise return None so the suite gets a normal fresh run.
971980 """
972981 if suite_name in suite_job_map and not _suite_completed (suite_name ):
973982 return suite_job_map [suite_name ]
974- if "__interrupted__" in suite_job_map and suite_name in suite_job_map :
983+ if "__interrupted__" in suite_job_map and suite_name not in suite_job_map :
975984 return suite_job_map .pop ("__interrupted__" )
976985 return None
977986
0 commit comments