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/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
......@@ -9,9 +9,7 @@ hepnos::DataStore* datastore = nullptr;
int main(int argc, char* argv[])
{
if(argc != 2) return 1;
MPI_Init(&argc, &argv);
if(argc < 2) return 1;
sleep(1);
// Create the datastore
......@@ -25,18 +23,23 @@ int main(int argc, char* argv[])
CppUnit::TextUi::TestRunner runner;
runner.addTest( suite );
std::ofstream xmlOutFile;
if(argc >= 3) {
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 ) );
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), std::cerr));
}
// Run the tests.
bool wasSucessful = runner.run();
MPI_Barrier(MPI_COMM_WORLD);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == 0) ds.shutdown();
MPI_Finalize();
ds.shutdown();
if(argc >= 3)
xmlOutFile.close();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
......
......@@ -20,7 +20,7 @@ hepnos_test_start_servers 2 2 20 $CFG_FILE $CON_FILE
export HEPNOS_CONFIG_FILE=$CON_FILE
# 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
wait
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