From f3ce5e7a7082e430c8ac1193b5c8c4335d1cd4a2 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Wed, 11 Feb 2009 16:17:04 +0100 Subject: added test for reporting stuff --- lib/MiddleWare/test.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/MiddleWare/test.cpp') diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp index 8424aa9..016dd9d 100644 --- a/lib/MiddleWare/test.cpp +++ b/lib/MiddleWare/test.cpp @@ -45,13 +45,15 @@ int main(int argc, char** argv) dd.SaveBinary(FILENAME_BINARYDATA1, "ass0-9as", sizeof("ass0-9as")); CMiddleWare::crash_info_t info; - middleWare.SaveDebugDump(std::string(DEBUG_DUMPS_DIR)+"/"+pid, info); - - std::cout << "Application Crashed! " << - info.m_sPackage << ": " << - info.m_sExecutable << "(" << - info.m_sCount << ")" << std::endl; + if (middleWare.SaveDebugDump(std::string(DEBUG_DUMPS_DIR)+"/"+pid, info)) + { + std::cout << "Application Crashed! " << + "(" << info.m_sTime << " [" << info.m_sCount << "]) " << + info.m_sPackage << ": " << + info.m_sExecutable << std::endl; + middleWare.Report(info.m_sUUID, info.m_sUID); + } } catch (std::string sError) { -- cgit From 66bdd03d7892cd95e7806b8c375e88d279dd4034 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 12 Feb 2009 10:00:21 +0100 Subject: more complex testcase --- lib/MiddleWare/test.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/MiddleWare/test.cpp') diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp index 016dd9d..1868284 100644 --- a/lib/MiddleWare/test.cpp +++ b/lib/MiddleWare/test.cpp @@ -35,15 +35,15 @@ int main(int argc, char** argv) CMiddleWare middleWare(PLUGINS_CONF_DIR, PLUGINS_LIB_DIR, std::string(CONF_DIR) + "/CrashCatcher.conf"); + /* Create DebugDump */ CDebugDump dd; - char pid[100]; sprintf(pid, "%d", getpid()); - dd.Create(std::string(DEBUG_DUMPS_DIR)+"/"+pid, pid); dd.SaveText(FILENAME_LANGUAGE, "CCpp"); dd.SaveBinary(FILENAME_BINARYDATA1, "ass0-9as", sizeof("ass0-9as")); + /* Try to save it into DB */ CMiddleWare::crash_info_t info; if (middleWare.SaveDebugDump(std::string(DEBUG_DUMPS_DIR)+"/"+pid, info)) { @@ -52,7 +52,18 @@ int main(int argc, char** argv) info.m_sPackage << ": " << info.m_sExecutable << std::endl; - middleWare.Report(info.m_sUUID, info.m_sUID); + /* Get Report, so user can change data (remove private stuff) + * + * If we want to send report immediately after DebugDump was created, + * we can use: + * middleWare.CreateReport(debugDumpDir, crashReport); + * and after that it can be easily reported by: + * middleWare.Report(crashReport); + */ + CMiddleWare::crash_report_t crashReport; + middleWare.CreateReport(info.m_sUUID, info.m_sUID, crashReport); + /* Report crash */ + middleWare.Report(crashReport); } } catch (std::string sError) -- cgit From fa69a86d9ffffd444ee8f64bfc794ea97e1a1453 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 12 Feb 2009 10:05:38 +0100 Subject: a creation of reports directly from DebugDumpDir is moved to private section because of security reasons --- lib/MiddleWare/test.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/MiddleWare/test.cpp') diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp index 1868284..77b671a 100644 --- a/lib/MiddleWare/test.cpp +++ b/lib/MiddleWare/test.cpp @@ -53,12 +53,7 @@ int main(int argc, char** argv) info.m_sExecutable << std::endl; /* Get Report, so user can change data (remove private stuff) - * - * If we want to send report immediately after DebugDump was created, - * we can use: - * middleWare.CreateReport(debugDumpDir, crashReport); - * and after that it can be easily reported by: - * middleWare.Report(crashReport); + * If we do not want user interaction, just send data immediately */ CMiddleWare::crash_report_t crashReport; middleWare.CreateReport(info.m_sUUID, info.m_sUID, crashReport); -- cgit From 6259030484be3e11c1d8accf943fd5411cb0d7bb Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 12 Feb 2009 11:50:16 +0100 Subject: updated test --- lib/MiddleWare/test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/MiddleWare/test.cpp') diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp index 77b671a..57c5506 100644 --- a/lib/MiddleWare/test.cpp +++ b/lib/MiddleWare/test.cpp @@ -39,7 +39,9 @@ int main(int argc, char** argv) CDebugDump dd; char pid[100]; sprintf(pid, "%d", getpid()); - dd.Create(std::string(DEBUG_DUMPS_DIR)+"/"+pid, pid); + dd.Create(std::string(DEBUG_DUMPS_DIR)+"/"+pid); + dd.SaveProc(pid); + dd.SavePackage(); dd.SaveText(FILENAME_LANGUAGE, "CCpp"); dd.SaveBinary(FILENAME_BINARYDATA1, "ass0-9as", sizeof("ass0-9as")); -- cgit