From 41aa0fcc3b9e18b4768b44fbcc3d8e4dd8263697 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 25 Feb 2013 01:46:59 +0100 Subject: Output random generator seed in case of failure so that we have it in CDash. --- test/main.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/main.h') diff --git a/test/main.h b/test/main.h index 2da327c17..61c3ba7cc 100644 --- a/test/main.h +++ b/test/main.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -173,8 +174,12 @@ static void verify_impl(bool condition, const char *testname, const char *file, { if (!condition) { - std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" \ - << std::endl << " " << condition_as_string << std::endl << std::endl; \ + std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" + << std::endl << " " << condition_as_string << std::endl; + std::cerr << "Stack:\n"; + for(int i=Eigen::g_test_stack.size()-1; i>=0; --i) + std::cerr << " - " << Eigen::g_test_stack[i] << "\n"; + std::cerr << "\n"; abort(); } } @@ -462,6 +467,9 @@ int main(int argc, char *argv[]) if(!g_has_set_repeat) g_repeat = DEFAULT_REPEAT; std::cout << "Initializing random number generator with seed " << g_seed << std::endl; + std::stringstream ss; + ss << "Seed: " << g_seed; + g_test_stack.push_back(ss.str()); srand(g_seed); std::cout << "Repeating each test " << g_repeat << " times" << std::endl; -- cgit v1.2.3