diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-02-25 01:46:59 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-02-25 01:46:59 +0100 |
commit | 41aa0fcc3b9e18b4768b44fbcc3d8e4dd8263697 (patch) | |
tree | 33ebb6ce0b86a98f0f4b8e3fd762b82a7def4ac2 /test/main.h | |
parent | 698de91c8ad7c15826466f2f81e2bc471b905103 (diff) |
Output random generator seed in case of failure so that we have it in CDash.
Diffstat (limited to 'test/main.h')
-rw-r--r-- | test/main.h | 12 |
1 files changed, 10 insertions, 2 deletions
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 <iostream> #include <fstream> #include <string> +#include <sstream> #include <vector> #include <typeinfo> #include <limits> @@ -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; |