[dv/dvsim] collect coverage in scheduler
Current Scheduler.py will kill the `next_item` if any dependencies
failed or killed. But for nightly regression coverage runs, I think the
goal is to collect coverage as long as there is any passing test. So
here I add some logic to the `dispatch` function.
Signed-off-by: Cindy Chen <chencindy@google.com>
diff --git a/util/dvsim/Deploy.py b/util/dvsim/Deploy.py
index af9dd0f..4ff7a1b 100644
--- a/util/dvsim/Deploy.py
+++ b/util/dvsim/Deploy.py
@@ -65,6 +65,11 @@
# A list of jobs on which this job depends
self.dependencies = []
+ # Indicates whether running this job requires all dependencies to pass.
+ # If this flag is set to False, any passing dependency will trigger
+ # this current job to run
+ self.needs_all_dependencies_passing = True
+
# Process
self.process = None
self.log_fd = None
@@ -739,6 +744,7 @@
super().__init__(sim_cfg)
self.dependencies += run_items
+ self.needs_all_dependencies_passing = False
self.target = "cov_merge"
self.pass_patterns = []
diff --git a/util/dvsim/Scheduler.py b/util/dvsim/Scheduler.py
index 4eab47e..95d8a36 100644
--- a/util/dvsim/Scheduler.py
+++ b/util/dvsim/Scheduler.py
@@ -98,17 +98,22 @@
while len(to_dispatch) < num_slots and self._queued:
next_item = self._queued.pop(0)
-
# Does next_item have any dependencies? Since we dispatch jobs by
# target, we can assume that each of those dependencies appears
# in old_results.
- has_failed_dep = False
+ has_failed_dep = False if next_item.needs_all_dependencies_passing else True
for dep in next_item.dependencies:
dep_status = old_results[dep]
assert dep_status in ['P', 'F', 'K']
- if dep_status in ['F', 'K']:
- has_failed_dep = True
- break
+
+ if next_item.needs_all_dependencies_passing:
+ if dep_status in ['F', 'K']:
+ has_failed_dep = True
+ break
+ else:
+ if dep_status in ['P']:
+ has_failed_dep = False
+ break
# If has_failed_dep then at least one of the dependencies has been
# cancelled or has run and failed. Give up on this item too.