summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-03-13 10:46:39 -0700
committerQt by Nokia <qt-info@nokia.com>2012-03-15 11:40:50 +0100
commit65a2613e3e4fd341c2be35cb4eaf03d0918c2661 (patch)
tree5aed60f960e72d6f7a4e480e3224b668fc2b6a6f /tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
parent92659bacda53da782c84dff44d3caa2590dbc7cc (diff)
tst_qsharedpointer: Fix auto test fail under Windows 7
The tst_QSharedPointer generate another Process to test some invalid codes, and it expect that the prcoess will crash and return a non-zero value. The process which is a console application was linked to windows subsystem, and QProcess seems can not get its return value. This cause the unit test fail. In addition, when the process crash under debug mode, a debug error report-dialog will appear, which is very annoying, so I suppress it too. Task-number: QTBUG-24160 Change-Id: Ia1c872d4515c83b0aa516bcfe3783f59797d2d49 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer/externaltests.cpp')
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index fb946d9ca1..0e7e2fad70 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -353,15 +353,25 @@ namespace QTest {
"\n"
"#ifdef Q_OS_WIN\n"
"#include <windows.h>\n"
+ "#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)\n"
+ "#include <crtdbg.h>\n"
+ "#endif\n"
"static void q_test_setup()\n"
"{\n"
" SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n"
"}\n"
+ "static int __cdecl CrtDbgHook(int /*reportType*/, char * /*message*/, int * /*returnValue*/)\n"
+ "{\n"
+ " return TRUE;\n"
+ "}\n"
"#else\n"
"static void q_test_setup() { }\n"
"#endif\n"
"int main(int argc, char **argv)\n"
- "{\n";
+ "{\n"
+ "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) && !defined(Q_OS_WINCE)\n"
+ " _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);\n"
+ "#endif\n";
switch (appType) {
applicationless:
@@ -456,6 +466,7 @@ namespace QTest {
"TARGET = externaltest\n"
"CONFIG -= app_bundle\n" // for the Mac
"CONFIG -= debug_and_release\n"
+ "CONFIG += console\n"
"DESTDIR = .\n"
"OBJECTS_DIR = .\n"
"UI_DIR = .\n"