diff options
author | Jose <jose@zeroc.com> | 2016-03-29 16:51:52 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-03-29 16:51:52 +0200 |
commit | a5dae64a7b0b06c56c4b9d2ce14603d37a56afb8 (patch) | |
tree | 7bb917c3db6cd459054d075425d0ec56db673358 | |
parent | Python VS2015 x64 build fixes (diff) | |
download | ice-a5dae64a7b0b06c56c4b9d2ce14603d37a56afb8.tar.bz2 ice-a5dae64a7b0b06c56c4b9d2ce14603d37a56afb8.tar.xz ice-a5dae64a7b0b06c56c4b9d2ce14603d37a56afb8.zip |
Windows stacktrace test fixes
-rw-r--r-- | cpp/test/IceUtil/stacktrace/Client.cpp | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/cpp/test/IceUtil/stacktrace/Client.cpp b/cpp/test/IceUtil/stacktrace/Client.cpp index b58a1dda895..b6edb172a0e 100644 --- a/cpp/test/IceUtil/stacktrace/Client.cpp +++ b/cpp/test/IceUtil/stacktrace/Client.cpp @@ -220,42 +220,66 @@ int main(int argc, char* argv[]) filename += ".Linux"; #endif - ifstream ifs(filename.c_str()); - stringstream sstr; - sstr << ifs.rdbuf(); + while(true) + { + ifstream ifs(filename.c_str()); + stringstream sstr; + sstr << ifs.rdbuf(); #if defined(__APPLE__) - string expected = sstr.str(); - standardizeVersion(expected); + string expected = sstr.str(); + standardizeVersion(expected); #else - vector<string> expected = splitLines(sstr.str()); + vector<string> expected = splitLines(sstr.str()); #endif - ThrowerPtr thrower = new Thrower(); - try - { - thrower->first(); - } - catch(const IceUtil::Exception& ex) - { - string stack = ex.ice_stackTrace(); -#ifdef __APPLE__ - standardizeVersion(stack); - if(expected.size() < stack.size()) + ThrowerPtr thrower = new Thrower(); + try { - test(stack.compare(0, expected.size(), expected) == 0); + thrower->first(); } - else + catch(const IceUtil::Exception& ex) { - test(stack == expected); - } + string stack = ex.ice_stackTrace(); +#ifdef __APPLE__ + standardizeVersion(stack); + if(expected.size() < stack.size()) + { + test(stack.compare(0, expected.size(), expected) == 0); + } + else + { + test(stack == expected); + } + break; #else - vector<string> actual = splitLines(stack); - test(expected.size() <= actual.size()); - for(size_t i = 0; i < expected.size(); ++i) - { - test(actual[i].find(expected[i]) != string::npos); - } + vector<string> actual = splitLines(stack); + test(expected.size() <= actual.size()); + for(size_t i = 0; i < expected.size(); ++i) + { + if(actual[i].find(expected[i]) != string::npos) + { +#if defined(_WIN32) && defined(NDEBUG) + // + // With windows optimized builds retry with the alternate + // expect file. + // + if(filename != "StackTrace.release.Win32") + { + filename = "StackTrace.release.Win32"; + continue; + } + else + { + test(false); + } +#else + test(false) +#endif + } + } + break; #endif + } } cout << "ok" << endl; #else |