[3/3] framework/resume: properly parse the no_retry option

Submitted by Marek Olšák on May 30, 2018, 8:04 p.m.

Details

Message ID 20180530200448.25471-3-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák May 30, 2018, 8:04 p.m.
From: Nicolai Hähnle <nicolai.haehnle@amd.com>

---
 framework/programs/run.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/framework/programs/run.py b/framework/programs/run.py
index bbc527b55..a970845dc 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -377,20 +377,22 @@  def run(input_):
 
     time_elapsed.end = time.time()
     backend.finalize({'time_elapsed': time_elapsed.to_json()})
 
     print('Thank you for running Piglit!\n'
           'Results have been written to ' + args.results_path)
 
 
 @exceptions.handler
 def resume(input_):
+    unparsed = parsers.parse_config(input_)[1]
+
     parser = argparse.ArgumentParser()
     parser.add_argument("results_path",
                         type=path.realpath,
                         metavar="<Results Path>",
                         help="Path to results folder")
     parser.add_argument("-f", "--config",
                         dest="config_file",
                         type=argparse.FileType("r"),
                         help="Optionally specify a piglit config file to use. "
                              "Default is piglit.conf")
@@ -399,32 +401,31 @@  def resume(input_):
                         action="store_true",
                         help="Do not retry incomplete tests")
     parser.add_argument('-j', '--jobs',
                         dest='jobs',
                         action='store',
                         type=int,
                         default=core.PIGLIT_CONFIG.safe_get(
                             'core', 'jobs', '-1'),
                         help='Set the maximum number of jobs to run concurrently. '
                              'By default, the reported number of CPUs is used.')
-    args = parser.parse_args(input_)
+    args = parser.parse_args(unparsed)
     _disable_windows_exception_messages()
 
     results = backends.load(args.results_path)
     options.OPTIONS.execute = results.options['execute']
     options.OPTIONS.valgrind = results.options['valgrind']
     options.OPTIONS.sync = results.options['sync']
     options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass']
     options.OPTIONS.process_isolation = results.options['process_isolation']
     options.OPTIONS.jobs = args.jobs
-
-    core.get_config(args.config_file)
+    options.OPTIONS.no_retry = args.no_retry
 
     options.OPTIONS.env['PIGLIT_PLATFORM'] = results.options['platform']
 
     results.options['env'] = core.collect_system_info()
     results.options['name'] = results.name
 
     # Resume only works with the JSON backend
     backend = backends.get_backend('json')(
         args.results_path,
         file_start_count=len(results.tests) + 1)

Comments

Quoting Marek Olšák (2018-05-30 13:04:48)
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
> 
> ---
>  framework/programs/run.py | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index bbc527b55..a970845dc 100644
> --- a/framework/programs/run.py
> +++ b/framework/programs/run.py
> @@ -377,20 +377,22 @@ def run(input_):
>  
>      time_elapsed.end = time.time()
>      backend.finalize({'time_elapsed': time_elapsed.to_json()})
>  
>      print('Thank you for running Piglit!\n'
>            'Results have been written to ' + args.results_path)
>  
>  
>  @exceptions.handler
>  def resume(input_):
> +    unparsed = parsers.parse_config(input_)[1]
> +
>      parser = argparse.ArgumentParser()
>      parser.add_argument("results_path",
>                          type=path.realpath,
>                          metavar="<Results Path>",
>                          help="Path to results folder")
>      parser.add_argument("-f", "--config",
>                          dest="config_file",
>                          type=argparse.FileType("r"),
>                          help="Optionally specify a piglit config file to use. "
>                               "Default is piglit.conf")
> @@ -399,32 +401,31 @@ def resume(input_):
>                          action="store_true",
>                          help="Do not retry incomplete tests")
>      parser.add_argument('-j', '--jobs',
>                          dest='jobs',
>                          action='store',
>                          type=int,
>                          default=core.PIGLIT_CONFIG.safe_get(
>                              'core', 'jobs', '-1'),
>                          help='Set the maximum number of jobs to run concurrently. '
>                               'By default, the reported number of CPUs is used.')
> -    args = parser.parse_args(input_)
> +    args = parser.parse_args(unparsed)
>      _disable_windows_exception_messages()
>  
>      results = backends.load(args.results_path)
>      options.OPTIONS.execute = results.options['execute']
>      options.OPTIONS.valgrind = results.options['valgrind']
>      options.OPTIONS.sync = results.options['sync']
>      options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass']
>      options.OPTIONS.process_isolation = results.options['process_isolation']
>      options.OPTIONS.jobs = args.jobs
> -
> -    core.get_config(args.config_file)

I'd have to think really hard about whether dropping this line is actually safe,
since it loads the config file you passed and that can be used to set things
like the compression to use.

Without this line removed:
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>

> +    options.OPTIONS.no_retry = args.no_retry
>  
>      options.OPTIONS.env['PIGLIT_PLATFORM'] = results.options['platform']
>  
>      results.options['env'] = core.collect_system_info()
>      results.options['name'] = results.name
>  
>      # Resume only works with the JSON backend
>      backend = backends.get_backend('json')(
>          args.results_path,
>          file_start_count=len(results.tests) + 1)
> -- 
> 2.17.0
> 
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit