17using namespace std::chrono_literals;
21constexpr std::uint16_t kLinuxTestEtherType = 0x88B6;
24 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
25 0x02, 0x00, 0x00, 0x00, 0x10, 0x01,
27 0x10, 0x20, 0x30, 0x40};
33 const auto interfaceValue = GetTestInterface();
34 if (!interfaceValue.has_value())
36 GTEST_SKIP() <<
"Set PROFINET_TEST_INTERFACE to run live Ethernet backend tests";
38 const std::string&
interface = *interfaceValue;
40 auto sender = CreateBackend(interface, 0U);
41 auto receiver = CreateBackend(interface, kLinuxTestEtherType);
43 receiver->SetTimeout(1000ms);
46 const Bytes received = receiver->Recv();
48 ASSERT_FALSE(received.empty());
49 EXPECT_EQ(received, kFrame);
55 const auto interfaceValue = GetTestInterface();
56 if (!interfaceValue.has_value())
58 GTEST_SKIP() <<
"Set PROFINET_TEST_INTERFACE to run live Ethernet backend tests";
60 const std::string&
interface = *interfaceValue;
62 auto backend = CreateBackend(interface, kLinuxTestEtherType);
63 backend->SetTimeout(25ms);
65 const auto start = std::chrono::steady_clock::now();
66 const Bytes received = backend->Recv();
67 const auto elapsed = std::chrono::steady_clock::now() - start;
69 EXPECT_TRUE(received.empty());
70 EXPECT_GE(elapsed, 15ms);
Shared fixture for EthernetPacketBackend tests.
Shared test fixture helpers for EthernetPacketBackend tests.
TEST_F(AlarmListenerTests, InitializesWithEndpoint)
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
PROFINET protocol wire-format structures and serialization helpers.