diff options
author | Dylan Baker <dylanx.c.baker@intel.com> | 2014-10-23 01:02:41 -0700 |
---|---|---|
committer | Dylan Baker <dylanx.c.baker@intel.com> | 2014-10-28 19:34:49 -0700 |
commit | f96c83719436ebfc129c4e0e52bc3bd72f837938 (patch) | |
tree | 6513d219b86b1468e282984602f8b059692421f2 | |
parent | 3c686574b69dd7d921f805f6449d96a9cc4d835d (diff) |
run.py: Split windows exception handling into helper
This allows the function to be shared by run and resume. It was not
present in resume before, thus windows exceptions would still raise an
exception and open a popup window.
v2: - rename function per Ken
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r-- | framework/programs/run.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/framework/programs/run.py b/framework/programs/run.py index 15f6ec617..e96c0f06b 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -27,6 +27,7 @@ import os import os.path as path import time import ConfigParser +import ctypes import framework.core as core import framework.results @@ -190,22 +191,13 @@ def _run_parser(input_): return parser.parse_args(unparsed) -def run(input_): - """ Function for piglit run command - - This is a function because it allows it to be shared between piglit-run.py - and piglit run - - """ - args = _run_parser(input_) - - # Disable Windows error message boxes for this and all child processes. +def _disable_windows_exception_messages(): + """Disable Windows error message boxes for this and all child processes.""" if sys.platform == 'win32': # This disables messages boxes for uncaught exceptions, but it will not # disable the message boxes for assertion failures or abort(). Those # are created not by the system but by the CRT itself, and must be # disabled by the child processes themselves. - import ctypes SEM_FAILCRITICALERRORS = 0x0001 SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 SEM_NOGPFAULTERRORBOX = 0x0002 @@ -217,6 +209,17 @@ def run(input_): | SEM_NOOPENFILEERRORBOX ctypes.windll.kernel32.SetErrorMode(uMode) + +def run(input_): + """ Function for piglit run command + + This is a function because it allows it to be shared between piglit-run.py + and piglit run + + """ + args = _run_parser(input_) + _disable_windows_exception_messages() + # If dmesg is requested we must have serial run, this is becasue dmesg # isn't reliable with threaded run if args.dmesg: @@ -292,6 +295,7 @@ def resume(input_): help="Optionally specify a piglit config file to use. " "Default is piglit.conf") args = parser.parse_args(input_) + _disable_windows_exception_messages() results = framework.results.TestrunResult.resume(args.results_path) opts = core.Options(concurrent=results.options['concurrent'], |