Commit 81a091ae authored by Dylan Baker's avatar Dylan Baker

Add support to load multiple test profiles

This patch gives piglit run the ability to take one or more test
proflies as arguments rather than just one. It loads the profiles,
merging them from left to right, overwriting conflicting results. This
will allow the oglconform and es3conform loaders to be taken out of
all.tests.
Acked-by: Daniel Vetter's avatarDaniel Vetter <daniel@ffwll.ch>
Reviewed-by: Kenneth Graunke (AFK until mid-April)'s avatarKenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dylan Baker's avatarDylan Baker <baker.dylan.c@gmail.com>
parent 2b42fa0f
......@@ -616,6 +616,22 @@ class TestProfile:
group = group[group_name]
del group[l[-1]]
def update(self, *profiles):
""" Updates the contents of this TestProfile instance with another
This method overwrites key:value pairs in self with those in the
provided profiles argument. This allows multiple TestProfiles to be
called in the same run; which could be used to run piglit and external
suites at the same time.
Arguments:
profiles -- one or more TestProfile-like objects to be merged.
"""
for profile in profiles:
self.tests.update(profile.tests)
self.test_list.update(profile.test_list)
def loadTestProfile(filename):
ns = {'__file__': filename}
......@@ -627,6 +643,22 @@ def loadTestProfile(filename):
return ns['profile']
def merge_test_profiles(profiles):
""" Helper for loading and merging TestProfile instances
Takes paths to test profiles as arguments and returns a single merged
TestPRofile instance.
Arguments:
profiles -- a list of one or more paths to profile files.
"""
profile = loadTestProfile(profiles.pop())
for p in profiles:
profile.update(loadTestProfile(p))
return profile
def load_results(filename):
""" Loader function for TestrunResult class
......
......@@ -74,7 +74,7 @@ def main():
json_writer.write_dict_item(key, value)
env.exclude_tests.add(key)
profile = core.loadTestProfile(results.options['profile'])
profile = core.merge_test_profiles(results.options['profile'])
# This is resumed, don't bother with time since it wont be accurate anyway
profile.run(env, json_writer)
......
......@@ -80,7 +80,8 @@ def main():
help="Capture a difference in dmesg before and "
"after each test")
parser.add_argument("test_profile",
metavar="<Path to test profile>",
metavar="<Path to one or more test profile(s)>",
nargs='+',
help="Path to testfile to run")
parser.add_argument("results_path",
type=path.realpath,
......@@ -134,7 +135,7 @@ def main():
for (key, value) in env.collectData().items():
json_writer.write_dict_item(key, value)
profile = core.loadTestProfile(args.test_profile)
profile = core.merge_test_profiles(args.test_profile)
json_writer.write_dict_key('tests')
json_writer.open_dict()
......
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