[Piglit] [PATCH] framework: add a --timeout parameter
Jordan Justen
jordan.l.justen at intel.com
Thu Jun 28 22:59:01 UTC 2018
On 2018-06-28 13:45:21, Dylan Baker wrote:
> This allows an timeout (in integers) to be set for each test. If the
> tests run over this alotted time they'll be killed and the status will
> be set to timeout. This only work on Unix-like machines running with
> python 3.x or with 2.7 and subprocess32 installed.
>
> It can be made to work for windows, either by bumping the python version
> or by writing some windows specific code for killing processes.
>
> cc: jordan.l.justen at intel.com
> cc: clayton.a.craft at intel.com
>
> ---
> framework/programs/run.py | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index afb7eb78d..337a49631 100644
> --- a/framework/programs/run.py
> +++ b/framework/programs/run.py
> @@ -39,6 +39,7 @@ from framework import exceptions
> from framework import monitoring
> from framework import profile
> from framework.results import TimeAttribute
> +from framework.test import base
> from . import parsers
>
> __all__ = ['run',
> @@ -220,6 +221,13 @@ def _run_parser(input_):
> dest="ignore_missing",
> action="store_true",
> help="missing tests are considered as 'notrun'")
> + parser.add_argument('--timeout',
> + dest='timeout',
> + action='store',
> + type=int,
> + default=None,
> + metavar='<int>',
> + help='Sets a timeout threshold for tests to run in.')
Since the tests can override this, should we say a *default* timeout?
(And add default in subject?)
I think --timeout is good for the param. (And not --default-timeout)
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
> parser.add_argument("test_profile",
> metavar="<Profile path(s)>",
> nargs='+',
> @@ -247,6 +255,7 @@ def _create_metadata(args, name, forced_test_list):
> opts['platform'] = args.platform
> opts['forced_test_list'] = forced_test_list
> opts['ignore_missing'] = args.ignore_missing
> + opts['timeout'] = args.timeout
>
> metadata = {'options': opts}
> metadata['name'] = name
> @@ -291,6 +300,7 @@ def run(input_):
>
> """
> args = _run_parser(input_)
> + base.Test.timeout = args.timeout
> _disable_windows_exception_messages()
>
> # If dmesg is requested we must have serial run, this is because dmesg
> @@ -423,6 +433,7 @@ def resume(input_):
> core.get_config(args.config_file)
>
> options.OPTIONS.env['PIGLIT_PLATFORM'] = results.options['platform']
> + base.Test.timeout = results.options['timeout']
>
> results.options['env'] = core.collect_system_info()
> results.options['name'] = results.name
> --
> 2.18.0
>
More information about the Piglit
mailing list