Define a base TestException class
[platform/core/test/security-tests.git] / src / framework / src / test_runner_multiprocess.cpp
index 989654a..55e889b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 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.
@@ -13,7 +13,7 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
-/*
+/**
  * @file        test_runner_multiprocess.cpp
  * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
  * @version     1.0
@@ -22,6 +22,8 @@
 
 #include <sys/file.h>
 #include <dpl/exception.h>
+#include <dpl/test/test_failed.h>
+#include <dpl/test/test_ignored.h>
 #include <dpl/test/test_runner.h>
 #include <dpl/test/test_runner_child.h>
 #include <dpl/test/test_runner_multiprocess.h>
@@ -141,16 +143,16 @@ void RunMultiProc(TestRunner::TestCase procMulti)
     pid_t top_pid = getpid();
 
     if (!pipe.isReady()) {
-        throw TestRunner::TestFailed("Pipe creation failed");
+        throw TestFailed("Pipe creation failed");
     }
     // pipe
 
     try {
         procMulti();
-    } catch (const TestRunner::TestFailed &e) {
+    } catch (const TestFailed &e) {
         code = MULTI_TEST_FAILED;
         msg = e.GetMessage();
-    } catch (const TestRunner::Ignored &e) {
+    } catch (const TestIgnored &e) {
         code = MULTI_TEST_IGNORED;
         msg = e.GetMessage();
     } catch (const std::exception &) {
@@ -180,10 +182,10 @@ void RunMultiProc(TestRunner::TestCase procMulti)
                         }
                         if (pipeReturn == PipeWrapper::ERROR) {
                             pipe.closeAll();
-                            throw TestRunner::TestFailed("Reading pipe error");
+                            throw TestFailed("Reading pipe error");
                         } else if (pipeReturn == PipeWrapper::TIMEOUT) {
                             pipe.closeAll();
-                            throw TestRunner::TestFailed("Timeout error");
+                            throw TestFailed("Timeout error");
                         }
                         msg = msg + "\n" + recMsg;
                     }
@@ -193,11 +195,11 @@ void RunMultiProc(TestRunner::TestCase procMulti)
                     case MULTI_TEST_PASS:
                         return;
                     case MULTI_TEST_FAILED:
-                        throw TestRunner::TestFailed(msg);
+                        throw TestFailed(msg);
                     case MULTI_TEST_IGNORED:
-                        throw TestRunner::Ignored(msg);
+                        throw TestIgnored(msg);
                     default:
-                        throw TestRunner::TestFailed(msg);
+                        throw TestFailed(msg);
                     }
                 } else {
                     pipe.setUsage(PipeWrapper::WRITEONLY);