summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2021-06-08 17:08:06 +0200
committerJose <jose@zeroc.com>2021-06-08 17:12:59 +0200
commit0297f4db546a1d1920841cbac77d4ddf95895dde (patch)
tree299b6a78c94fc307f01999c0a20c071d6b65c83b /cpp/test
parentmacOS IceUtil/stacktrace test fixes (diff)
downloadice-0297f4db546a1d1920841cbac77d4ddf95895dde.tar.bz2
ice-0297f4db546a1d1920841cbac77d4ddf95895dde.tar.xz
ice-0297f4db546a1d1920841cbac77d4ddf95895dde.zip
Simplify IceUtil/stacktrace test
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/IceUtil/stacktrace/Client.cpp147
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux12
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+11
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+48pie11
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.Win3210
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.Win6410
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.macOS12
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win324
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win644
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win325
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win644
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win323
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win645
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win327
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win648
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-arm64.macOS8
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-x86_64.macOS10
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release.Linux3
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release.Win324
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.release.Win645
20 files changed, 6 insertions, 277 deletions
diff --git a/cpp/test/IceUtil/stacktrace/Client.cpp b/cpp/test/IceUtil/stacktrace/Client.cpp
index d63428e7cc9..9a1dcca1709 100644
--- a/cpp/test/IceUtil/stacktrace/Client.cpp
+++ b/cpp/test/IceUtil/stacktrace/Client.cpp
@@ -69,21 +69,6 @@ splitLines(const string& str)
string line;
while(std::getline(is, line))
{
-#ifdef __APPLE__
- //
- // Remove patch number from stack trace
- //
- string v1 = ICE_STRING_VERSION;
- size_t pos = line.find(v1);
- if(pos != string::npos)
- {
- vector<string> split;
- IceUtilInternal::splitString(v1, ".", split);
- string v2(split[0] + split[1]);
- line.replace(pos, v1.length(), v2);
- }
-#endif
-
result.push_back(line);
}
return result;
@@ -107,137 +92,17 @@ Client::run(int, char*[])
return;
}
- bool optimized = false;
-#ifdef NDEBUG
- optimized = true;
-#endif
-
cout << "checking stacktrace... ";
- IceUtilInternal::printStackTraces = true;
-
- string filename = "StackTrace.";
-
- if(optimized)
- {
- filename += "release";
-#if defined(_MSC_VER)
-# if(_MSC_VER == 1700)
- filename += "-vc110";
-# elif(_MSC_VER == 1800)
- filename += "-vc120";
-# elif(_MSC_VER == 1900)
- filename += "-vc140";
-# elif(_MSC_VER >= 1910)
- filename += "-vc141";
-# endif
-#elif defined(__APPLE__)
-# if defined(__aarch64__)
- filename += "-xcode-arm64";
- #else
- filename += "-xcode-x86_64";
- #endif
-#endif
- }
- else
- {
- filename += "debug";
- }
-
-#if defined(_WIN64)
- filename += ".Win64";
-#elif defined(_WIN32)
- filename += ".Win32";
-#elif defined(__APPLE__)
- filename += ".macOS";
-#else
- filename += ".Linux";
-
- if(!optimized && IceUtilInternal::stackTraceImpl() == IceUtilInternal::STLibbacktracePlus)
+ ThrowerPtr thrower = new Thrower();
+ try
{
- // Libbacktrace with GCC 4.8 and pie return a smaller backtrace
-# if defined(__pie__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ == 408)
- filename += ".libbacktrace+48pie";
-# else
- filename += ".libbacktrace+";
-# endif
+ thrower->first();
+ test(false);
}
-
-#endif
-
- while(true)
+ catch(const IceUtil::Exception& ex)
{
- bool match = true;
- ifstream ifs(filename.c_str());
-
- if(!ifs)
- {
- ostringstream os;
- os << "cannot open `" << filename << "`, failed!";
- cout << os.str() << endl;
- throw invalid_argument(os.str());
- }
-
- // Show which template we use:
- cout << filename << "... ";
-
- stringstream sstr;
- sstr << ifs.rdbuf();
- vector<string> expected = splitLines(sstr.str());
-
- ThrowerPtr thrower = new Thrower();
- try
- {
- thrower->first();
- }
- catch(const IceUtil::Exception& ex)
- {
- string stack = ex.ice_stackTrace();
-
- vector<string> actual = splitLines(stack);
- for(size_t i = 0; i < expected.size(); ++i)
- {
- if(actual[i].find(expected[i]) == string::npos)
- {
- match = false;
- //
- // With windows and Linux optimized builds retry with the alternate
- // files.
- //
- if(filename.find("StackTrace.release-vc") == 0 || filename == "StackTrace.release.Linux")
- {
- break;
- }
-
- cerr << "could not find `" << expected[i] << "` in " << actual[i] << endl;
- cerr << "Full stack is:\n" << stack << endl;
- test(false);
- }
- }
-
- if(!match)
- {
- if(filename.find("StackTrace.release-vc") == 0)
- {
- // Retry with alternate stack
- filename = "StackTrace.release";
-#if defined(_WIN64)
- filename += ".Win64";
-#elif defined(_WIN32)
- filename += ".Win32";
-#endif
- continue;
- }
- else if(filename == "StackTrace.release.Linux")
- {
- // Retry with the debug Linux stack
- filename = "StackTrace.debug.Linux";
- continue;
- }
- }
- test(actual.size() >= expected.size());
- break;
- }
+ test(splitLines(ex.ice_stackTrace()).size() >= 3);
}
cout << "ok" << endl;
}
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux
deleted file mode 100644
index 5f9aa85960f..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux
+++ /dev/null
@@ -1,12 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int) in
- 1
- 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in
-client
-client
-client
-client
-client
-client
-client
-client
- 11 __libc_start_main in
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+
deleted file mode 100644
index cdc6528b017..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+
+++ /dev/null
@@ -1,11 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int) at
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) at
- 2 IceUtil::NullHandleException::NullHandleException(char const*, int) at
- 3 fifth at
- 4 forth at
- 5 third at
- 6 second at
- 7 first at
- 8 Client::run(int, char**) at
- 9 int Test::runTest<Client>(int, char**) at
- 10 main at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+48pie b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+48pie
deleted file mode 100644
index d4644adbfbf..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+48pie
+++ /dev/null
@@ -1,11 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int) at src/IceUtil/UtilException.cpp:
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) at include/IceUtil/Exception.h:
- 2 IceUtil::NullHandleException::NullHandleException(char const*, int) at src/IceUtil/UtilException.cpp:
-client
-client
-client
-client
-client
-client
- 9 __libc_start_main in
-client
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32
deleted file mode 100644
index 697f9860a23..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32
+++ /dev/null
@@ -1,10 +0,0 @@
- 0 IceUtil::Exception::Exception at
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper<IceUtil::NullHandleException> at
- 2 IceUtil::NullHandleException::NullHandleException at
- 3 `anonymous namespace'::Thrower::fifth at
- 4 `anonymous namespace'::Thrower::forth at
- 5 `anonymous namespace'::Thrower::third at
- 6 `anonymous namespace'::Thrower::second at
- 7 `anonymous namespace'::Thrower::first at
- 8 Client::run at
- 9 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win64
deleted file mode 100644
index 697f9860a23..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win64
+++ /dev/null
@@ -1,10 +0,0 @@
- 0 IceUtil::Exception::Exception at
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper<IceUtil::NullHandleException> at
- 2 IceUtil::NullHandleException::NullHandleException at
- 3 `anonymous namespace'::Thrower::fifth at
- 4 `anonymous namespace'::Thrower::forth at
- 5 `anonymous namespace'::Thrower::third at
- 6 `anonymous namespace'::Thrower::second at
- 7 `anonymous namespace'::Thrower::first at
- 8 Client::run at
- 9 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.macOS b/cpp/test/IceUtil/stacktrace/StackTrace.debug.macOS
deleted file mode 100644
index cb5147bc03e..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.macOS
+++ /dev/null
@@ -1,12 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int) in libIce.3.7.6.dylib
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) in libIce.3.7.6.dylib
- 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7.6.dylib
- 3 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7.6.dylib
- 4 (anonymous namespace)::Thrower::fifth() in client
- 5 (anonymous namespace)::Thrower::forth() in client
- 6 (anonymous namespace)::Thrower::third() in client
- 7 (anonymous namespace)::Thrower::second() in client
- 8 (anonymous namespace)::Thrower::first() in client
- 9 Client::run(int, char**) in client
- 10 int Test::runTest<Client>(int, char**) in client
- 11 main in client
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win32
deleted file mode 100644
index 823da2cd4fc..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win32
+++ /dev/null
@@ -1,4 +0,0 @@
- 0 IceUtil::Exception::Exception
- 1 IceUtil::NullHandleException::NullHandleException
- 2 `anonymous namespace'::Thrower::fifth
- 3 main
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win64
deleted file mode 100644
index 823da2cd4fc..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc110.Win64
+++ /dev/null
@@ -1,4 +0,0 @@
- 0 IceUtil::Exception::Exception
- 1 IceUtil::NullHandleException::NullHandleException
- 2 `anonymous namespace'::Thrower::fifth
- 3 main
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32
deleted file mode 100644
index 19ab443db12..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32
+++ /dev/null
@@ -1,5 +0,0 @@
- 0 IceUtil::Exception::Exception
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper
- 2 IceUtil::NullHandleException::NullHandleException
- 3 `anonymous namespace'::Thrower::fifth
- 4 main
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win64
deleted file mode 100644
index 2f3132a5134..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win64
+++ /dev/null
@@ -1,4 +0,0 @@
- 0 IceUtil::Exception::Exception at
- 1 IceUtil::NullHandleException::NullHandleException at
- 2 `anonymous namespace'::Thrower::fifth at
- 3 main at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win32
deleted file mode 100644
index 2a6b2950a4d..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win32
+++ /dev/null
@@ -1,3 +0,0 @@
- 0 IceUtil::NullHandleException::NullHandleException at
- 1 Client::run at
- 2 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win64
deleted file mode 100644
index 2f928eafe74..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc140.Win64
+++ /dev/null
@@ -1,5 +0,0 @@
- 0 IceUtil::Exception::Exception at
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper<IceUtil::NullHandleException> at
- 2 IceUtil::NullHandleException::NullHandleException at
- 3 Client::run at
- 4 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win32
deleted file mode 100644
index 2ddbaad2677..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win32
+++ /dev/null
@@ -1,7 +0,0 @@
- 0 IceUtil::NullHandleException::NullHandleException at
- 1 `anonymous namespace'::Thrower::fifth at
- 2 `anonymous namespace'::Thrower::forth at
- 3 `anonymous namespace'::Thrower::third at
- 4 `anonymous namespace'::Thrower::second at
- 5 `anonymous namespace'::Thrower::first at
- 6 main at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win64
deleted file mode 100644
index 70522443bb1..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc141.Win64
+++ /dev/null
@@ -1,8 +0,0 @@
- 0 IceUtil::NullHandleException::NullHandleException at
- 1 `anonymous namespace'::Thrower::fifth at
- 2 `anonymous namespace'::Thrower::forth at
- 3 `anonymous namespace'::Thrower::third at
- 4 `anonymous namespace'::Thrower::second at
- 5 `anonymous namespace'::Thrower::first at
- 6 Client::run at
- 7 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-arm64.macOS b/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-arm64.macOS
deleted file mode 100644
index b8f04f36715..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-arm64.macOS
+++ /dev/null
@@ -1,8 +0,0 @@
- 0 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.37.dylib
- 1 (anonymous namespace)::Thrower::fifth() in client
- 2 (anonymous namespace)::Thrower::fifth() in client
- 3 (anonymous namespace)::Thrower::forth() in client
- 4 (anonymous namespace)::Thrower::third() in client
- 5 Client::run(int, char**) in client
- 6 int Test::runTest<Client>(int, char**) in client
- 7 start in libdyld.dylib
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-x86_64.macOS b/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-x86_64.macOS
deleted file mode 100644
index c693614e98e..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release-xcode-x86_64.macOS
+++ /dev/null
@@ -1,10 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int) in libIce.37.dylib
- 1 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.37.dylib
- 2 (anonymous namespace)::Thrower::fifth() in client
- 3 (anonymous namespace)::Thrower::forth() in client
- 4 (anonymous namespace)::Thrower::third() in client
- 5 (anonymous namespace)::Thrower::second() in client
- 6 Client::run(int, char**) in client
- 7 int Test::runTest<Client>(int, char**) in client
- 8 start in libdyld.dylib
- 9 0x0 in ???
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux b/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux
deleted file mode 100644
index a2fde31ab7a..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux
+++ /dev/null
@@ -1,3 +0,0 @@
- 0 IceUtil::Exception::Exception(char const*, int)
- 1 IceUtil::NullHandleException::NullHandleException(char const*, int)
-client
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release.Win32
deleted file mode 100644
index b4e2f1bb997..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release.Win32
+++ /dev/null
@@ -1,4 +0,0 @@
- 0 IceUtil::NullHandleException::NullHandleException at
- 1 `anonymous namespace'::Thrower::fifth at
- 2 Client::run at
- 3 Test::runTest<Client> at
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release.Win64 b/cpp/test/IceUtil/stacktrace/StackTrace.release.Win64
deleted file mode 100644
index fdc73ea277e..00000000000
--- a/cpp/test/IceUtil/stacktrace/StackTrace.release.Win64
+++ /dev/null
@@ -1,5 +0,0 @@
- 0 IceUtil::Exception::Exception at
- 1 IceUtil::NullHandleException::NullHandleException at
- 2 `anonymous namespace'::Thrower::fifth at
- 3 Client::run at
- 4 Test::runTest<Client> at