Skip to content
Snippets Groups Projects
Commit 5c9d332c authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Improve Catch2 unit tests running

Now use separate steps to parse command line options and to run tests
This allows to output correctly help messages.
``
./unit_tests -h
``
now produces the expected output
parent 31a6ee59
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,14 @@ main(int argc, char* argv[]) ...@@ -15,8 +15,14 @@ main(int argc, char* argv[])
if (parallel::rank() != 0) { if (parallel::rank() != 0) {
setenv("GCOV_PREFIX", "/dev/null", 1); setenv("GCOV_PREFIX", "/dev/null", 1);
} }
Catch::Session session;
int result = session.applyCommandLine(argc, argv);
int result = Catch::Session().run(argc, argv); if (result == 0) {
// Disable outputs from tested classes to the standard output
std::cout.setstate(std::ios::badbit);
result = session.run();
}
Kokkos::finalize(); Kokkos::finalize();
parallel::Messenger::destroy(); parallel::Messenger::destroy();
......
...@@ -8,10 +8,14 @@ main(int argc, char* argv[]) ...@@ -8,10 +8,14 @@ main(int argc, char* argv[])
{ {
Kokkos::initialize({4, -1, -1, true}); Kokkos::initialize({4, -1, -1, true});
Catch::Session session;
int result = session.applyCommandLine(argc, argv);
if (result == 0) {
// Disable outputs from tested classes to the standard output // Disable outputs from tested classes to the standard output
std::cout.setstate(std::ios::badbit); std::cout.setstate(std::ios::badbit);
result = session.run();
int result = Catch::Session().run(argc, argv); }
Kokkos::finalize(); Kokkos::finalize();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment