[Piglit] [PATCH] framework/test/base: Recognize returncode 3 as crash on Windows.
Dylan Baker
baker.dylan.c at gmail.com
Mon Jun 22 10:57:54 PDT 2015
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150622/5e066be0/attachment.sig>
More information about the Piglit
mailing list