I wonder if it would be more appropriate to avoid marking tests like 
this as XFAIL and instead make them PASS.

Maybe we could set a signal handle for SIGSEGV and make it call 
`_exit(0)` and make `main` return 1?

I'm currently writing testsuite for library I'm working on and I have 
tests which test unrecoverable situations which must terminate the 
process. The issue with marking such tests with XFAIL is that they may 
fail for another reason, but since they are XFAIL they will be 
considered to be OK.

While this particular test is very simple and nothing should go wrong, I 
think it is a good idea to make tests PASS instead of XFAIL whenever 
possible.

- Kirill Makurin

On 10/26/2025 12:45 AM, Pali Rohár wrote:
> Test t_nullptrexception is expected to crash.
> ---
>   mingw-w64-crt/testcases/t_nullptrexception.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/mingw-w64-crt/testcases/t_nullptrexception.c 
b/mingw-w64-crt/testcases/t_nullptrexception.c
> index 3c2c47adee7a..cc93c49745ff 100644
> --- a/mingw-w64-crt/testcases/t_nullptrexception.c
> +++ b/mingw-w64-crt/testcases/t_nullptrexception.c
> @@ -1,9 +1,11 @@
>   #include 
> +#include 
>   
>   char *p = NULL;
>   
>   int main()
>   {
> +  SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
>     printf ("Raise uncaught NULL pointer exception...\n");
>     *p = 0;
>     return 0;


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to