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>
This commit is contained in:
Debao Zhang 2012-03-13 10:46:39 -07:00 committed by Qt by Nokia
parent 92659bacda
commit 65a2613e3e
2 changed files with 12 additions and 3 deletions

View File

@ -353,15 +353,25 @@ namespace QTest {
"\n" "\n"
"#ifdef Q_OS_WIN\n" "#ifdef Q_OS_WIN\n"
"#include <windows.h>\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" "static void q_test_setup()\n"
"{\n" "{\n"
" SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n" " SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n"
"}\n" "}\n"
"static int __cdecl CrtDbgHook(int /*reportType*/, char * /*message*/, int * /*returnValue*/)\n"
"{\n"
" return TRUE;\n"
"}\n"
"#else\n" "#else\n"
"static void q_test_setup() { }\n" "static void q_test_setup() { }\n"
"#endif\n" "#endif\n"
"int main(int argc, char **argv)\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) { switch (appType) {
applicationless: applicationless:
@ -456,6 +466,7 @@ namespace QTest {
"TARGET = externaltest\n" "TARGET = externaltest\n"
"CONFIG -= app_bundle\n" // for the Mac "CONFIG -= app_bundle\n" // for the Mac
"CONFIG -= debug_and_release\n" "CONFIG -= debug_and_release\n"
"CONFIG += console\n"
"DESTDIR = .\n" "DESTDIR = .\n"
"OBJECTS_DIR = .\n" "OBJECTS_DIR = .\n"
"UI_DIR = .\n" "UI_DIR = .\n"

View File

@ -13,5 +13,3 @@ HEADERS = forwarddeclared.h \
TESTDATA += forwarddeclared.cpp forwarddeclared.h TESTDATA += forwarddeclared.cpp forwarddeclared.h
include(externaltests.pri) include(externaltests.pri)
win32:CONFIG += insignificant_test # QTBUG-24160