--- /dev/null
+/*
+ * Copyright (c) 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file performance_result.h
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @version 1.0
+ * @brief Header file with declaration of PerformanceResult class
+ */
+
+#ifndef DPL_TEST_PERFORMANCE_RESULT_H
+#define DPL_TEST_PERFORMANCE_RESULT_H
+
+#include <dpl/binary_queue.h>
+
+#include <chrono>
+#include <memory>
+
+namespace DPL {
+namespace Test {
+
+class PerformanceResult;
+
+typedef std::shared_ptr<PerformanceResult> PerformanceResultPtr;
+typedef std::shared_ptr<const PerformanceResult> ConstPerformanceResultPtr;
+
+class PerformanceResult
+{
+public:
+ PerformanceResult(const std::chrono::system_clock::duration& maxDuration)
+ : m_startTime(std::chrono::system_clock::now())
+ , m_duration(std::chrono::microseconds::zero())
+ , m_maxDuration(maxDuration < std::chrono::microseconds::zero()
+ ? std::chrono::microseconds::zero()
+ : maxDuration) {}
+
+ PerformanceResult(BinaryQueue &queue)
+ : m_startTime(std::chrono::system_clock::now())
+ , m_duration(std::chrono::microseconds::zero())
+ , m_maxDuration(std::chrono::microseconds::zero()) {
+ queue.FlattenConsume(const_cast<std::chrono::system_clock::time_point*>(&m_startTime),
+ sizeof(std::chrono::system_clock::time_point));
+ queue.FlattenConsume(const_cast<std::chrono::system_clock::duration*>(&m_duration),
+ sizeof(std::chrono::system_clock::duration));
+ queue.FlattenConsume(const_cast<std::chrono::system_clock::duration*>(&m_maxDuration),
+ sizeof(std::chrono::system_clock::duration));
+ }
+
+ bool IsMaxDuration() const {
+ return m_maxDuration > std::chrono::microseconds::zero();
+ }
+
+ bool IsDurationOk() const {
+ return m_duration <= m_maxDuration;
+ }
+
+ const std::chrono::system_clock::duration &GetDuration() const {
+ return m_duration;
+ }
+
+ const std::chrono::system_clock::duration &GetMaxDuration() const {
+ return m_maxDuration;
+ }
+
+ void Finish() {
+ if (m_duration == std::chrono::microseconds::zero())
+ m_duration = std::chrono::system_clock::now() - m_startTime;
+ }
+
+ const std::string ToBinaryString() const {
+ std::string strStartTime(reinterpret_cast<const char*>(&m_startTime), sizeof(m_startTime));
+ std::string strDuration(reinterpret_cast<const char*>(&m_duration), sizeof(m_duration));
+ std::string strMaxDuration(reinterpret_cast<const char*>(&m_maxDuration),
+ sizeof(m_maxDuration));
+ return strStartTime + strDuration + strMaxDuration;
+ }
+
+private:
+ const std::chrono::system_clock::time_point m_startTime;
+ std::chrono::system_clock::duration m_duration;
+ const std::chrono::system_clock::duration m_maxDuration;
+};
+
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_PERFORMANCE_RESULT_H
/*
- * 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.
#include <cstddef>
#include <dpl/assert.h>
-#include <dpl/test/test_results_collector.h>
+#include <dpl/test/test_result.h>
namespace DPL {
namespace Test {
m_count(0)
{}
- void AddTest(TestResultsCollectorBase::FailStatus status)
+ void AddTest(TestResult::FailStatus status)
{
++m_count;
switch (status) {
- case TestResultsCollectorBase::FailStatus::FAILED: ++m_failed;
+ case TestResult::FailStatus::FAILED: ++m_failed;
break;
- case TestResultsCollectorBase::FailStatus::IGNORED: ++m_ignored;
+ case TestResult::FailStatus::IGNORED: ++m_ignored;
break;
- case TestResultsCollectorBase::FailStatus::NONE: ++m_passed;
+ case TestResult::FailStatus::NONE: ++m_passed;
break;
default:
Assert(false && "Bad FailStatus");
--- /dev/null
+/*
+ * Copyright (c) 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file test_result.h
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
+ * @version 1.0
+ * @brief Header file with declaration of TestResult class
+ */
+
+#ifndef DPL_TEST_RESULT_H
+#define DPL_TEST_RESULT_H
+
+#include <dpl/test/performance_result.h>
+
+#include <string>
+
+namespace DPL {
+namespace Test {
+
+class TestResult
+{
+public:
+ enum class FailStatus
+ {
+ NONE,
+ FAILED,
+ IGNORED
+ };
+
+ TestResult(FailStatus status,
+ const std::string& reason = std::string(),
+ ConstPerformanceResultPtr performanceResult = nullptr)
+ : m_failStatus(status)
+ , m_reason(reason)
+ , m_performanceResult(performanceResult) {}
+
+ FailStatus GetFailStatus() const {
+ return m_failStatus;
+ }
+
+ const std::string& GetReason() const {
+ return m_reason;
+ }
+
+ ConstPerformanceResultPtr GetPerformanceResult() const {
+ return m_performanceResult;
+ }
+
+private:
+ const FailStatus m_failStatus;
+ const std::string m_reason;
+ ConstPerformanceResultPtr m_performanceResult;
+};
+
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_RESULT_H
/*
- * 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.
*/
/*
* @file test_results_collector.h
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
* @author Lukasz Wrzosek (l.wrzosek@samsung.com)
* @version 1.0
* @brief Header file with declaration of TestResultsCollectorBase
#define DPL_TEST_RESULTS_COLLECTOR_H
#include <dpl/noncopyable.h>
+#include <dpl/test/test_result.h>
+
#include <vector>
#include <list>
#include <map>
-#include <chrono>
#include <string>
#include <memory>
public:
typedef TestResultsCollectorBase* (*CollectorConstructorFunc)();
typedef std::list<std::string> TestCaseIdList;
- enum class FailStatus
- {
- NONE,
- FAILED,
- IGNORED
- };
virtual ~TestResultsCollectorBase() {}
virtual void CollectCurrentTestGroupName(const std::string& /*groupName*/)
{}
- virtual void CollectTestsCasesList(const TestCaseIdList& /*list*/) {}
- virtual void CollectResult(const std::string& id,
- const FailStatus status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime = std::chrono::microseconds::zero()) = 0;
+ virtual void CollectResult(const std::string& id, const TestResult &result) = 0;
virtual std::string CollectorSpecificHelp() const
{
return "";
"[%s%s%s] %s[elapsed: %0.3fms, expected < %0.3fms]%s\n", BOLD_GREEN_BEGIN, \
" OK ", BOLD_GREEN_END, BOLD_RED_BEGIN, elapsed, max, BOLD_RED_END
+extern const std::string COLLECTOR_NO_VERBOSE_HELP;
+
// Get duration as a fraction of millisecond (max precision is 1 microsecond)
double get_milliseconds (const std::chrono::system_clock::duration& performanceTime);
+std::string CollectorFileHelp(const std::string &defaultFilename);
bool ParseCollectorFileArg(const std::string &arg, std::string &filename);
+bool ParseCollectorNoVerboseArg(const std::string &arg, bool &verbosity);
} // namespace Test
} // namespace DPL
/*
- * 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.
private:
ConsoleCollector();
+ virtual bool ParseCollectorSpecificArg(const std::string& arg);
+ virtual std::string CollectorSpecificHelp() const;
virtual void CollectCurrentTestGroupName(const std::string& name);
- virtual void CollectResult(const std::string& id,
- const FailStatus status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = true,
- const std::chrono::system_clock::duration& performanceTime
- = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime
- = std::chrono::microseconds::zero());
+ virtual void CollectResult(const std::string& id, const TestResult &result);
virtual void Finish();
- void PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity);
- void PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity);
+ void PrintfErrorMessage(const char* type, const std::string& message);
+ void PrintfIgnoredMessage(const char* type, const std::string& message);
void PrintStats(const std::string& title, const Statistic& stats);
Statistic m_stats;
std::map<std::string, Statistic> m_groupsStats;
std::string m_currentGroup;
+ bool m_verbosity;
};
} // namespace Test
/*
- * 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.
virtual bool Configure();
virtual void Start();
virtual void CollectCurrentTestGroupName(const std::string& name);
- virtual void CollectResult(const std::string& id,
- const FailStatus status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime
- = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime
- = std::chrono::microseconds::zero());
+ virtual void CollectResult(const std::string& id, const TestResult &result);
virtual void Finish();
- void PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity);
- void PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity);
+ void PrintfErrorMessage(const char* type, const std::string& message);
+ void PrintfIgnoredMessage(const char* type, const std::string& message);
void PrintStats(const std::string& name, const Statistic& stats);
std::string m_filename;
Statistic m_stats;
std::string m_currentGroup;
std::map<std::string, Statistic> m_groupsStats;
+ bool m_verbosity;
};
} // namespace Test
/*
- * 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.
virtual std::string CollectorSpecificHelp() const;
virtual bool ParseCollectorSpecificArg(const std::string& arg);
virtual void Start();
- virtual void CollectResult(const std::string& id,
- const FailStatus status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime
- = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime
- = std::chrono::microseconds::zero());
+ virtual void CollectResult(const std::string& id, const TestResult &result);
virtual void Finish();
void writeStats(bool segfault);
/*
- * 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.
virtual bool Configure();
virtual void Start();
virtual void CollectCurrentTestGroupName(const std::string& name);
- virtual void CollectResult(const std::string& id,
- const FailStatus status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime
- = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime
- = std::chrono::microseconds::zero());
+ virtual void CollectResult(const std::string& id, const TestResult &result);
virtual void Finish();
void GroupStart(const std::size_t pos, const std::string& name);
const std::string& value);
std::string UIntToString(const unsigned int value);
void GroupFinish(const std::size_t groupPosition);
- void PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity);
- void PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity);
+ void PrintfErrorMessage(const char* type, const std::string& message);
+ void PrintfIgnoredMessage(const char* type, const std::string& message);
void FlushOutput();
std::string EscapeSpecialCharacters(std::string s);
Statistic m_stats;
std::string m_outputBuffer;
std::string m_resultBuffer;
+ bool m_verbosity;
};
} // namespace Test
#include <dpl/colors.h>
#include <dpl/gdbbacktrace.h>
#include <dpl/singleton.h>
+#include <dpl/test/performance_result.h>
#include <dpl/test/test_exception.h>
#include <dpl/test/test_failed.h>
#include <dpl/test/test_ignored.h>
+#include <dpl/test/test_result.h>
#include <dpl/test/test_results_collector.h>
namespace DPL {
, m_firstDeferredExceptionType(DeferredExceptionType::DEFERRED_FAILED)
{}
- void beginPerformanceTestTime(std::chrono::system_clock::duration maxTimeInMicroseconds);
- void endPerformanceTestTime();
- void getCurrentTestCasePerformanceResult(bool& isPerformanceTest,
- std::chrono::system_clock::duration& result,
- std::chrono::system_clock::duration& resultMax);
- void setCurrentTestCasePerformanceResult(bool isPerformanceTest,
- std::chrono::system_clock::duration result,
- std::chrono::system_clock::duration resultMax);
+ void beginPerformance(std::chrono::system_clock::duration maxDurationInMicroseconds);
+ void endPerformance();
+ void setCurrentTestCasePerformanceResult(const PerformanceResultPtr &performance);
+ ConstPerformanceResultPtr getCurrentTestCasePerformanceResult();
void addFailReason(const std::string &reason);
{
std::string name;
TestCase proc;
-
- bool m_isPerformanceTest;
- std::chrono::system_clock::time_point m_performanceTestStartTime;
- std::chrono::system_clock::duration m_performanceTestDurationTime;
- std::chrono::system_clock::duration m_performanceMaxTime;
+ PerformanceResultPtr performance;
bool operator <(const TestCaseStruct &other) const
{
TestCaseStruct(const std::string &n, TestCase p) :
name(n),
- proc(p),
- m_isPerformanceTest(false)
+ proc(p)
{}
};
bool filterByXML(std::map<std::string, bool> & casesMap);
void normalizeXMLTag(std::string& str, const std::string& testcase);
- enum Status { FAILED, IGNORED, PASS };
-
- Status RunTestCase(const TestCaseStruct& testCase);
+ void RunTestCase(const TestCaseStruct& testCase);
void setCurrentTestCase(TestCaseStruct* testCase);
TestCaseStruct *getCurrentTestCase();
std::string getConcatedFailReason(const std::string &reason);
- void CollectResult(const std::string& id,
- const TestResultsCollectorBase::FailStatus status
- = TestResultsCollectorBase::FailStatus::NONE,
- const std::string& reason = std::string(),
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime = std::chrono::microseconds::zero());
+ void CollectResult(const std::string& id, const TestResult &result);
public:
void MarkAssertion();
#define RUNNER_PERF_TEST_BEGIN(maxTime) \
do { \
- DPL::Test::TestRunnerSingleton::Instance().beginPerformanceTestTime( \
+ DPL::Test::TestRunnerSingleton::Instance().beginPerformance( \
std::chrono::microseconds{static_cast<long long int>(maxTime*1000000.0)}); \
} while (0)
-#define RUNNER_PERF_TEST_END() \
- do { \
- DPL::Test::TestRunnerSingleton::Instance().endPerformanceTestTime(); \
+#define RUNNER_PERF_TEST_END() \
+ do { \
+ DPL::Test::TestRunnerSingleton::Instance().endPerformance(); \
} while (0)
/**
/*
- * 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.
virtual ~PipeWrapper();
Status send(int code, std::string &message);
- Status sendTime(int code,
- std::chrono::system_clock::duration time,
- std::chrono::system_clock::duration timeMax);
+ Status sendPerformance(const ConstPerformanceResultPtr &performance);
Status receive(int &code,
- int &msgType,
std::string &data,
- std::chrono::system_clock::duration &time,
- std::chrono::system_clock::duration &timeMax,
+ PerformanceResultPtr &performance,
time_t deadline);
void closeAll();
protected:
std::string toBinaryString(int data);
- std::string toBinaryString(std::chrono::system_clock::duration data);
void closeHelp(int desc);
namespace DPL {
namespace Test {
+namespace {
+
+const std::string NO_VERBOSE_ARG = "--no-verbose";
+
+} // namespace
+
+const std::string COLLECTOR_NO_VERBOSE_HELP =
+ NO_VERBOSE_ARG + " - turns off verbosity\n" +
+ std::string(NO_VERBOSE_ARG.size(), ' ') + " verbosity turned on by default\n";
+
double get_milliseconds (const std::chrono::system_clock::duration& performanceTime)
{
return (static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>
(performanceTime).count()))/1000.0;
}
+std::string CollectorFileHelp(const std::string &defaultFilename)
+{
+ return "--file=<filename> - name of file for output\n"
+ " default - " + defaultFilename + "\n";
+}
+
bool ParseCollectorFileArg(const std::string &arg, std::string &filename)
{
const std::string argname = "--file=";
return false;
}
+bool ParseCollectorNoVerboseArg(const std::string &arg, bool &verbosity)
+{
+ if (arg != NO_VERBOSE_ARG)
+ return false;
+ verbosity=false;
+ return true;
+}
+
} // namespace Test
} // namespace DPL
/*
- * 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.
namespace Test {
ConsoleCollector::ConsoleCollector()
+ : m_verbosity(true)
{
}
return new ConsoleCollector();
}
+bool ConsoleCollector::ParseCollectorSpecificArg(const std::string& arg)
+{
+ return ParseCollectorNoVerboseArg(arg, m_verbosity);
+}
+
+std::string ConsoleCollector::CollectorSpecificHelp() const
+{
+ return COLLECTOR_NO_VERBOSE_HELP;
+}
+
void ConsoleCollector::CollectCurrentTestGroupName(const std::string& name)
{
printf("Starting group %s\n", name.c_str());
PrintStats("All tests together", m_stats);
}
-void ConsoleCollector::CollectResult(const std::string& id,
- const FailStatus status,
- const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+void ConsoleCollector::CollectResult(const std::string& id, const TestResult &result)
{
using namespace DPL::Colors::Text;
std::string tmp = "'" + id + "' ...";
printf("Running test case %-60s", tmp.c_str());
- switch (status) {
- case FailStatus::NONE:
- if (isPerformanceTest) {
- if (performanceMaxTime <= std::chrono::microseconds::zero()) {
- printf(GREEN_RESULT_OK_TIME,
- get_milliseconds(performanceTime));
- break;
- }
- else {
- if (performanceTime > performanceMaxTime)
- printf(GREEN_RESULT_OK_TIME_TOO_LONG(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- else
- printf(GREEN_RESULT_OK_TIME_MAX(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- break;
- }
+
+ ConstPerformanceResultPtr performanceResult;
+ switch (result.GetFailStatus()) {
+ case TestResult::FailStatus::NONE:
+ performanceResult = result.GetPerformanceResult();
+ if (!performanceResult) {
+ printf(GREEN_RESULT_OK);
+ break;
+ }
+ if (!performanceResult->IsMaxDuration()) {
+ printf(GREEN_RESULT_OK_TIME,
+ get_milliseconds(performanceResult->GetDuration()));
+ break;
+ }
+ if (!performanceResult->IsDurationOk()) {
+ printf(GREEN_RESULT_OK_TIME_TOO_LONG(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
+ break;
}
- printf(GREEN_RESULT_OK);
+ printf(GREEN_RESULT_OK_TIME_MAX(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
break;
- case FailStatus::FAILED:
- PrintfErrorMessage(" FAILED ", reason, true);
+ case TestResult::FailStatus::FAILED:
+ PrintfErrorMessage(" FAILED ", result.GetReason());
break;
- case FailStatus::IGNORED:
- PrintfIgnoredMessage("Ignored ", reason, true);
+ case TestResult::FailStatus::IGNORED:
+ PrintfIgnoredMessage("Ignored ", result.GetReason());
break;
default:
Assert(false && "Bad status");
}
- m_stats.AddTest(status);
- m_groupsStats[m_currentGroup].AddTest(status);
+ m_stats.AddTest(result.GetFailStatus());
+ m_groupsStats[m_currentGroup].AddTest(result.GetFailStatus());
}
-void ConsoleCollector::PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void ConsoleCollector::PrintfErrorMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Text;
- if (verbosity) {
- printf("[%s%s%s] %s%s%s\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END,
+ printf("[%s%s%s]",
+ BOLD_RED_BEGIN,
+ type,
+ BOLD_RED_END);
+ if (m_verbosity) {
+ printf(" %s%s%s",
BOLD_YELLOW_BEGIN,
message.c_str(),
BOLD_YELLOW_END);
- } else {
- printf("[%s%s%s]\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END);
}
+ printf("\n");
}
-void ConsoleCollector::PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void ConsoleCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Text;
- if (verbosity) {
- printf("[%s%s%s] %s%s%s\n",
- CYAN_BEGIN,
- type,
- CYAN_END,
+ printf("[%s%s%s]",
+ CYAN_BEGIN,
+ type,
+ CYAN_END);
+ if (m_verbosity) {
+ printf(" %s%s%s",
BOLD_GOLD_BEGIN,
message.c_str(),
BOLD_GOLD_END);
- } else {
- printf("[%s%s%s]\n",
- CYAN_BEGIN,
- type,
- CYAN_END);
}
+ printf("\n");
}
void ConsoleCollector::PrintStats(const std::string& title, const Statistic& stats)
/*
- * 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.
}
HtmlCollector::HtmlCollector()
- : m_filename(DEFAULT_HTML_FILE_NAME)
+ : m_filename(DEFAULT_HTML_FILE_NAME),
+ m_verbosity(true)
{
}
std::string HtmlCollector::CollectorSpecificHelp() const
{
- return "--file=<filename> - name of file for output\n"
- " default - index.html\n";
+ return CollectorFileHelp(DEFAULT_HTML_FILE_NAME) + COLLECTOR_NO_VERBOSE_HELP;
}
void HtmlCollector::Start()
bool HtmlCollector::ParseCollectorSpecificArg(const std::string& arg)
{
- return ParseCollectorFileArg(arg, m_filename);
+ return ParseCollectorFileArg(arg, m_filename) || ParseCollectorNoVerboseArg(arg, m_verbosity);
}
-void HtmlCollector::CollectResult(const std::string& id,
- const FailStatus status,
- const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+void HtmlCollector::CollectResult(const std::string& id, const TestResult &result)
{
using namespace DPL::Colors::Html;
std::string tmp = "'" + id + "' ...";
fprintf(m_fp.Get(), "Running test case %-100s", tmp.c_str());
- switch (status) {
- case FailStatus::NONE:
- if (isPerformanceTest) {
- if (performanceMaxTime <= std::chrono::microseconds::zero()) {
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME,
- get_milliseconds(performanceTime));
- break;
- } else {
- if (performanceTime > performanceMaxTime)
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_TOO_LONG(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- else
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_MAX(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- break;
- }
+
+ ConstPerformanceResultPtr performanceResult;
+ switch (result.GetFailStatus()) {
+ case TestResult::FailStatus::NONE:
+ performanceResult = result.GetPerformanceResult();
+ if (!performanceResult) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK);
+ break;
+ }
+ if (!performanceResult->IsMaxDuration()) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME,
+ get_milliseconds(performanceResult->GetDuration()));
+ break;
}
- fprintf(m_fp.Get(), GREEN_RESULT_OK);
+ if (!performanceResult->IsDurationOk()) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_TOO_LONG(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
+ break;
+ }
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_MAX(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
break;
- case FailStatus::FAILED:
- PrintfErrorMessage(" FAILED ", reason, true);
+ case TestResult::FailStatus::FAILED:
+ PrintfErrorMessage(" FAILED ", result.GetReason());
break;
- case FailStatus::IGNORED:
- PrintfIgnoredMessage("Ignored ", reason, true);
+ case TestResult::FailStatus::IGNORED:
+ PrintfIgnoredMessage("Ignored ", result.GetReason());
break;
default:
Assert(false && "Bad status");
}
- m_groupsStats[m_currentGroup].AddTest(status);
- m_stats.AddTest(status);
+ m_groupsStats[m_currentGroup].AddTest(result.GetFailStatus());
+ m_stats.AddTest(result.GetFailStatus());
}
-void HtmlCollector::PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void HtmlCollector::PrintfErrorMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Html;
- if (verbosity) {
+ fprintf(m_fp.Get(),
+ "[%s%s%s]",
+ BOLD_RED_BEGIN,
+ type,
+ BOLD_RED_END);
+ if (m_verbosity) {
fprintf(m_fp.Get(),
- "[%s%s%s] %s%s%s\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END,
+ " %s%s%s",
BOLD_YELLOW_BEGIN,
message.c_str(),
BOLD_YELLOW_END);
- } else {
- fprintf(m_fp.Get(),
- "[%s%s%s]\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END);
}
+ fprintf(m_fp.Get(), "\n");
}
-void HtmlCollector::PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void HtmlCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Html;
- if (verbosity) {
+ fprintf(m_fp.Get(),
+ "[%s%s%s]",
+ CYAN_BEGIN,
+ type,
+ CYAN_END);
+ if (m_verbosity) {
fprintf(m_fp.Get(),
- "[%s%s%s] %s%s%s\n",
- CYAN_BEGIN,
- type,
- CYAN_END,
+ " %s%s%s",
BOLD_GOLD_BEGIN,
message.c_str(),
BOLD_GOLD_END);
- } else {
- fprintf(m_fp.Get(),
- "[%s%s%s]\n",
- CYAN_BEGIN,
- type,
- CYAN_END);
}
+ fprintf(m_fp.Get(), "\n");
}
void HtmlCollector::PrintStats(const std::string& name, const Statistic& stats)
/*
- * 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.
std::string SummaryCollector::CollectorSpecificHelp() const
{
- return "--file=<filename> - name of file for output\n"
- " default - " + DEFAULT_SUMMARY_FILE_NAME + "\n";
+ return CollectorFileHelp(DEFAULT_SUMMARY_FILE_NAME);
}
bool SummaryCollector::ParseCollectorSpecificArg(const std::string& arg)
writeStats(true);
}
-void SummaryCollector::CollectResult(const std::string& id,
- const FailStatus status,
- const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+void SummaryCollector::CollectResult(const std::string& id, const TestResult &result)
{
DPL_UNUSED_PARAM(id);
- DPL_UNUSED_PARAM(reason);
- DPL_UNUSED_PARAM(isPerformanceTest);
- DPL_UNUSED_PARAM(performanceTime);
- DPL_UNUSED_PARAM(performanceMaxTime);
- m_stats.AddTest(status);
+ m_stats.AddTest(result.GetFailStatus());
writeStats(true);
}
/*
- * 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.
}
XmlCollector::XmlCollector()
- : m_filename(DEFAULT_XML_FILE_NAME)
+ : m_filename(DEFAULT_XML_FILE_NAME), m_verbosity(true)
{
}
std::string XmlCollector::CollectorSpecificHelp() const
{
- return "--file=<filename> - name of file for output\n"
- " default - results.xml\n";
+ return CollectorFileHelp(DEFAULT_XML_FILE_NAME) + COLLECTOR_NO_VERBOSE_HELP;
}
void XmlCollector::Start()
bool XmlCollector::ParseCollectorSpecificArg(const std::string& arg)
{
- return ParseCollectorFileArg(arg, m_filename);
+ return ParseCollectorFileArg(arg, m_filename) || ParseCollectorNoVerboseArg(arg, m_verbosity);
}
-void XmlCollector::CollectResult(const std::string& id,
- const FailStatus status,
- const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+void XmlCollector::CollectResult(const std::string& id, const TestResult &result)
{
m_resultBuffer.erase();
m_resultBuffer.append("\t\t<testcase name=\"");
m_resultBuffer.append(EscapeSpecialCharacters(id));
m_resultBuffer.append("\"");
- switch (status) {
- case FailStatus::NONE:
- if (isPerformanceTest) {
- if (performanceMaxTime <= std::chrono::microseconds::zero()) {
- m_resultBuffer.append(" status=\"OK\" time=\"");
- std::ostringstream ostr;
- ostr << performanceTime.count();
- m_resultBuffer.append(ostr.str());
- m_resultBuffer.append("\"/>\n");
- break;
- } else {
- m_resultBuffer.append(" status=\"OK\" time=\"");
- std::ostringstream ostr;
- ostr << performanceTime.count();
- m_resultBuffer.append(ostr.str());
- m_resultBuffer.append("\" time_expected=\"");
- ostr.str("");
- ostr << performanceMaxTime.count();
- m_resultBuffer.append(ostr.str());
- m_resultBuffer.append("\"/>\n");
- break;
- }
+
+ std::ostringstream ostr;
+ ConstPerformanceResultPtr performanceResult;
+ switch (result.GetFailStatus()) {
+ case TestResult::FailStatus::NONE:
+ performanceResult = result.GetPerformanceResult();
+ if (!performanceResult) {
+ m_resultBuffer.append(" status=\"OK\"/>\n");
+ break;
}
- m_resultBuffer.append(" status=\"OK\"/>\n");
+ if (!performanceResult->IsMaxDuration()) {
+ m_resultBuffer.append(" status=\"OK\" time=\"");
+ ostr << performanceResult->GetDuration().count();
+ m_resultBuffer.append(ostr.str());
+ m_resultBuffer.append("\"/>\n");
+ break;
+ }
+ m_resultBuffer.append(" status=\"OK\" time=\"");
+ ostr << performanceResult->GetDuration().count();
+ m_resultBuffer.append(ostr.str());
+ m_resultBuffer.append("\" time_expected=\"");
+ ostr.str("");
+ ostr << performanceResult->GetMaxDuration().count();
+ m_resultBuffer.append(ostr.str());
+ m_resultBuffer.append("\"/>\n");
break;
- case FailStatus::FAILED:
+ case TestResult::FailStatus::FAILED:
m_resultBuffer.append(" status=\"FAILED\">\n");
- PrintfErrorMessage("FAILED", EscapeSpecialCharacters(reason), true);
+ PrintfErrorMessage("FAILED", EscapeSpecialCharacters(result.GetReason()));
m_resultBuffer.append("\t\t</testcase>\n");
break;
- case FailStatus::IGNORED:
+ case TestResult::FailStatus::IGNORED:
m_resultBuffer.append(" status=\"Ignored\">\n");
- PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters(
- reason), true);
+ PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters(result.GetReason()));
m_resultBuffer.append("\t\t</testcase>\n");
break;
default:
}
m_outputBuffer.insert(last_case_pos - 2, m_resultBuffer);
- m_stats.AddTest(status);
+ m_stats.AddTest(result.GetFailStatus());
UpdateGroupHeader(group_pos,
m_stats.GetTotal() + 1, // include SegFault
}
}
-void XmlCollector::PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void XmlCollector::PrintfErrorMessage(const char* type, const std::string& message)
{
- if (verbosity) {
- m_resultBuffer.append("\t\t\t<failure type=\"");
- m_resultBuffer.append(EscapeSpecialCharacters(type));
+ m_resultBuffer.append("\t\t\t<failure type=\"");
+ m_resultBuffer.append(EscapeSpecialCharacters(type));
+ if (m_verbosity) {
m_resultBuffer.append("\" message=\"");
m_resultBuffer.append(EscapeSpecialCharacters(message));
- m_resultBuffer.append("\"/>\n");
- } else {
- m_resultBuffer.append("\t\t\t<failure type=\"");
- m_resultBuffer.append(EscapeSpecialCharacters(type));
- m_resultBuffer.append("\"/>\n");
}
+ m_resultBuffer.append("\"/>\n");
}
-void XmlCollector::PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void XmlCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
{
- if (verbosity) {
- m_resultBuffer.append("\t\t\t<skipped type=\"");
- m_resultBuffer.append(EscapeSpecialCharacters(type));
+ m_resultBuffer.append("\t\t\t<skipped type=\"");
+ m_resultBuffer.append(EscapeSpecialCharacters(type));
+ if (m_verbosity) {
m_resultBuffer.append("\" message=\"");
m_resultBuffer.append(EscapeSpecialCharacters(message));
- m_resultBuffer.append("\"/>\n");
- } else {
- m_resultBuffer.append("\t\t\t<skipped type=\"");
- m_resultBuffer.append(EscapeSpecialCharacters(type));
- m_resultBuffer.append("\"/>\n");
}
+ m_resultBuffer.append("\"/>\n");
}
std::string XmlCollector::EscapeSpecialCharacters(std::string s)
return true;
}
-TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase)
+void TestRunner::RunTestCase(const TestCaseStruct& testCase)
{
setCurrentTestCase(&(const_cast<TestCaseStruct &>(testCase)));
m_deferDeepness = 0U;
} catch (const TestFailed &e) {
// Simple test failure
CollectResult(testCase.name,
- TestResultsCollectorBase::FailStatus::FAILED,
- getConcatedFailReason(e.GetMessage()));
+ TestResult(TestResult::FailStatus::FAILED,
+ getConcatedFailReason(e.GetMessage())));
setCurrentTestCase(nullptr);
- return FAILED;
+ return;
} catch (const TestIgnored &e) {
if (m_runIgnored) {
// Simple test have to be implemented
CollectResult(testCase.name,
- TestResultsCollectorBase::FailStatus::IGNORED,
- e.GetMessage());
+ TestResult(TestResult::FailStatus::IGNORED, e.GetMessage()));
}
setCurrentTestCase(nullptr);
- return IGNORED;
+ return;
} catch (const std::exception &) {
// std exception failure
CollectResult(testCase.name,
- TestResultsCollectorBase::FailStatus::FAILED,
- "std exception");
+ TestResult(TestResult::FailStatus::FAILED, "std exception"));
setCurrentTestCase(nullptr);
- return FAILED;
+ return;
} catch (...) {
// Unknown exception failure
CollectResult(testCase.name,
- TestResultsCollectorBase::FailStatus::FAILED,
- "unknown exception");
-
+ TestResult(TestResult::FailStatus::FAILED, "unknown exception"));
setCurrentTestCase(nullptr);
- return FAILED;
+ return;
}
+ // Everything OK
CollectResult(testCase.name,
- TestResultsCollectorBase::FailStatus::NONE,
- "",
- testCase.m_isPerformanceTest,
- testCase.m_performanceTestDurationTime,
- testCase.m_performanceMaxTime);
+ TestResult(TestResult::FailStatus::NONE,
+ std::string(),
+ testCase.performance));
setCurrentTestCase(nullptr);
-
- // Everything OK
- return PASS;
}
void TestRunner::RunTests()
m_currentTestCase = testCase;
}
-void TestRunner::beginPerformanceTestTime(std::chrono::system_clock::duration maxTimeInMicroseconds)
+void TestRunner::beginPerformance(std::chrono::system_clock::duration maxDurationInMicroseconds)
{
TestCaseStruct* testCase = getCurrentTestCase();
if (!testCase)
return;
- testCase->m_isPerformanceTest = true;
- testCase->m_performanceMaxTime = maxTimeInMicroseconds;
- testCase->m_performanceTestStartTime = std::chrono::system_clock::now();
-
- // Set result to 0 microseconds. Display 0ms result when end macro is missing.
- testCase->m_performanceTestDurationTime = std::chrono::microseconds::zero();
+ if (!testCase->performance)
+ testCase->performance.reset(new PerformanceResult(maxDurationInMicroseconds));
}
-void TestRunner::endPerformanceTestTime()
+void TestRunner::endPerformance()
{
TestCaseStruct* testCase = getCurrentTestCase();
if (!testCase)
return;
- testCase->m_performanceTestDurationTime = std::chrono::system_clock::now() -
- testCase->m_performanceTestStartTime;
+ testCase->performance->Finish();
}
-void TestRunner::getCurrentTestCasePerformanceResult(bool& isPerformanceTest,
- std::chrono::system_clock::duration& result,
- std::chrono::system_clock::duration& resultMax)
+ConstPerformanceResultPtr TestRunner::getCurrentTestCasePerformanceResult()
{
TestCaseStruct* testCase = getCurrentTestCase();
- if (!testCase || !(testCase->m_isPerformanceTest)){
- isPerformanceTest = false;
- return;
- }
+ if (!testCase)
+ return nullptr;
- isPerformanceTest = testCase->m_isPerformanceTest;
- result = testCase->m_performanceTestDurationTime;
- resultMax = testCase->m_performanceMaxTime;
+ return testCase->performance;
}
-void TestRunner::setCurrentTestCasePerformanceResult(bool isPerformanceTest,
- std::chrono::system_clock::duration result,
- std::chrono::system_clock::duration resultMax)
+void TestRunner::setCurrentTestCasePerformanceResult(const PerformanceResultPtr &performance)
{
TestCaseStruct* testCase = getCurrentTestCase();
if (!testCase)
return;
- testCase->m_isPerformanceTest = isPerformanceTest;
- testCase->m_performanceTestDurationTime = result;
- testCase->m_performanceMaxTime = resultMax;
+ testCase->performance = performance;
}
void TestRunner::addFailReason(const std::string &reason)
return reason + ret;
}
-void TestRunner::CollectResult(
- const std::string& id,
- const TestResultsCollectorBase::FailStatus status,
- const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTestDurationTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+void TestRunner::CollectResult(const std::string& id, const TestResult& result)
{
std::for_each(m_collectors.begin(),
m_collectors.end(),
[&](const TestResultsCollectors::value_type & collector)
{
- collector.second->CollectResult(id,
- status,
- reason,
- isPerformanceTest,
- performanceTestDurationTime,
- performanceMaxTime);
+ collector.second->CollectResult(id, result);
});
}
const int CHILD_TEST_PASS = 1;
const int CHILD_TEST_IGNORED = 2;
-const int MSG_TYPE_MESSAGE = 0; // sizeof(Message) + Message
-const int MSG_TYPE_PERF_TIME = 1; // perfTime + maxTime
-
int closeOutput() {
int devnull;
int retcode = -1;
std::ostringstream output;
output << toBinaryString(code);
- output << toBinaryString(MSG_TYPE_MESSAGE);
output << toBinaryString(static_cast<int>(message.size()));
output << message;
return SUCCESS;
}
-PipeWrapper::Status PipeWrapper::sendTime(int code,
- std::chrono::system_clock::duration time,
- std::chrono::system_clock::duration timeMax)
+PipeWrapper::Status PipeWrapper::sendPerformance(const ConstPerformanceResultPtr &performance)
{
+ int foo = 0;
if (m_pipefd[1] == PIPE_CLOSED) {
return ERROR;
}
+ if (!performance)
+ return writeHelp(&foo, sizeof(int));
- std::ostringstream output;
- output << toBinaryString(code);
- output << toBinaryString(MSG_TYPE_PERF_TIME);
- output << toBinaryString(time);
- output << toBinaryString(timeMax);
-
- std::string binary = output.str();
+ std::string binary = performance->ToBinaryString();
int size = binary.size();
if ((writeHelp(&size,
}
PipeWrapper::Status PipeWrapper::receive(int &code,
- int &msgType,
std::string &data,
- std::chrono::system_clock::duration &time,
- std::chrono::system_clock::duration &timeMax,
+ PerformanceResultPtr &performance,
time_t deadline)
{
if (m_pipefd[0] == PIPE_CLOSED) {
queue.AppendCopy(&buffer[0], size);
queue.FlattenConsume(&code, sizeof(int));
- queue.FlattenConsume(&msgType, sizeof(int));
-
- switch (msgType) {
- case MSG_TYPE_MESSAGE:
- queue.FlattenConsume(&size, sizeof(int));
-
- buffer.resize(size);
-
- queue.FlattenConsume(&buffer[0], size);
- data.assign(buffer.begin(), buffer.end());
- break;
- case MSG_TYPE_PERF_TIME:
- queue.FlattenConsume(&time, sizeof(std::chrono::system_clock::duration));
- queue.FlattenConsume(&timeMax, sizeof(std::chrono::system_clock::duration));
- break;
- default:
- return ERROR;
+ queue.FlattenConsume(&size, sizeof(int));
+
+ buffer.resize(size);
+
+ queue.FlattenConsume(&buffer[0], size);
+ data.assign(buffer.begin(), buffer.end());
+
+ if (code != CHILD_TEST_PASS)
+ return SUCCESS;
+
+ if ((ret = readHelp(&size, sizeof(int), deadline)) != SUCCESS) {
+ return ret;
+ }
+
+ if (size == 0) {
+ performance = nullptr;
+ return SUCCESS;
+ }
+
+ buffer.resize(size);
+
+ if ((ret = readHelp(buffer.data(), size, deadline)) != SUCCESS) {
+ return ret;
}
+
+ queue.AppendCopy(buffer.data(), size);
+
+ performance.reset(new PerformanceResult(queue));
} catch (DPL::BinaryQueue::Exception::Base &e) {
return ERROR;
}
return std::string(buffer, buffer + sizeof(int));
}
-std::string PipeWrapper::toBinaryString(std::chrono::system_clock::duration data)
-{
- char buffer[sizeof(std::chrono::system_clock::duration)];
- memcpy(buffer, &data, sizeof(std::chrono::system_clock::duration));
- return std::string(buffer, buffer + sizeof(std::chrono::system_clock::duration));
-}
-
void PipeWrapper::closeHelp(int desc)
{
if (m_pipefd[desc] != PIPE_CLOSED) {
pipe.setUsage(PipeWrapper::READONLY);
int code;
- int msgType;
- std::chrono::system_clock::duration time_m;
- std::chrono::system_clock::duration timeMax_m;
std::string message;
+ PerformanceResultPtr performance;
- int pipeReturn = pipe.receive(code, msgType, message, time_m, timeMax_m, time(0) + 10);
+ int pipeReturn = pipe.receive(code, message, performance, time(0) + 10);
if (pipeReturn != PipeWrapper::SUCCESS) { // Timeout or reading error
pipe.closeAll();
throw TestFailed("Reading pipe error");
}
- if (code == CHILD_TEST_PASS && msgType == MSG_TYPE_PERF_TIME) {
- DPL::Test::TestRunnerSingleton::Instance().setCurrentTestCasePerformanceResult(true,
- time_m,
- timeMax_m);
- }
+ TestRunnerSingleton::Instance().setCurrentTestCasePerformanceResult(performance);
if (code == CHILD_TEST_FAIL) {
throw TestFailed(message);
int code = CHILD_TEST_PASS;
std::string msg;
- bool isPerformanceTest;
- std::chrono::system_clock::duration time_m;
- std::chrono::system_clock::duration timeMax_m;
bool allowLogs = TestRunnerSingleton::Instance().GetAllowChildLogs();
closeOutput();
}
- DPL::Test::TestRunnerSingleton::Instance().getCurrentTestCasePerformanceResult(isPerformanceTest,
- time_m,
- timeMax_m);
-
- if (code == CHILD_TEST_PASS && isPerformanceTest){
- pipe.sendTime(code,
- time_m,
- timeMax_m);
- } else {
- pipe.send(code, msg);
+ pipe.send(code, msg);
+ if (code == CHILD_TEST_PASS){
+ pipe.sendPerformance(TestRunnerSingleton::Instance() \
+ .getCurrentTestCasePerformanceResult());
}
}
}
runTest smack
runTest smack-dbus
-#runTest libprivilege-control
+runTest libprivilege-control
#runTest ss-clientsmack
#runTest ss-server
#runTest ss-password
#runTest ss-stress
runTest security-manager
runTest cynara
+runTest ckm
printSummary
echo
cynara-test "${@:2}"
;;
+"ckm")
+ echo "========================================================================="
+ echo "KEY MANAGER TESTS"
+ echo
+ ckm-tests "${@:2}"
+ ;;
*)
echo "Correct using:"
echo " security_test.sh <module> <args_for_module>"
echo
echo "modules: smack, smack-dbus, libprivilege-control, ss-clientsmack"
echo " ss-server, ss-api-speed, ss-password, ss-stress"
- echo " ss-privilege, security-manager, cynara"
+ echo " ss-privilege, security-manager, cynara, ckm"
;;
esac