Fixed tst_selftests on OSX 10.7
authorRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 8 Feb 2012 04:06:18 +0000 (14:06 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 9 Feb 2012 02:31:08 +0000 (03:31 +0100)
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>
tests/auto/testlib/selftests/crashes/tst_crashes.cpp

index b6298f5..c2174e9 100644 (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)