diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-04-19 11:15:21 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-04-19 12:03:23 (GMT) |
commit | 8bc3b7cc5d7ee52962e06a1d4fdbbfb439cfa416 (patch) | |
tree | e8c2a7fd69846169b78e118455db2038d775e7a9 /tests/auto/qfile | |
parent | b0a01659ee47752d905b2c30bf9027ced8b1f86c (diff) | |
download | Qt-8bc3b7cc5d7ee52962e06a1d4fdbbfb439cfa416.zip Qt-8bc3b7cc5d7ee52962e06a1d4fdbbfb439cfa416.tar.gz Qt-8bc3b7cc5d7ee52962e06a1d4fdbbfb439cfa416.tar.bz2 |
Fix qfile autotest hanging in CI system
The test machine is configured to pop up dialogs in case of CRT
assertion failures. The CRT has a debug assert whenever an invalid
file handle is used, while the test is expecting to get the EBADF
return code.
Due to some behaviour change in windows 7 (maybe SP1), we need to
call _CrtSetReportMode in addition to setting an error handler.
Reviewed-By: mread
Diffstat (limited to 'tests/auto/qfile')
-rw-r--r-- | tests/auto/qfile/tst_qfile.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 79539c9..688a92d 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -3294,13 +3294,18 @@ public: static void ignore_invalid_parameter(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t) {} AutoIgnoreInvalidParameter() { - old = _set_invalid_parameter_handler(ignore_invalid_parameter); + oldHandler = _set_invalid_parameter_handler(ignore_invalid_parameter); + //also disable the abort/retry/ignore popup + oldReportMode = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); } ~AutoIgnoreInvalidParameter() { - _set_invalid_parameter_handler(old); + //restore previous settings + _set_invalid_parameter_handler(oldHandler); + _CrtSetReportMode(_CRT_ASSERT, oldReportMode); } - _invalid_parameter_handler old; + _invalid_parameter_handler oldHandler; + int oldReportMode; #endif }; |