Commit 8b2910b6 authored by Christoph Grüninger's avatar Christoph Grüninger Committed by Steffen Müthing

[test] Adjust exception handling in tests.

Some exceptions were caught and did not fail the test.

(cherry picked from commit f28b81c9)
Signed-off-by: Steffen Müthing's avatarSteffen Müthing <muething@dune-project.org>
parent 6c51c8fe
......@@ -182,10 +182,15 @@ try
testAMG<1>(N, coarsenTarget, ml);
testAMG<2>(N, coarsenTarget, ml);
return 0;
}
catch (Dune::Exception &e)
catch (std::exception &e)
{
std::cerr << "Dune reported error: " << e << std::endl;
throw;
}
catch (...)
{}
{
std::cerr << "Dune reported an unknown error." << std::endl;
exit(1);
}
......@@ -125,10 +125,15 @@ try
testAMG<1>(N, coarsenTarget, ml);
testAMG<2>(N, coarsenTarget, ml);
return 0;
}
catch (Dune::Exception &e)
catch (std::exception &e)
{
std::cerr << "Dune reported error: " << e << std::endl;
throw;
}
catch (...)
{}
{
std::cerr << "Dune reported an unknown error." << std::endl;
exit(1);
}
......@@ -560,21 +560,14 @@ int main (int argc , char ** argv)
testAggregate();
exit(testEdge());
}
catch (Dune::ISTLError& error)
catch(std::exception& e)
{
std::cout << error << std::endl;
}
catch (Dune::Exception& error)
{
std::cout << error << std::endl;
}
catch (const std::bad_alloc& e)
{
std::cout << "memory exhausted" << std::endl;
throw;
}
catch (...)
{
std::cout << "unknown exception caught" << std::endl;
std::cerr << "unknown exception caught" << std::endl;
exit(1);
}
return 0;
......
......@@ -127,8 +127,8 @@ void testAMG(int N, int coarsenTarget, int ml)
int main(int argc, char** argv)
try
{
int N=100;
int coarsenTarget=1200;
int ml=10;
......@@ -145,4 +145,14 @@ int main(int argc, char** argv)
testAMG<1>(N, coarsenTarget, ml);
testAMG<2>(N, coarsenTarget, ml);
return 0;
}
catch (std::exception &e)
{
throw;
}
catch (...)
{
std::cerr << "Dune reported an unknown error." << std::endl;
exit(1);
}
......@@ -236,8 +236,8 @@ void testAMG(int N, int coarsenTarget, int ml)
int main(int argc, char** argv)
try
{
int N=100;
int coarsenTarget=1200;
int ml=10;
......@@ -255,4 +255,14 @@ int main(int argc, char** argv)
//testAMG<2>(N, coarsenTarget, ml);
return 0;
}
catch (std::exception &e)
{
throw;
}
catch (...)
{
std::cerr << "Dune reported an unknown error." << std::endl;
exit(1);
}
......@@ -82,10 +82,15 @@ try
solver1.apply(x1,b1, res);
solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x1[0]), reinterpret_cast<FIELD_TYPE*>(&b1[0]));
return 0;
}
catch (Dune::Exception &e)
catch (std::exception &e)
{
std::cerr << "Dune reported error: " << e << std::endl;
throw;
}
catch (...)
{}
{
std::cerr << "Dune reported an unknown error." << std::endl;
exit(1);
}
......@@ -72,10 +72,13 @@ int main(int argc, char** argv)
Dune::UMFPack<BCRSMat> load_solver(mat,"umfpack_decomp",0);
return 0;
}
catch(Dune::Exception &e)
catch (std::exception &e)
{
std::cerr << "Dune reported error: " << e << std::endl;
throw;
}
catch (...)
{}
{
std::cerr << "Dune reported an unknown error." << std::endl;
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