Commit 9461d923 authored by Dylan Baker's avatar Dylan Baker

framework/profile: Add a __len__ method to TestProfile

This exposes a standard interface for getting the number of tests in a
profile, which is itself nice. It will also allow us to encapsulate the
differences between the various profiles added in this series.
Tested-by: Rafael Antognolli's avatarRafael Antognolli <rafael.antognolli@intel.com>
parent 91b04a67
......@@ -284,6 +284,9 @@ class TestProfile(object):
'ignore_missing': False,
}
def __len__(self):
return sum(1 for _ in self.itertests())
def setup(self):
"""Method to do pre-run setup."""
......@@ -381,15 +384,12 @@ def run(profiles, logger, backend, concurrency):
"""
chunksize = 1
# The logger needs to know how many tests are running. Because of filters
# there's no way to do that without making a concrete list out of the
# filters profiles.
profiles = [(p, list(p.itertests())) for p in profiles]
log = LogManager(logger, sum(len(l) for _, l in profiles))
profiles = [(p, p.itertests()) for p in profiles]
log = LogManager(logger, sum(len(p) for p, _ in profiles))
# check that after the filters are run there are actually tests to run.
if not any(l for _, l in profiles):
raise exceptions.PiglitUserError('no matching tests')
# if not any(l for _, l in profiles):
# raise exceptions.PiglitUserError('no matching tests')
def test(name, test, profile, this_pool=None):
"""Function to call test.execute from map"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment