From e4373c9cf33609d13114d4e6e33bc231bad01a68 Mon Sep 17 00:00:00 2001 From: Marcin Niesluchowski Date: Mon, 13 Oct 2014 16:21:47 +0200 Subject: [PATCH] Remove INTERNAL type from FailStatus enum INTERNAL fail status is treated as FAILED fail status. It is collected in case of: * DPL::Exception - should not be thrown by test cased body, as it is used in test framework only * std::exception - which implies that test case is not constructed well or there is not enough resources, which may be also passed as Failed state in RUNNER_* macros. * other exceptions - same as std::exception Change-Id: I8776622afcb9d01739f8780183ad4c5f364deb25 --- tests/common/summary_collector.cpp | 4 +-- tests/framework/include/dpl/test/statistic.h | 1 - .../include/dpl/test/test_results_collector.h | 5 ++-- .../src/test_results_collector_console.cpp | 3 -- .../framework/src/test_results_collector_html.cpp | 3 -- tests/framework/src/test_results_collector_xml.cpp | 6 ---- tests/framework/src/test_runner.cpp | 15 ++-------- tests/framework/src/test_runner_multiprocess.cpp | 32 ++-------------------- 8 files changed, 9 insertions(+), 60 deletions(-) diff --git a/tests/common/summary_collector.cpp b/tests/common/summary_collector.cpp index 229b073..5a96530 100644 --- a/tests/common/summary_collector.cpp +++ b/tests/common/summary_collector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,6 @@ void SummaryCollector::CollectResult(const std::string& /*id*/, (void)performanceMaxTime; switch (status) { case FailStatus::IGNORED: ++m_ignored; break; - case FailStatus::INTERNAL: // internal error count as fail case FailStatus::FAILED: ++m_failed; break; case FailStatus::NONE: ++m_succeeded; break; }; @@ -83,7 +82,6 @@ void SummaryCollector::CollectResult(const std::string& /*id*/, { switch (status) { case FailStatus::IGNORED: ++m_ignored; break; - case FailStatus::INTERNAL: // internal error count as fail case FailStatus::FAILED: ++m_failed; break; case FailStatus::NONE: ++m_succeeded; break; }; diff --git a/tests/framework/include/dpl/test/statistic.h b/tests/framework/include/dpl/test/statistic.h index 85e2e5d..a4aaccc 100644 --- a/tests/framework/include/dpl/test/statistic.h +++ b/tests/framework/include/dpl/test/statistic.h @@ -46,7 +46,6 @@ class Statistic { ++m_count; switch (type) { - case TestResultsCollectorBase::FailStatus::INTERNAL: case TestResultsCollectorBase::FailStatus::FAILED: ++m_failed; break; case TestResultsCollectorBase::FailStatus::IGNORED: ++m_ignored; diff --git a/tests/framework/include/dpl/test/test_results_collector.h b/tests/framework/include/dpl/test/test_results_collector.h index cb29921..f1ba2f6 100644 --- a/tests/framework/include/dpl/test/test_results_collector.h +++ b/tests/framework/include/dpl/test/test_results_collector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,8 +49,7 @@ class TestResultsCollectorBase : { NONE, FAILED, - IGNORED, - INTERNAL + IGNORED }; }; diff --git a/tests/framework/src/test_results_collector_console.cpp b/tests/framework/src/test_results_collector_console.cpp index 1552755..375c385 100644 --- a/tests/framework/src/test_results_collector_console.cpp +++ b/tests/framework/src/test_results_collector_console.cpp @@ -99,9 +99,6 @@ void ConsoleCollector::CollectResult(const std::string& id, case TestResultsCollectorBase::FailStatus::IGNORED: PrintfIgnoredMessage("Ignored ", reason, true); break; - case TestResultsCollectorBase::FailStatus::INTERNAL: - PrintfErrorMessage("INTERNAL", reason, true); - break; default: Assert(false && "Bad status"); } diff --git a/tests/framework/src/test_results_collector_html.cpp b/tests/framework/src/test_results_collector_html.cpp index 324eb97..77111ce 100644 --- a/tests/framework/src/test_results_collector_html.cpp +++ b/tests/framework/src/test_results_collector_html.cpp @@ -144,9 +144,6 @@ void HtmlCollector::CollectResult(const std::string& id, case TestResultsCollectorBase::FailStatus::IGNORED: PrintfIgnoredMessage("Ignored ", reason, true); break; - case TestResultsCollectorBase::FailStatus::INTERNAL: - PrintfErrorMessage("INTERNAL", reason, true); - break; default: Assert(false && "Bad status"); } diff --git a/tests/framework/src/test_results_collector_xml.cpp b/tests/framework/src/test_results_collector_xml.cpp index 28d9bbd..efdb458 100644 --- a/tests/framework/src/test_results_collector_xml.cpp +++ b/tests/framework/src/test_results_collector_xml.cpp @@ -173,12 +173,6 @@ void XmlCollector::CollectResult(const std::string& id, reason), true); m_resultBuffer.append("\t\t\n"); break; - case TestResultsCollectorBase::FailStatus::INTERNAL: - m_resultBuffer.append(" status=\"FAILED\">\n"); - PrintfErrorMessage("INTERNAL", EscapeSpecialCharacters( - reason), true); - m_resultBuffer.append("\t\t"); - break; default: Assert(false && "Bad status"); } diff --git a/tests/framework/src/test_runner.cpp b/tests/framework/src/test_runner.cpp index af76536..ba67fd2 100644 --- a/tests/framework/src/test_runner.cpp +++ b/tests/framework/src/test_runner.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -268,20 +268,11 @@ TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase) setCurrentTestCase(nullptr); return IGNORED; - } catch (const DPL::Exception &e) { - // DPL exception failure - CollectResult(testCase.name, - "", - TestResultsCollectorBase::FailStatus::INTERNAL, - "DPL exception:" + e.GetMessage()); - - setCurrentTestCase(nullptr); - return FAILED; } catch (const std::exception &) { // std exception failure CollectResult(testCase.name, "", - TestResultsCollectorBase::FailStatus::INTERNAL, + TestResultsCollectorBase::FailStatus::FAILED, "std exception"); setCurrentTestCase(nullptr); @@ -290,7 +281,7 @@ TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase) // Unknown exception failure CollectResult(testCase.name, "", - TestResultsCollectorBase::FailStatus::INTERNAL, + TestResultsCollectorBase::FailStatus::FAILED, "unknown exception"); setCurrentTestCase(nullptr); diff --git a/tests/framework/src/test_runner_multiprocess.cpp b/tests/framework/src/test_runner_multiprocess.cpp index 881e1c1..989654a 100644 --- a/tests/framework/src/test_runner_multiprocess.cpp +++ b/tests/framework/src/test_runner_multiprocess.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ const int MULTI_TEST_ERROR = -1; const int MULTI_TEST_PASS = 0; const int MULTI_TEST_FAILED = 1; const int MULTI_TEST_IGNORED = 2; -const int MULTI_TEST_INTERNAL = 3; } @@ -154,15 +153,12 @@ void RunMultiProc(TestRunner::TestCase procMulti) } catch (const TestRunner::Ignored &e) { code = MULTI_TEST_IGNORED; msg = e.GetMessage(); - } catch (const DPL::Exception &e) { - code = MULTI_TEST_INTERNAL; - msg = "DPL exception:" + e.GetMessage(); } catch (const std::exception &) { - code = MULTI_TEST_INTERNAL; + code = MULTI_TEST_FAILED; msg = "std exception"; } catch (...) { // Unknown exception failure - code = MULTI_TEST_INTERNAL; + code = MULTI_TEST_FAILED; msg = "unknown exception"; } @@ -200,8 +196,6 @@ void RunMultiProc(TestRunner::TestCase procMulti) throw TestRunner::TestFailed(msg); case MULTI_TEST_IGNORED: throw TestRunner::Ignored(msg); - case MULTI_TEST_INTERNAL: - throw TestRunner::TestFailed(msg); default: throw TestRunner::TestFailed(msg); } @@ -229,8 +223,6 @@ void RunMultiProc(TestRunner::TestCase procMulti) case MULTI_TEST_IGNORED: code = MULTI_TEST_FAILED; break; - case MULTI_TEST_INTERNAL: - break; default: break; } @@ -243,24 +235,6 @@ void RunMultiProc(TestRunner::TestCase procMulti) break; case MULTI_TEST_IGNORED: break; - case MULTI_TEST_INTERNAL: - break; - default: - break; - } - } else if ((signed char)WEXITSTATUS(waitStatus) == MULTI_TEST_INTERNAL) { - switch (code) { - case MULTI_TEST_PASS: - code = MULTI_TEST_INTERNAL; - break; - case MULTI_TEST_FAILED: - code = MULTI_TEST_INTERNAL; - break; - case MULTI_TEST_IGNORED: - code = MULTI_TEST_INTERNAL; - break; - case MULTI_TEST_INTERNAL: - break; default: break; } -- 2.7.4