Define a base TestException class
[platform/core/test/security-tests.git] / src / framework / src / test_runner_child.cpp
index 19ed08c..816316a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013-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.
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
-/*
+/**
  * @file        test_runner_child.cpp
  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
  * @version     1.0
  * @brief       This file is the implementation file of test runner
  */
 #include <stddef.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_results_collector.h>
@@ -297,13 +299,13 @@ void RunChildProc(TestRunner::TestCase procChild)
 {
     PipeWrapper pipe;
     if (!pipe.isReady()) {
-        throw TestRunner::TestFailed("Pipe creation failed");
+        throw TestFailed("Pipe creation failed");
     }
 
     pid_t pid = fork();
 
     if (pid == -1) {
-        throw TestRunner::TestFailed("Child creation failed");
+        throw TestFailed("Child creation failed");
     }
 
     if (pid != 0) {
@@ -327,11 +329,11 @@ void RunChildProc(TestRunner::TestCase procChild)
         waitpid(pid, &status, 0);
 
         if (pipeReturn == PipeWrapper::TIMEOUT) {
-            throw TestRunner::TestFailed("Timeout");
+            throw TestFailed("Timeout");
         }
 
         if (pipeReturn == PipeWrapper::ERROR) {
-            throw TestRunner::TestFailed("Reading pipe error");
+            throw TestFailed("Reading pipe error");
         }
 
         if (code == CHILD_TEST_PASS && msgType == MSG_TYPE_PERF_TIME) {
@@ -341,9 +343,9 @@ void RunChildProc(TestRunner::TestCase procChild)
         }
 
         if (code == CHILD_TEST_FAIL) {
-            throw TestRunner::TestFailed(message);
+            throw TestFailed(message);
         } else if (code == CHILD_TEST_IGNORED) {
-            throw TestRunner::Ignored(message);
+            throw TestIgnored(message);
         }
     } else {
         // child code
@@ -368,10 +370,10 @@ void RunChildProc(TestRunner::TestCase procChild)
 
         try {
             procChild();
-        } catch (const DPL::Test::TestRunner::TestFailed &e) {
+        } catch (const DPL::Test::TestFailed &e) {
             msg = e.GetMessage();
             code = CHILD_TEST_FAIL;
-        } catch (const DPL::Test::TestRunner::Ignored &e) {
+        } catch (const DPL::Test::TestIgnored &e) {
             msg = e.GetMessage();
             code = CHILD_TEST_IGNORED;
         } catch (...) { // catch all exception generated by "user" code