Make 'runignored' option work as expected 74/125974/3
authorPiotr Sawicki <p.sawicki2@partner.samsung.com>
Wed, 19 Apr 2017 12:13:50 +0000 (14:13 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Fri, 21 Apr 2017 10:28:49 +0000 (03:28 -0700)
Change-Id: I73214e9dd8ba06b72b8ce379ce8fd59a8e375d73

src/framework/include/dpl/test/test_runner.h
src/framework/src/test_runner.cpp

index c8fbdcb..efa057d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2017 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.
@@ -131,6 +131,7 @@ class TestRunner
     // The runner will terminate as soon as possible (after current test).
     void Terminate();
     bool GetAllowChildLogs();
+    bool GetRunIgnored() const;
 
     void deferFailedException(const DPL::Test::TestFailed &ex);
     void deferIgnoredException(const DPL::Test::TestIgnored &ex);
@@ -281,17 +282,20 @@ protected:
 /**
  * IGNORE MACRO
  *
- * When test reaches this macro call, its furhter code will be ignored.
+ * When test reaches this macro call, its further code will be ignored.
  * To ignore whole test, put this macro call at the beginning of this tests
  * body.
  */
 
-#define RUNNER_IGNORED_MSG(message)                    \
-    do                                                 \
-    {                                                  \
-        std::ostringstream assertMsg;                  \
-        assertMsg << message;                          \
-        throw DPL::Test::TestIgnored(assertMsg.str()); \
+#define RUNNER_IGNORED_MSG(message)                                         \
+    do                                                                      \
+    {                                                                       \
+        if (DPL::Test::TestRunnerSingleton::Instance().GetRunIgnored()) {   \
+            break;                                                          \
+        }                                                                   \
+        std::ostringstream assertMsg;                                       \
+        assertMsg << message;                                               \
+        throw DPL::Test::TestIgnored(assertMsg.str());                      \
     } while (0)
 
 /**
index ec67029..dc033a4 100644 (file)
@@ -762,6 +762,11 @@ bool TestRunner::GetAllowChildLogs()
     return m_allowChildLogs;
 }
 
+bool TestRunner::GetRunIgnored() const
+{
+    return m_runIgnored;
+}
+
 void TestRunner::deferFailedException(const DPL::Test::TestFailed &ex)
 {
     if (m_deferDeepness <= 0)