twister: fix subset processing

Process subsets was done in the wrong step, so make it apply and
generarte subsets correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2022-06-13 11:30:38 -04:00
commit 91b2cce64e
2 changed files with 22 additions and 11 deletions

View file

@ -238,16 +238,6 @@ class TestPlan:
raise TwisterRuntimeError("No quarantine list given to be verified")
if self.options.subset:
subset, sets = self.options.subset.split("/")
subset = int(subset)
if int(subset) > 0 and int(sets) >= int(subset):
logger.info("Running only a subset: %s/%s" % (subset, sets))
else:
logger.error("You have provided a wrong subset value: %s." % self.options.subset)
return
self.generate_subset(subset, sets)
def load(self):
if self.options.report_suffix:
@ -276,6 +266,23 @@ class TestPlan:
else:
self.apply_filters()
if self.options.subset:
s = self.options.subset
try:
subset, sets = (int(x) for x in s.split("/"))
except ValueError as e:
raise TwisterRuntimeError("Bad subset value.")
if subset > sets:
raise TwisterRuntimeError("subset should not exceed the total number of sets")
if int(subset) > 0 and int(sets) >= int(subset):
logger.info("Running only a subset: %s/%s" % (subset, sets))
else:
raise TwisterRuntimeError(f"You have provided a wrong subset value: {self.options.subset}.")
self.generate_subset(subset, int(sets))
def generate_subset(self, subset, sets):
# Test instances are sorted depending on the context. For CI runs
# the execution order is: "plat1-testA, plat1-testB, ...,

View file

@ -911,7 +911,11 @@ def main():
if tplan.report() == 0:
return
try:
tplan.load()
except RuntimeError as e:
logger.error(f"{e}")
sys.exit(1)
if options.list_tests and options.platform:
tplan.report_platform_tests(options.platform)