[Piglit] [PATCH] run.py: Split windows exception handling into helper

Kenneth Graunke kenneth at whitecape.org
Fri Oct 24 11:41:22 PDT 2014


On Thursday, October 23, 2014 01:09:40 AM Dylan Baker wrote:
> 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.
> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  framework/programs/run.py | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index 15f6ec6..b2fe097 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 _handle_windows_exceptions():

Perhaps _disable_windows_exception_error_messages()?

Either way,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +    """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_)
> +    _handle_windows_exceptions()
> +
>      # 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_)
> +    _handle_windows_exceptions()
>  
>      results = framework.results.TestrunResult.resume(args.results_path)
>      opts = core.Options(concurrent=results.options['concurrent'],
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20141024/89124145/attachment.sig>


More information about the Piglit mailing list