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 229b073..5a96530 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 85e2e5d..a4aaccc 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 cb29921..f1ba2f6 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 1552755..375c385 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 324eb97..77111ce 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 28d9bbd..efdb458 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 af76536..ba67fd2 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 881e1c1..989654a 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;
                 }