Fixed tst_selftests on OSX 10.7

Our OSX 10.7 test machines send a SIGILL rather than a SIGSEGV to a
process which attempts to dereference a null pointer.

Change the "crashes" test to dereference an invalid pointer with a
value slightly greater than 0 so that we get the same crash behavior on
all (unix) platforms.

Change-Id: I700a2c7d654a9468af5e5996010a258695ed2ae5
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Rohan McGovern 2012-02-08 14:06:18 +10:00 committed by Qt by Nokia
parent 0efb8a7ee3
commit 931f4501a6

View File

@ -61,8 +61,14 @@ void tst_Crashes::crash()
//we avoid the error dialogbox to appear on windows
SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
#endif
/*
We deliberately dereference an invalid but non-zero address;
it should be non-zero because a few platforms may have special crash behavior
when dereferencing exactly 0 (e.g. some macs have been observed to generate SIGILL
rather than SIGSEGV).
*/
int *i = 0;
*i = 1;
i[1] = 1;
}
QTEST_MAIN(tst_Crashes)