[Mobies-commit] [commit] r3837 - in UDM/trunk/tests: testGetAdjacentObjects test_assocInheritanceMGA test_libs test_refports test_staticleaks
ksmyth at redhat1.isis.vanderbilt.edu
ksmyth at redhat1.isis.vanderbilt.edu
Wed Aug 24 16:33:09 CDT 2011
Author: ksmyth
Date: Wed Aug 24 16:33:09 2011
New Revision: 3837
Log:
Dont MessageBox on ASSERT failure
Modified:
UDM/trunk/tests/testGetAdjacentObjects/main.cpp
UDM/trunk/tests/test_assocInheritanceMGA/main.cpp
UDM/trunk/tests/test_libs/main.cpp
UDM/trunk/tests/test_refports/main.cpp
UDM/trunk/tests/test_staticleaks/main.cpp
Modified: UDM/trunk/tests/testGetAdjacentObjects/main.cpp
==============================================================================
--- UDM/trunk/tests/testGetAdjacentObjects/main.cpp Wed Aug 24 16:32:50 2011 (r3836)
+++ UDM/trunk/tests/testGetAdjacentObjects/main.cpp Wed Aug 24 16:33:09 2011 (r3837)
@@ -1,10 +1,40 @@
#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
+
#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();
+}
+#endif
int main(int argc, char* argv[])
{
- CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); // Adds the test to the list of test to run
+#ifdef _WIN32
+ signal(SIGABRT, &AbrtHandler);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+ _set_abort_behavior(0, _WRITE_ABORT_MSG);
+ _CrtSetReportHook(&CrtReportHook);
+#endif
+
+ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+
+ // Adds the test to the list of test to run
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
@@ -16,5 +46,5 @@
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
-}
-
+
+}
Modified: UDM/trunk/tests/test_assocInheritanceMGA/main.cpp
==============================================================================
--- UDM/trunk/tests/test_assocInheritanceMGA/main.cpp Wed Aug 24 16:32:50 2011 (r3836)
+++ UDM/trunk/tests/test_assocInheritanceMGA/main.cpp Wed Aug 24 16:33:09 2011 (r3837)
@@ -3,8 +3,35 @@
#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();
+}
+#endif
+
int main(int argc, char* argv[])
{
+#ifdef _WIN32
+ signal(SIGABRT, &AbrtHandler);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+ _set_abort_behavior(0, _WRITE_ABORT_MSG);
+ _CrtSetReportHook(&CrtReportHook);
+#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_libs/main.cpp
==============================================================================
--- UDM/trunk/tests/test_libs/main.cpp Wed Aug 24 16:32:50 2011 (r3836)
+++ UDM/trunk/tests/test_libs/main.cpp Wed Aug 24 16:33:09 2011 (r3837)
@@ -1,28 +1,53 @@
-#include "LibsTest.h"
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-int main(int argc, char* argv[])
-{
- if (argc > 1) {
- UdmTests::remove_test_files = false;
- }
-
- CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
-
- // Adds the test to the list of test to run
- CPPUNIT_NS::TextUi::TestRunner runner;
- runner.addTest( suite );
-
- // Change the default outputter to a compiler error format outputter
- runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
- std::cerr ) );
- // Run the test.
- bool wasSucessful = runner.run();
-
- // Return error code 1 if the one of test failed.
- return wasSucessful ? 0 : 1;
-
-}
+#include <cppunit/CompilerOutputter.h>
+
+#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();
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+#ifdef _WIN32
+ signal(SIGABRT, &AbrtHandler);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+ _set_abort_behavior(0, _WRITE_ABORT_MSG);
+ _CrtSetReportHook(&CrtReportHook);
+#endif
+ if (argc > 1) {
+ UdmTests::remove_test_files = false;
+ }
+
+ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+
+ // Adds the test to the list of test to run
+ CPPUNIT_NS::TextUi::TestRunner runner;
+ runner.addTest( suite );
+
+ // Change the default outputter to a compiler error format outputter
+ runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
+ std::cerr ) );
+ // Run the test.
+ bool wasSucessful = runner.run();
+
+ // Return error code 1 if the one of test failed.
+ return wasSucessful ? 0 : 1;
+
+}
Modified: UDM/trunk/tests/test_refports/main.cpp
==============================================================================
--- UDM/trunk/tests/test_refports/main.cpp Wed Aug 24 16:32:50 2011 (r3836)
+++ UDM/trunk/tests/test_refports/main.cpp Wed Aug 24 16:33:09 2011 (r3837)
@@ -1,22 +1,22 @@
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-int main(int argc, char* argv[])
-{
- CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
-
- // Adds the test to the list of test to run
- CPPUNIT_NS::TextUi::TestRunner runner;
- runner.addTest( suite );
-
- // Change the default outputter to a compiler error format outputter
- runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
- std::cerr ) );
- // Run the test.
- bool wasSucessful = runner.run();
-
- // Return error code 1 if the one of test failed.
- return wasSucessful ? 0 : 1;
-
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+int main(int argc, char* argv[])
+{
+ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+
+ // Adds the test to the list of test to run
+ CPPUNIT_NS::TextUi::TestRunner runner;
+ runner.addTest( suite );
+
+ // Change the default outputter to a compiler error format outputter
+ runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
+ std::cerr ) );
+ // Run the test.
+ bool wasSucessful = runner.run();
+
+ // Return error code 1 if the one of test failed.
+ return wasSucessful ? 0 : 1;
+
}
\ No newline at end of file
Modified: UDM/trunk/tests/test_staticleaks/main.cpp
==============================================================================
--- UDM/trunk/tests/test_staticleaks/main.cpp Wed Aug 24 16:32:50 2011 (r3836)
+++ UDM/trunk/tests/test_staticleaks/main.cpp Wed Aug 24 16:33:09 2011 (r3837)
@@ -1,22 +1,50 @@
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-int main(int argc, char* argv[])
-{
- CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
-
- // Adds the test to the list of test to run
- CPPUNIT_NS::TextUi::TestRunner runner;
- runner.addTest( suite );
-
- // Change the default outputter to a compiler error format outputter
- runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
- std::cerr ) );
- // Run the test.
- bool wasSucessful = runner.run();
-
- // Return error code 1 if the one of test failed.
- return wasSucessful ? 0 : 1;
-
-}
+#include <cppunit/CompilerOutputter.h>
+
+#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();
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+#ifdef _WIN32
+ signal(SIGABRT, &AbrtHandler);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+ _set_abort_behavior(0, _WRITE_ABORT_MSG);
+ _CrtSetReportHook(&CrtReportHook);
+#endif
+
+ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+
+ // Adds the test to the list of test to run
+ CPPUNIT_NS::TextUi::TestRunner runner;
+ runner.addTest( suite );
+
+ // Change the default outputter to a compiler error format outputter
+ runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
+ std::cerr ) );
+ // Run the test.
+ bool wasSucessful = runner.run();
+
+ // Return error code 1 if the one of test failed.
+ return wasSucessful ? 0 : 1;
+
+}
More information about the Mobies-commit
mailing list