Skip to content

Commit

Permalink
fix: add temporary workaround for clearing transmit queue in unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GwnDaan committed Jan 31, 2024
1 parent 8c11baa commit d26f65b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/cf_functionalities_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ TEST(CONTROL_FUNCTION_FUNCTIONALITIES_TESTS, CFFunctionalitiesTest)
EXPECT_EQ(1, testMessageData.at(18)); // 1 Boom
EXPECT_EQ(255, testMessageData.at(19)); // 255 Sections

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use destroyed control functions later on
ASSERT_TRUE(internalECU->destroy(2));
ASSERT_TRUE(otherECU->destroy());
Expand Down
1 change: 1 addition & 0 deletions test/guidance_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ TEST(GUIDANCE_TESTS, GuidanceMessages)
testPlugin.close();
}

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
ASSERT_TRUE(testECU->destroy());
}

Expand Down
2 changes: 1 addition & 1 deletion test/isb_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ TEST(ISB_TESTS, ShortcutButtonTxTests)
EXPECT_EQ(ShortcutButtonInterface::StopAllImplementOperationsState::StopImplementOperations, interfaceUnderTest.get_state());

CANHardwareInterface::stop();

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
ASSERT_TRUE(internalECU->destroy(2));
}
1 change: 1 addition & 0 deletions test/language_command_interface_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ TEST(LANGUAGE_COMMAND_INTERFACE_TESTS, SettersAndTransmitting)

testPlugin.close();

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
EXPECT_TRUE(testECU->destroy(2));
CANHardwareInterface::stop();
Expand Down
1 change: 1 addition & 0 deletions test/maintain_power_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ TEST(MAINTAIN_POWER_TESTS, MessageEncoding)

testPlugin.close();

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
EXPECT_TRUE(testECU->destroy(2));
CANHardwareInterface::stop();
Expand Down
1 change: 1 addition & 0 deletions test/speed_distance_message_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ TEST(SPEED_MESSAGE_TESTS, SpeedMessages)
ASSERT_TRUE(testPlugin.read_frame(testFrame));
}

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
EXPECT_TRUE(testECU->destroy());
CANHardwareInterface::stop();
}
Expand Down
4 changes: 2 additions & 2 deletions test/tc_client_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,10 @@ TEST(TASK_CONTROLLER_CLIENT_TESTS, MessageEncoding)
CANHardwareInterface::stop();
CANHardwareInterface::set_number_of_can_channels(0);

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
ASSERT_TRUE(tcPartner->destroy(3));
ASSERT_TRUE(internalECU->destroy(3));

CANNetworkManager::CANNetwork.update();
}

TEST(TASK_CONTROLLER_CLIENT_TESTS, BadPartnerDeathTest)
Expand Down Expand Up @@ -1672,6 +1671,7 @@ TEST(TASK_CONTROLLER_CLIENT_TESTS, CallbackTests)

CANHardwareInterface::stop();

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
ASSERT_TRUE(TestPartnerTC->destroy(3));
ASSERT_TRUE(internalECU->destroy(3));
Expand Down
1 change: 1 addition & 0 deletions test/vt_client_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ TEST(VIRTUAL_TERMINAL_TESTS, MessageConstruction)
serverVT.close();
CANHardwareInterface::stop();

CANNetworkManager::CANNetwork.update(); //! @todo: quick hack for clearing the transmit queue, can be removed once network manager is singleton
//! @todo try to reduce the reference count, such that that we don't use a control function after it is destroyed
ASSERT_TRUE(vtPartner->destroy(3));
ASSERT_TRUE(internalECU->destroy(3));
Expand Down

0 comments on commit d26f65b

Please sign in to comment.