From 931f4501a6f5fb77c9bd9f48b63a8ee88cba4355 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 8 Feb 2012 14:06:18 +1000 Subject: 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 --- tests/auto/testlib/selftests/crashes/tst_crashes.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index b6298f5e63..c2174e90e8 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -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) -- cgit v1.2.3