mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Output random generator seed in case of failure so that we have it in CDash.
This commit is contained in:
parent
698de91c8a
commit
41aa0fcc3b
12
test/main.h
12
test/main.h
@ -14,6 +14,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -173,8 +174,12 @@ static void verify_impl(bool condition, const char *testname, const char *file,
|
|||||||
{
|
{
|
||||||
if (!condition)
|
if (!condition)
|
||||||
{
|
{
|
||||||
std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" \
|
std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")"
|
||||||
<< std::endl << " " << condition_as_string << std::endl << std::endl; \
|
<< 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();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,6 +467,9 @@ int main(int argc, char *argv[])
|
|||||||
if(!g_has_set_repeat) g_repeat = DEFAULT_REPEAT;
|
if(!g_has_set_repeat) g_repeat = DEFAULT_REPEAT;
|
||||||
|
|
||||||
std::cout << "Initializing random number generator with seed " << g_seed << std::endl;
|
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);
|
srand(g_seed);
|
||||||
std::cout << "Repeating each test " << g_repeat << " times" << std::endl;
|
std::cout << "Repeating each test " << g_repeat << " times" << std::endl;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user