summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/core.py32
-rwxr-xr-xpiglit-resume.py2
-rwxr-xr-xpiglit-run.py5
3 files changed, 36 insertions, 3 deletions
diff --git a/framework/core.py b/framework/core.py
index 07fb235b2..7d5e581d6 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -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
diff --git a/piglit-resume.py b/piglit-resume.py
index 7e456b5af..c6b9b1e1e 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -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)
diff --git a/piglit-run.py b/piglit-run.py
index ea6d1d8a3..cf19073dc 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,
@@ -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()