unbuffer cout to work around bug in Debian version of cppunit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-08-27 20:37:44 +00:00
parent eaf6da0746
commit 2976d6cbc0

View File

@@ -26,8 +26,6 @@
using CppUnit::Test; using CppUnit::Test;
using CppUnit::TestSuite; using CppUnit::TestSuite;
using CppUnit::TestFactoryRegistry; using CppUnit::TestFactoryRegistry;
using CppUnit::TextUi::TestRunner;
using CppUnit::CompilerOutputter;
using namespace std; using namespace std;
@@ -127,7 +125,7 @@ bool TestApp::OnCmdLineParsed(wxCmdLineParser& parser)
// //
int TestApp::OnRun() int TestApp::OnRun()
{ {
TestRunner runner; CppUnit::TextTestRunner runner;
for (size_t i = 0; i < m_registries.size(); i++) { for (size_t i = 0; i < m_registries.size(); i++) {
auto_ptr<Test> test(m_registries[i].empty() ? auto_ptr<Test> test(m_registries[i].empty() ?
@@ -145,7 +143,10 @@ int TestApp::OnRun()
runner.addTest(test.release()); runner.addTest(test.release());
} }
runner.setOutputter(new CompilerOutputter(&runner.result(), cout)); if ( m_list )
return EXIT_SUCCESS;
runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), cout));
#if wxUSE_LOG #if wxUSE_LOG
// Switch off logging unless --verbose // Switch off logging unless --verbose
@@ -155,9 +156,14 @@ int TestApp::OnRun()
bool verbose = false; bool verbose = false;
#endif #endif
return ( m_list || runner.run("", false, true, !verbose) ) // there is a bug
? EXIT_SUCCESS // (http://sf.net/tracker/index.php?func=detail&aid=1649369&group_id=11795&atid=111795)
: EXIT_FAILURE; // in some versions of cppunit: they write progress dots to cout (and not
// cerr) and don't flush it so all the dots appear at once at the end which
// is not very useful so unbuffer cout to work around this
cout.setf(ios::unitbuf);
return runner.run("", false, true, !verbose) ? EXIT_SUCCESS : EXIT_FAILURE;
} }
int TestApp::OnExit() int TestApp::OnExit()