diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2013-11-15 10:03:54 -0800 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2013-11-19 09:30:05 -0800 |
commit | 9e6407e8c0d3516f1cce157fd1a9e9949eba2570 (patch) | |
tree | 3c1e89100a251aff616606923a16a4df3a29f6d8 /piglit-resume.py | |
parent | 0618aa38d4a8a7c82994fb28a41576da9a2cc414 (diff) |
Split resume functionality out of piglit-run.py
The resume functionality actually shares only a little boilerplate with
the run functionality, and there is a lot of extra boilerplate that
exists (or should exist) to make resumes work correctly with all of the
command line options allowed by piglit-run. Therefore, it makes more
sense to split it out into it's own file.
Reviewed by: Kenney Phillis <Kkphillisjr@gmail.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Diffstat (limited to 'piglit-resume.py')
-rwxr-xr-x | piglit-resume.py | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/piglit-resume.py b/piglit-resume.py new file mode 100755 index 000000000..ae5de9b96 --- /dev/null +++ b/piglit-resume.py @@ -0,0 +1,84 @@ +#!/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. + +import sys +import os +import os.path as path +import argparse + +import framework.core as core + + +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() + + 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']) + + # Change working directory to the piglit directory + os.chdir(path.dirname(path.realpath(sys.argv[0]))) + + 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() + + json_writer.write_dict_item('name', results.name) + for (key, value) in env.collectData().items(): + json_writer.write_dict_item(key, value) + + 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) + json_writer.close_dict() + + profile = core.loadTestProfile(results.options['profile']) + # 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("\n" + "Thank you for running Piglit!\n" + "Results have ben wrriten to {0}".format(results_path)) + +if __name__ == "__main__": + main()
\ No newline at end of file |