summaryrefslogtreecommitdiff
path: root/piglit-resume.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2014-05-02 00:23:28 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2014-05-06 20:10:22 -0700
commit9b1e7da290cd612690e85bcacc99b50c65d83fe6 (patch)
tree2368cf51b5639a666245636b50d42dde5bf7fd24 /piglit-resume.py
parent463b049bf3b0a9cc41bc4886d013f161b8156e74 (diff)
framework: move executable functions to modules
This moves piglit-run and piglit-resume main() functions to framework.programs.run as run() and resume() respectively, and moves piglit-summary-* to framework.programs.summary. It then creates compatibility wrappers as piglit-*.py for the functions. This is groundwork for a combined piglit interface. The original files could not be imported directly since they have dash (-) in their name, and python considers dash an illegal character for function, class, and modules names, and python would raise an ImportError when attempting to import one of them. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'piglit-resume.py')
-rwxr-xr-xpiglit-resume.py108
1 files changed, 22 insertions, 86 deletions
diff --git a/piglit-resume.py b/piglit-resume.py
index 638d63ac3..68c546ddf 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -1,96 +1,32 @@
#!/usr/bin/env python
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use,
-# copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following
-# conditions:
-#
-# This permission notice shall be included in all copies or
-# substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-from __future__ import print_function
-import sys
-import os
-import os.path as path
-import argparse
-
-import framework.core as core
-import framework.profile
-
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("results_path",
- type=path.realpath,
- metavar="<Results Path>",
- help="Path to results folder")
- args = parser.parse_args()
+# Copyright (c) 2014 Intel Corporation
- results = core.load_results(args.results_path)
- env = core.Environment(concurrent=results.options['concurrent'],
- exclude_filter=results.options['exclude_filter'],
- include_filter=results.options['filter'],
- execute=results.options['execute'],
- valgrind=results.options['valgrind'],
- dmesg=results.options['dmesg'],
- verbose=results.options['verbose'])
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
- # Change working directory to the piglit directory
- os.chdir(path.dirname(path.realpath(sys.argv[0])))
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
- # attempt to restore a saved platform, if there is no saved platform just
- # go on
- try:
- os.environ['PIGLIT_PLATFORM'] = results.options['platform']
- except KeyError:
- pass
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
- results_path = path.join(args.results_path, "main")
- json_writer = core.JSONWriter(open(results_path, 'w+'))
- json_writer.open_dict()
- json_writer.write_dict_key("options")
- json_writer.open_dict()
- for key, value in results.options.iteritems():
- json_writer.write_dict_item(key, value)
- json_writer.close_dict()
+""" Resume an interupted piglit run
- json_writer.write_dict_item('name', results.name)
- for (key, value) in env.collectData().items():
- json_writer.write_dict_item(key, value)
+Deprecated compatability wrapper
- json_writer.write_dict_key('tests')
- json_writer.open_dict()
- for key, value in results.tests.iteritems():
- json_writer.write_dict_item(key, value)
- env.exclude_tests.add(key)
-
- profile = framework.profile.merge_test_profiles(results.options['profile'])
- profile.results_dir = args.results_path
- if env.dmesg:
- profile.dmesg = env.dmesg
+"""
- # This is resumed, don't bother with time since it wont be accurate anyway
- profile.run(env, json_writer)
-
- json_writer.close_dict()
- json_writer.close_dict()
- json_writer.file.close()
-
- print("Thank you for running Piglit!\n"
- "Results have ben wrriten to {0}".format(results_path))
+import sys
+from framework.programs.run import resume
-if __name__ == "__main__":
- main()
+resume(sys.argv)