Skip to content

Commit d0ceaff

Browse files
committed
Minor updates
1 parent 51b9ef9 commit d0ceaff

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

Logger/src/LogData.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ bool LogData::Flush()
3232
logFile << str << std::endl;
3333
}
3434
logFile.close();
35+
m_msgData.clear();
3536

3637
#ifdef IT_ENABLE
3738
auto endTime = std::chrono::high_resolution_clock::now();

Logger/src/LogData.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class LogData
1515
dmq::MulticastDelegateSafe<void(std::chrono::milliseconds)> FlushTimeDelegate;
1616
#endif
1717

18+
LogData() { }
19+
~LogData() { m_msgData.clear(); }
20+
1821
/// Write log data
1922
/// @param[in] msg - data to log
2023
void Write(const std::string& msg);

Logger/src/Logger.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ void Logger::TimerThread()
197197
//----------------------------------------------------------------------------
198198
void Logger::Process()
199199
{
200+
#ifdef IT_ENABLE
201+
{
202+
// Tests might check for memory leaks. std::queue on first push allocates memory.
203+
// If the first push is done during a test, it could trigger a memory leak failure.
204+
// Put a dummy message in queue before tests starts to resolve.
205+
auto m = std::make_shared<Msg>(0);
206+
m_queue.push(m);
207+
m_queue.pop();
208+
}
209+
#endif
210+
200211
m_timerExit = false;
201212
std::thread timerThread(&Logger::TimerThread, this);
202213

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
[![conan Windows](https://github.com/endurodave/IntegrationTestFramework/actions/workflows/cmake_windows.yml/badge.svg)](https://github.com/endurodave/IntegrationTestFramework/actions/workflows/cmake_windows.yml)
55

66
# Integration Test Framework using Google Test and Delegates
7+
78
An integration test framework used for testing multi-threaded C++ based projects using Google Test and [DelegateMQ](https://github.com/endurodave/DelegateMQ) C++ asynchronous delegate libraries. All target devices are supported including Windows, Linux, and embedded systems.
89

10+
See [IntegrationTestFrameworkCppUTest](https://github.com/endurodave/IntegrationTestFrameworkCppUTest) for alternate CppUTest and delegates implementation.
11+
912
# Table of Contents
1013

1114
- [Integration Test Framework using Google Test and Delegates](#integration-test-framework-using-google-test-and-delegates)
@@ -45,6 +48,7 @@ This project implements an integration testing framework for multi-threaded C++
4548
## References
4649
* [Goolge Test](https://github.com/google/googletest) - Google Test is a C++ unit testing framework that provides an API for writing and running unit tests.
4750
* [DelegateMQ](https://github.com/endurodave/DelegateMQ) - The DelegateMQ C++ library can invoke any callable function synchronously, asynchronously, or on a remote endpoint.
51+
* [IntegrationTestFrameworkCppUTest](https://github.com/endurodave/IntegrationTestFrameworkCppUTest) - Integration test framework using CppUTest and delegates.
4852

4953
# Getting Started
5054
[CMake](https://cmake.org/) is used to create the project build files. See `CMakeLists.txt` for more information.
@@ -618,7 +622,7 @@ void IntegrationTest::Run()
618622
}
619623
```
620624

621-
Include `UI_Client.h` in any production module that requires integration test support.
625+
Include `IT_Client.h` in any production module that requires integration test support.
622626

623627
# Conclusion
624628
Developing a user-friendly integration testing framework that mirrors the simplicity of unit testing can be challenging. This document outlines a solution that leverages Google Test and DelegateMQ libraries to achieve this goal.

0 commit comments

Comments
 (0)