summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-06-28 13:40:42 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-06-29 10:20:06 -0700
commit56db16e43bbbd002eca2e908c9a8a7acf2dc43f3 (patch)
treec2156078f98d014770acdb122767bf50dca1863d /framework
parenta440e439064dc3f8edf647662d92ac1272f6e591 (diff)
framework: add a --timeout parameter
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. v2: - Add the word "Default" to help message. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/programs/run.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/framework/programs/run.py b/framework/programs/run.py
index afb7eb78d..151762fc5 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='Set a default timeout threshold for tests to run in.')
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