[Piglit] [PATCH 1/3] piglit-run.py: Cleanups
Ken Phillis Jr
kphillisjr at gmail.com
Mon Nov 18 15:10:34 PST 2013
This patch series looks good to me.
Reviewed by: Kenney Phillis <Kkphillisjr at gmail.com>
On Fri, Nov 15, 2013 at 12:24 PM, Dylan Baker <baker.dylan.c at gmail.com>wrote:
> This patch tidies up a few things, and lays groundwork for later patches
> in this series.
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> piglit-run.py | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/piglit-run.py b/piglit-run.py
> index 1d63cd4..86448ae 100755
> --- a/piglit-run.py
> +++ b/piglit-run.py
> @@ -77,27 +77,25 @@ def main():
> action="store_true",
> help="Capture a difference in dmesg before and "
> "after each test")
> - parser.add_argument("testProfile",
> + parser.add_argument("test_profile",
> metavar="<Path to test profile>",
> help="Path to testfile to run")
> - parser.add_argument("resultsPath",
> + parser.add_argument("results_path",
> + type=path.realpath,
> metavar="<Results Path>",
> help="Path to results folder")
> args = parser.parse_args()
>
> # Set the platform to pass to waffle
> - if args.platform is not None:
> + if args.platform:
> os.environ['PIGLIT_PLATFORM'] = args.platform
>
> - # Always Convert Results Path from Relative path to Actual Path.
> - resultsDir = path.realpath(args.resultsPath)
> -
> # If resume is requested attempt to load the results file
> # in the specified path
> if args.resume is True:
> # Load settings from the old results JSON
> - old_results = core.load_results(resultsDir)
> - profileFilename = old_results.options['profile']
> + old_results = core.load_results(args.results_path)
> + args.test_profile = old_results.options['profile']
>
> # Changing the args to the old args allows us to set them
> # all in one places down the way
> @@ -105,8 +103,6 @@ def main():
> args.include_tests = old_results.options['filter']
>
> # Otherwise parse additional settings from the command line
> - else:
> - profileFilename = args.testProfile
>
> # Pass arguments into Environment
> env = core.Environment(concurrent=args.concurrency,
> @@ -120,7 +116,7 @@ def main():
> piglit_dir = path.dirname(path.realpath(sys.argv[0]))
> os.chdir(piglit_dir)
>
> - core.checkDir(resultsDir, False)
> + core.checkDir(args.results_path, False)
>
> results = core.TestrunResult()
>
> @@ -128,10 +124,10 @@ def main():
> if args.name is not None:
> results.name = args.name
> else:
> - results.name = path.basename(resultsDir)
> + results.name = path.basename(args.results_path)
>
> # Begin json.
> - result_filepath = os.path.join(resultsDir, 'main')
> + result_filepath = path.join(args.results_path, 'main')
> result_file = open(result_filepath, 'w')
> json_writer = core.JSONWriter(result_file)
> json_writer.open_dict()
> @@ -139,7 +135,7 @@ def main():
> # Write out command line options for use in resuming.
> json_writer.write_dict_key('options')
> json_writer.open_dict()
> - json_writer.write_dict_item('profile', profileFilename)
> + json_writer.write_dict_item('profile', args.test_profile)
> json_writer.write_dict_item('filter', args.include_tests)
> json_writer.write_dict_item('exclude_filter', args.exclude_tests)
> json_writer.close_dict()
> @@ -148,7 +144,7 @@ def main():
> for (key, value) in env.collectData().items():
> json_writer.write_dict_item(key, value)
>
> - profile = core.loadTestProfile(profileFilename)
> + profile = core.loadTestProfile(args.test_profile)
>
> json_writer.write_dict_key('tests')
> json_writer.open_dict()
> --
> 1.8.3.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131118/070b44f0/attachment.html>
More information about the Piglit
mailing list