| Jagpal Singh Gill | 2fa10f4 | 2025-12-08 10:35:14 -0800 | [diff] [blame] | 1 | #include "modbus_server_tester.hpp" |
| 2 | |
| 3 | #include <fcntl.h> |
| 4 | |
| 5 | #include <sdbusplus/async.hpp> |
| 6 | |
| 7 | #include <gtest/gtest.h> |
| 8 | |
| 9 | namespace TestIntf = phosphor::modbus::test; |
| 10 | |
| 11 | class BaseTest : public ::testing::Test |
| 12 | { |
| 13 | public: |
| 14 | static constexpr auto baudRate = 115200; |
| 15 | |
| 16 | BaseTest(const char* clientDevicePath, const char* serverDevicePath, |
| 17 | const char* serviceName); |
| 18 | ~BaseTest() noexcept override; |
| 19 | void SetUp() override; |
| 20 | void TearDown() override; |
| 21 | |
| 22 | sdbusplus::async::context ctx; |
| 23 | int fdClient = -1; |
| 24 | |
| 25 | private: |
| 26 | void ServerRequestHandler(); |
| 27 | |
| 28 | static constexpr const auto strBaudeRate = "b115200"; |
| 29 | int socatPid = -1; |
| 30 | std::unique_ptr<TestIntf::ServerTester> serverTester; |
| 31 | int fdServer = -1; |
| 32 | std::atomic<bool> exitThread = false; |
| 33 | std::thread serverThread; |
| 34 | }; |