[Mobies-commit] [commit] r4076 - in UDM/trunk/tests: testOCL test_childrenorder test_cintstring test_domstringdn test_generic test_refports test_simpleudmops test_staticleaksdll

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Fri Aug 3 17:33:40 CDT 2012


Author: ksmyth
Date: Fri Aug  3 17:33:39 2012
New Revision: 4076

Log:
More CrtReportHook so no MessageBoxes pop up

Modified:
   UDM/trunk/tests/testOCL/main.cpp
   UDM/trunk/tests/test_childrenorder/test_childrenorder.cpp
   UDM/trunk/tests/test_cintstring/test_cintstring.cpp
   UDM/trunk/tests/test_domstringdn/test_domstringdn.cpp
   UDM/trunk/tests/test_generic/test_generic.cpp
   UDM/trunk/tests/test_refports/main.cpp
   UDM/trunk/tests/test_simpleudmops/LampTest.cpp
   UDM/trunk/tests/test_staticleaksdll/DllMain.cpp

Modified: UDM/trunk/tests/testOCL/main.cpp
==============================================================================
--- UDM/trunk/tests/testOCL/main.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/testOCL/main.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -3,8 +3,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_childrenorder/test_childrenorder.cpp
==============================================================================
--- UDM/trunk/tests/test_childrenorder/test_childrenorder.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_childrenorder/test_childrenorder.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -3,8 +3,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_cintstring/test_cintstring.cpp
==============================================================================
--- UDM/trunk/tests/test_cintstring/test_cintstring.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_cintstring/test_cintstring.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -3,8 +3,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_domstringdn/test_domstringdn.cpp
==============================================================================
--- UDM/trunk/tests/test_domstringdn/test_domstringdn.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_domstringdn/test_domstringdn.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -3,8 +3,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_generic/test_generic.cpp
==============================================================================
--- UDM/trunk/tests/test_generic/test_generic.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_generic/test_generic.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -3,8 +3,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_refports/main.cpp
==============================================================================
--- UDM/trunk/tests/test_refports/main.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_refports/main.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -2,8 +2,46 @@
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_simpleudmops/LampTest.cpp
==============================================================================
--- UDM/trunk/tests/test_simpleudmops/LampTest.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_simpleudmops/LampTest.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -6,8 +6,46 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#ifdef _WIN32
+#include <crtdbg.h>
+#include <signal.h>
+#include <windows.h>
+
+int __cdecl CrtReportHook(int reportType, char *message, int *returnValue)
+{
+	if (reportType == _CRT_ASSERT) {
+		DebugBreak();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+void __cdecl AbrtHandler(int)
+{
+	DebugBreak();
+}
+
+struct _CrtHooksRAII {
+	_CrtHooksRAII() {
+		oldAbrtHandler = signal(SIGABRT, &AbrtHandler);
+		_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+		_set_abort_behavior(0, _WRITE_ABORT_MSG);
+		oldHook = _CrtSetReportHook(&CrtReportHook);
+	}
+	~_CrtHooksRAII() {
+		_CrtSetReportHook(oldHook);
+		signal(SIGABRT, oldAbrtHandler);
+	}
+	_CRT_REPORT_HOOK oldHook;
+	void (__cdecl *oldAbrtHandler)(int);
+};
+#endif
+
 int main(int argc, char* argv[])
 {
+#ifdef _WIN32
+	_CrtHooksRAII hooks;
+#endif
 	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
 	// Adds the test to the list of test to run

Modified: UDM/trunk/tests/test_staticleaksdll/DllMain.cpp
==============================================================================
--- UDM/trunk/tests/test_staticleaksdll/DllMain.cpp	Tue Jul 31 18:08:02 2012	(r4075)
+++ UDM/trunk/tests/test_staticleaksdll/DllMain.cpp	Fri Aug  3 17:33:39 2012	(r4076)
@@ -18,7 +18,7 @@
 	//RefPort::Initialize();
 	LampDiagram::Initialize();
 	UdmUtil::stacktrace();
-#if defined(_M_IX86)
+#if defined(_M_IX86)
 	main(0, NULL);
 #endif
 }
\ No newline at end of file


More information about the Mobies-commit mailing list