Author: shuston
Date: Mon Oct 5 23:19:53 2009
New Revision: 822086
URL: http://svn.apache.org/viewvc?rev=822086&view=rev
Log:
Improve ability to avoid dialogs in automated tests
Modified:
qpid/trunk/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
Modified: qpid/trunk/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp?rev=822086&r1=822085&r2=822086&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
(original)
+++ qpid/trunk/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp Mon Oct
5 23:19:53 2009
@@ -28,9 +28,23 @@
#include <crtdbg.h>
#include <windows.h>
+#include <iostream>
namespace {
+// Instead of popping up a window for exceptions, just print something out
+LONG _stdcall UnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo)
+{
+ DWORD dwExceptionCode = pExceptionInfo->ExceptionRecord->ExceptionCode;
+
+ if (dwExceptionCode == EXCEPTION_ACCESS_VIOLATION)
+ std::cerr << "\nERROR: ACCESS VIOLATION\n" << std::endl;
+ else
+ std::cerr << "\nERROR: UNHANDLED EXCEPTION\n" << std::endl;
+
+ return EXCEPTION_EXECUTE_HANDLER;
+}
+
struct redirect_errors_to_stderr {
redirect_errors_to_stderr ();
};
@@ -50,6 +64,9 @@
// and can't-open-file message boxes.
SetErrorMode(SEM_FAILCRITICALERRORS);
SetErrorMode(SEM_NOOPENFILEERRORBOX);
+
+ // And this will catch all unhandled exceptions.
+ SetUnhandledExceptionFilter (&UnhandledExceptionFilter);
}
} // namespace
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]