summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-02-08 14:06:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-09 03:31:08 +0100
commit931f4501a6f5fb77c9bd9f48b63a8ee88cba4355 (patch)
treebf7bd1c6c59f88debb498383c7f20cfb44a3ed35 /tests/auto
parent0efb8a7ee3ef3ca37760ecf1972c0f2bc5ae2846 (diff)
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>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/testlib/selftests/crashes/tst_crashes.cpp8
1 files changed, 7 insertions, 1 deletions
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)