From: Marcin Niesluchowski Date: Thu, 16 Oct 2014 12:24:55 +0000 (+0200) Subject: Add --no-verbose option to XML collector X-Git-Tag: security-manager_5.5_testing~122^2~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Ftest%2Fsecurity-tests.git;a=commitdiff_plain;h=ea0e925c229af1a21bac2c8bbf7578fe2cbd8499 Add --no-verbose option to XML collector With --no-verbose param fail/ignore reason is not displayed Change-Id: I62c78186c4b560f409f66ad74be3a3f4005fda42 --- diff --git a/src/framework/include/dpl/test/test_results_collector_xml.h b/src/framework/include/dpl/test/test_results_collector_xml.h index 01b9802..16bfa5a 100644 --- a/src/framework/include/dpl/test/test_results_collector_xml.h +++ b/src/framework/include/dpl/test/test_results_collector_xml.h @@ -65,12 +65,8 @@ private: const std::string& value); std::string UIntToString(const unsigned int value); void GroupFinish(const std::size_t groupPosition); - void PrintfErrorMessage(const char* type, - const std::string& message, - bool verbosity); - void PrintfIgnoredMessage(const char* type, - const std::string& message, - bool verbosity); + void PrintfErrorMessage(const char* type, const std::string& message); + void PrintfIgnoredMessage(const char* type, const std::string& message); void FlushOutput(); std::string EscapeSpecialCharacters(std::string s); @@ -79,6 +75,7 @@ private: Statistic m_stats; std::string m_outputBuffer; std::string m_resultBuffer; + bool m_verbosity; }; } // namespace Test diff --git a/src/framework/src/test_results_collector_xml.cpp b/src/framework/src/test_results_collector_xml.cpp index ed4a6e5..65f751e 100644 --- a/src/framework/src/test_results_collector_xml.cpp +++ b/src/framework/src/test_results_collector_xml.cpp @@ -42,7 +42,7 @@ const char *DEFAULT_XML_FILE_NAME = "results.xml"; } XmlCollector::XmlCollector() - : m_filename(DEFAULT_XML_FILE_NAME) + : m_filename(DEFAULT_XML_FILE_NAME), m_verbosity(true) { } @@ -99,7 +99,7 @@ bool XmlCollector::Configure() std::string XmlCollector::CollectorSpecificHelp() const { - return CollectorFileHelp(DEFAULT_XML_FILE_NAME); + return CollectorFileHelp(DEFAULT_XML_FILE_NAME) + COLLECTOR_NO_VERBOSE_HELP; } void XmlCollector::Start() @@ -121,7 +121,7 @@ void XmlCollector::Finish() bool XmlCollector::ParseCollectorSpecificArg(const std::string& arg) { - return ParseCollectorFileArg(arg, m_filename); + return ParseCollectorFileArg(arg, m_filename) || ParseCollectorNoVerboseArg(arg, m_verbosity); } void XmlCollector::CollectResult(const std::string& id, @@ -162,13 +162,12 @@ void XmlCollector::CollectResult(const std::string& id, break; case FailStatus::FAILED: m_resultBuffer.append(" status=\"FAILED\">\n"); - PrintfErrorMessage("FAILED", EscapeSpecialCharacters(reason), true); + PrintfErrorMessage("FAILED", EscapeSpecialCharacters(reason)); m_resultBuffer.append("\t\t\n"); break; case FailStatus::IGNORED: m_resultBuffer.append(" status=\"Ignored\">\n"); - PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters( - reason), true); + PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters(reason)); m_resultBuffer.append("\t\t\n"); break; default: @@ -299,38 +298,26 @@ void XmlCollector::FlushOutput() } } -void XmlCollector::PrintfErrorMessage(const char* type, - const std::string& message, - bool verbosity) +void XmlCollector::PrintfErrorMessage(const char* type, const std::string& message) { - if (verbosity) { - m_resultBuffer.append("\t\t\t\n"); - } else { - m_resultBuffer.append("\t\t\t\n"); } + m_resultBuffer.append("\"/>\n"); } -void XmlCollector::PrintfIgnoredMessage(const char* type, - const std::string& message, - bool verbosity) +void XmlCollector::PrintfIgnoredMessage(const char* type, const std::string& message) { - if (verbosity) { - m_resultBuffer.append("\t\t\t\n"); - } else { - m_resultBuffer.append("\t\t\t\n"); } + m_resultBuffer.append("\"/>\n"); } std::string XmlCollector::EscapeSpecialCharacters(std::string s)