twister: Fix bug re-running all tests when using test-only

When using both test-only and retry-failed flags, all tests would be
added to the test queue regardless if they failed or not. This commit
updates the logic to process test-only runs similar as other runs,
by adding tests to the queue with the 'run' operation directly.

Signed-off-by: Andreas Vibeto <andreas.vibeto@nordicsemi.no>
This commit is contained in:
Andreas Vibeto 2021-07-16 10:01:49 +02:00 committed by Christopher Friedt
commit 32fbf8e414

View file

@ -3310,16 +3310,16 @@ class TestSuite(DisablePyTestCollectionMixin):
if build_only: if build_only:
instance.run = False instance.run = False
if test_only and instance.run: if instance.status not in ['passed', 'skipped', 'error']:
pipeline.put({"op": "run", "test": instance}) logger.debug(f"adding {instance.name}")
else: instance.status = None
if instance.status not in ['passed', 'skipped', 'error']: if test_only and instance.run:
logger.debug(f"adding {instance.name}") pipeline.put({"op": "run", "test": instance})
instance.status = None else:
pipeline.put({"op": "cmake", "test": instance}) pipeline.put({"op": "cmake", "test": instance})
# If the instance got 'error' status before, proceed to the report stage # If the instance got 'error' status before, proceed to the report stage
if instance.status == "error": if instance.status == "error":
pipeline.put({"op": "report", "test": instance}) pipeline.put({"op": "report", "test": instance})
def pipeline_mgr(self, pipeline, done_queue, lock, results): def pipeline_mgr(self, pipeline, done_queue, lock, results):
while True: while True: