Commit 3acdb5ef authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

tests are not producing individual XML files

parent 47cf0e23
#include <mpi.h> #include <fstream>
#include <cppunit/CompilerOutputter.h> #include <cppunit/CompilerOutputter.h>
#include <cppunit/XmlOutputter.h> #include <cppunit/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
...@@ -9,9 +9,7 @@ hepnos::DataStore* datastore = nullptr; ...@@ -9,9 +9,7 @@ hepnos::DataStore* datastore = nullptr;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if(argc != 2) return 1; if(argc < 2) return 1;
MPI_Init(&argc, &argv);
sleep(1); sleep(1);
// Create the datastore // Create the datastore
...@@ -25,18 +23,23 @@ int main(int argc, char* argv[]) ...@@ -25,18 +23,23 @@ int main(int argc, char* argv[])
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.addTest( suite ); runner.addTest( suite );
// Change the default outputter to a compiler error format outputter std::ofstream xmlOutFile;
runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(), if(argc >= 3) {
std::cerr ) ); const char* xmlOutFileName = argv[2];
xmlOutFile.open(xmlOutFileName);
// Change the default outputter to a compiler error format outputter
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), xmlOutFile));
} else {
// Change the default outputter to a compiler error format outputter
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), std::cerr));
}
// Run the tests. // Run the tests.
bool wasSucessful = runner.run(); bool wasSucessful = runner.run();
MPI_Barrier(MPI_COMM_WORLD); ds.shutdown();
int rank; if(argc >= 3)
MPI_Comm_rank(MPI_COMM_WORLD, &rank); xmlOutFile.close();
if(rank == 0) ds.shutdown();
MPI_Finalize();
// Return error code 1 if the one of test failed. // Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1; return wasSucessful ? 0 : 1;
......
...@@ -20,7 +20,7 @@ hepnos_test_start_servers 2 2 20 $CFG_FILE $CON_FILE ...@@ -20,7 +20,7 @@ hepnos_test_start_servers 2 2 20 $CFG_FILE $CON_FILE
export HEPNOS_CONFIG_FILE=$CON_FILE export HEPNOS_CONFIG_FILE=$CON_FILE
# run a connect test client # run a connect test client
run_to ${timeout_sec} $1 $CON_FILE run_to ${timeout_sec} $1 $CON_FILE $1.xml
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
wait wait
exit 1 exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment