Remove INTERNAL type from FailStatus enum 94/28694/8
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Mon, 13 Oct 2014 14:21:47 +0000 (16:21 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Mon, 1 Dec 2014 17:02:58 +0000 (18:02 +0100)
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
tests/framework/include/dpl/test/statistic.h
tests/framework/include/dpl/test/test_results_collector.h
tests/framework/src/test_results_collector_console.cpp
tests/framework/src/test_results_collector_html.cpp
tests/framework/src/test_results_collector_xml.cpp
tests/framework/src/test_runner.cpp
tests/framework/src/test_runner_multiprocess.cpp

index 229b0737bb42941a82a44aabe657b12c3caa6e5d..5a965307d94529a1554d6efaf0e076a5330249c1 100644 (file)
@@ -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;
     };
index 85e2e5d5705ed7026a37647bccec0f260d7b9a5c..a4aacccb62926f1a60ff5c2fad2b52403468cba2 100644 (file)
@@ -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;
index cb29921416486d3f0fb5268057ac6348ef41e010..f1ba2f61d6d1f8f8a987f64827a6dbcbd6c77d40 100644 (file)
@@ -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
         };
     };
 
index 155275522c88e785d81bb07d2221383a410ef270..375c3856a1f6ab446ae96df045b7573187066f0e 100644 (file)
@@ -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");
     }
index 324eb9760e135d594feb201dca7c74d2d2f520dc..77111ce076438031b993d7a83db43b00556f7bfc 100644 (file)
@@ -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");
     }
index 28d9bbd4b5fa39b79d6b84482d08dcb1833d41f6..efdb458961c7943fee01e706b3278c9d8b209802 100644 (file)
@@ -173,12 +173,6 @@ void XmlCollector::CollectResult(const std::string& id,
                                  reason), true);
         m_resultBuffer.append("\t\t</testcase>\n");
         break;
-    case TestResultsCollectorBase::FailStatus::INTERNAL:
-        m_resultBuffer.append(" status=\"FAILED\">\n");
-        PrintfErrorMessage("INTERNAL", EscapeSpecialCharacters(
-                               reason), true);
-        m_resultBuffer.append("\t\t</testcase>");
-        break;
     default:
         Assert(false && "Bad status");
     }
index af765363eb9208d4b08120f3317b49a03d73d2a4..ba67fd285aa10d9e17f4210831702c88ac269acf 100644 (file)
@@ -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);
index 881e1c168a63146cee324dca6359205a139f3664..989654a71ecd81670c8f963693a43a4e33272807 100644 (file)
@@ -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;
                 }