[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2957] Possibility to define an output file for the te
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2957] Possibility to define an output file for the tests suite results. |
Date: |
Mon, 10 Nov 2008 18:14:50 +0000 |
Revision: 2957
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2957
Author: gscrivano
Date: 2008-11-10 18:14:49 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Possibility to define an output file for the tests suite results.
Modified Paths:
--------------
trunk/myserver/tests/main.cpp
Modified: trunk/myserver/tests/main.cpp
===================================================================
--- trunk/myserver/tests/main.cpp 2008-11-10 10:38:12 UTC (rev 2956)
+++ trunk/myserver/tests/main.cpp 2008-11-10 18:14:49 UTC (rev 2957)
@@ -22,26 +22,47 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
+#include <fstream>
#include <string.h>
+using namespace std;
+
int main (int argc, char* argv[])
{
bool xml = argc > 1 && !strcmp (argv[1], "xml");
bool compiler = argc > 1 && !strcmp (argv[1], "compiler");
+ char *filename = argc > 2 ? argv[2] : NULL;
+
+ std::ostream *str = &(std::cerr);
+
+ ofstream ofile;
+
+ if (filename)
+ {
+ ofile.open (filename);
+
+ str = &ofile;
+ }
+
CppUnit::Outputter * out;
CppUnit::Test *suite =
CppUnit::TestFactoryRegistry::getRegistry().makeTest();
CppUnit::TextUi::TestRunner runner;
runner.addTest ( suite );
if (xml)
- out = new CppUnit::XmlOutputter( &runner.result(), std::cerr );
+ out = new CppUnit::XmlOutputter( &runner.result(), *str );
else if (compiler)
- out = new CppUnit::CompilerOutputter( &runner.result(), std::cerr );
+ out = new CppUnit::CompilerOutputter( &runner.result(), *str );
else
- out = new CppUnit::TextOutputter( &runner.result(), std::cerr );
+ out = new CppUnit::TextOutputter( &runner.result(), *str );
runner.setOutputter( out );
- return runner.run() ? 0 : 1;
+ int ret = runner.run() ? 0 : 1;
+
+ if (filename)
+ ofile.close ();
+
+ return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2957] Possibility to define an output file for the tests suite results.,
Giuseppe Scrivano <=