Reviewed-by: Dylan Baker <[email protected]>

On Fri, Jun 19, 2015 at 08:33:11PM +0100, Jose Fonseca wrote:
> Programs that terminate via MSVCRT's abort(), including failed
> assertions, return code 3, not a negative number.
> 
> This is particularly pertinent now that the use of the standard assert
> macro has increased in (over gallium's assert macro, which would trap
> the debugger with INT3, and return a negative exception number.)
> ---
>  framework/test/base.py | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/framework/test/base.py b/framework/test/base.py
> index f29fc94..2dc0f4b 100644
> --- a/framework/test/base.py
> +++ b/framework/test/base.py
> @@ -109,6 +109,19 @@ class ProcessTimeout(threading.Thread):
>          return self.status
>  
>  
> +def _is_crash_returncode(returncode):
> +    """Determine whether the given process return code correspond to a
> +    crash."""
> +    if sys.platform == 'win32':
> +        # On Windows:
> +        # - For uncaught exceptions the process terminates with the exception
> +        # code, which is usually negative
> +        # - MSVCRT's abort() terminates process with exit code 3
> +        return returncode < 0 or returncode == 3
> +    else:
> +        return returncode < 0
> +
> +
>  class Test(object):
>      """ Abstract base class for Test classes
>  
> @@ -228,7 +241,7 @@ class Test(object):
>  
>          self.interpret_result()
>  
> -        if self.result['returncode'] < 0:
> +        if _is_crash_returncode(self.result['returncode']):
>              # check if the process was terminated by the timeout
>              if self.timeout > 0 and self.__proc_timeout.join() > 0:
>                  self.result['result'] = 'timeout'
> -- 
> 2.1.0
> 

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to