[Piglit] [Patch v2 02/13] Add support to load multiple test profiles
Dylan Baker
baker.dylan.c at gmail.com
Wed Jan 8 16:25:00 PST 2014
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.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/core.py | 32 ++++++++++++++++++++++++++++++++
piglit-resume.py | 2 +-
piglit-run.py | 5 +++--
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/framework/core.py b/framework/core.py
index 8bcda5b..390474e 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -606,6 +606,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}
@@ -617,6 +633,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
diff --git a/piglit-resume.py b/piglit-resume.py
index 9b3144a..6add55c 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -67,7 +67,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)
diff --git a/piglit-run.py b/piglit-run.py
index c4bed93..3ea4217 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -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,
@@ -131,7 +132,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()
--
1.8.5.2
More information about the Piglit
mailing list