From: Piotr Sawicki
Date: Wed, 19 Apr 2017 12:13:50 +0000 (+0200)
Subject: Make 'runignored' option work as expected
X-Git-Tag: security-manager_5.5_testing~18
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fd5470f5df2aaa113952ab03729ad00a663d3e5;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git
Make 'runignored' option work as expected
Change-Id: I73214e9dd8ba06b72b8ce379ce8fd59a8e375d73
---
diff --git a/src/framework/include/dpl/test/test_runner.h b/src/framework/include/dpl/test/test_runner.h
index c8fbdcbe..efa057d6 100644
--- a/src/framework/include/dpl/test/test_runner.h
+++ b/src/framework/include/dpl/test/test_runner.h
@@ -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)
/**
diff --git a/src/framework/src/test_runner.cpp b/src/framework/src/test_runner.cpp
index ec67029e..dc033a4a 100644
--- a/src/framework/src/test_runner.cpp
+++ b/src/framework/src/test_runner.cpp
@@ -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)