From: Aleš Křenek Date: Wed, 2 Feb 2005 17:23:01 +0000 (+0000) Subject: il_test dumps the right xml output X-Git-Tag: gridsite-core_R_1_1_5~63 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=cd0ccc3897dd8f7b190425512c841fd9f6e76a1e;p=jra1mw.git il_test dumps the right xml output --- diff --git a/org.glite.lb.common/Makefile b/org.glite.lb.common/Makefile index d24a031..1b14264 100644 --- a/org.glite.lb.common/Makefile +++ b/org.glite.lb.common/Makefile @@ -97,6 +97,8 @@ THRSTATICLIB:=libglite_lb_common_${thrflavour}.a LTLIB:=libglite_lb_common_${nothrflavour}.la THRLTLIB:=libglite_lb_common_${thrflavour}.la +REPORTS:=${top_srcdir}/reports + default: all all compile: check_version ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB} @@ -125,7 +127,10 @@ ${THRLTLIB}: ${THROBJS} stage: compile $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes -check: compile check.parse check.gss check.il +check: compile mkreports check.parse check.gss check.il + +mkreports: + -mkdir ${REPORTS} check.parse: test_parse echo "XXX: nyk -> fixed build interrupt :)" @@ -140,7 +145,7 @@ check.gss: test_gss echo test_gss not run automatically util we have got some credentials check.il: il_test - ./il_test + ./il_test ${REPORTS}/il.xml test_gss: test_gss.o ${LINKXX} -o $@ test_gss.o ${LTLIB} ${TEST_LIBS} ${EXT_LIBS} diff --git a/org.glite.lb.common/test/il_test.cpp b/org.glite.lb.common/test/il_test.cpp index 794c0a0..37ccd79 100644 --- a/org.glite.lb.common/test/il_test.cpp +++ b/org.glite.lb.common/test/il_test.cpp @@ -1,15 +1,46 @@ +#include +#include + +#include + #include #include -#include +// #include +#include +#include +#include +#include int main(int argc, char *argv[]) { CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); + +#if 0 CppUnit::TextTestRunner runner; runner.addTest(suite); runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cerr)); return runner.run() ? 0 : 1; +#endif + + assert(argc == 2); + + std::ofstream xml(argv[1]); + + CppUnit::TestResult controller; + CppUnit::TestResultCollector result; + controller.addListener( &result ); + + CppUnit::TestRunner runner; + runner.addTest(suite); + runner.run(controller); + + CppUnit::XmlOutputter xout( &result, xml ); + CppUnit::CompilerOutputter tout( &result, std::cout); + xout.write(); + tout.write(); + + return result.wasSuccessful() ? 0 : 1 ; }