| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * unit_test.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: 21.07.2010
|
|---|
| 5 | * Author: Julian Iseringhausen
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifdef HAVE_CONFIG_H
|
|---|
| 9 | #include <config.h>
|
|---|
| 10 | #endif
|
|---|
| 11 |
|
|---|
| 12 | #ifdef HAVE_MPI
|
|---|
| 13 | #include <mpi.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include <cppunit/TestResult.h>
|
|---|
| 17 | #include <cppunit/TestResultCollector.h>
|
|---|
| 18 | #include <cppunit/BriefTestProgressListener.h>
|
|---|
| 19 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
|---|
| 20 | #include <cppunit/TestRunner.h>
|
|---|
| 21 | #include <cppunit/CompilerOutputter.h>
|
|---|
| 22 |
|
|---|
| 23 | #include "comm/mpi/error_handler.hpp"
|
|---|
| 24 |
|
|---|
| 25 | int main(int argc, char *argv[])
|
|---|
| 26 | {
|
|---|
| 27 |
|
|---|
| 28 | #ifdef HAVE_MPI
|
|---|
| 29 | MPI_Errhandler mpiErrorHandler;
|
|---|
| 30 |
|
|---|
| 31 | MPI_Init(&argc, &argv);
|
|---|
| 32 |
|
|---|
| 33 | MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler);
|
|---|
| 34 | MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler);
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | CppUnit::TestResult testresult;
|
|---|
| 38 |
|
|---|
| 39 | CppUnit::TestResultCollector collectedresults;
|
|---|
| 40 | testresult.addListener(&collectedresults);
|
|---|
| 41 |
|
|---|
| 42 | CppUnit::BriefTestProgressListener progress;
|
|---|
| 43 | testresult.addListener(&progress);
|
|---|
| 44 |
|
|---|
| 45 | CppUnit::TestRunner testrunner;
|
|---|
| 46 | testrunner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
|
|---|
| 47 | testrunner.run(testresult);
|
|---|
| 48 |
|
|---|
| 49 | CppUnit::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
|
|---|
| 50 | compileroutputter.write();
|
|---|
| 51 |
|
|---|
| 52 | #ifdef HAVE_MPI
|
|---|
| 53 | MPI_Errhandler_free(&mpiErrorHandler);
|
|---|
| 54 |
|
|---|
| 55 | MPI_Finalize();
|
|---|
| 56 | #endif
|
|---|
| 57 |
|
|---|
| 58 | return (collectedresults.wasSuccessful() ? 0 : 1);
|
|---|
| 59 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.