Skip to content

Commit

Permalink
-- test: Fixes for ITest_Abort (#726)
Browse files Browse the repository at this point in the history
* -- test: the abort handler may be called during running state, if the running state can be entered by participants

* -- test: move checking the final participant states below joining all threads
  • Loading branch information
VDanielEdwards authored and GitHub Enterprise committed Dec 14, 2023
1 parent b72976b commit c3ae414
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions SilKit/IntegrationTests/ITest_Abort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ TEST_F(ITest_Abort, test_Abort_Communication_Ready_Simulation_Sync)
EXPECT_CALL(callbacks, AbortHandler(ParticipantState::CommunicationInitialized))
.Times(Between(0, size));
EXPECT_CALL(callbacks, AbortHandler(ParticipantState::ReadyToRun)).Times(Between(0, size));
EXPECT_CALL(callbacks, AbortHandler(ParticipantState::Running)).Times(Between(0, size));
EXPECT_CALL(callbacks, ParticipantStateHandler(ParticipantState::Shutdown)).Times(size);
EXPECT_CALL(callbacks, ParticipantStateHandler(ParticipantState::Error)).Times(0);
EXPECT_CALL(callbacks, ParticipantStateHandler(ParticipantState::Invalid)).Times(0);
Expand Down Expand Up @@ -341,6 +342,9 @@ TEST_F(ITest_Abort, test_Abort_Communication_Ready_Simulation_Sync)
// Wait for coordinated to end
JoinParticipantThreads(participantThreads_Sync_Coordinated);

monitorParticipants.front().i.stopRequested = true;
JoinParticipantThreads(participantThreads_Async_Autonomous);

// Expect shutdown state, which should happen after the abort handlers are called.
for (const auto& participant : monitorParticipants.front().CopyMonitoredParticipantStates())
{
Expand All @@ -350,9 +354,6 @@ TEST_F(ITest_Abort, test_Abort_Communication_Ready_Simulation_Sync)
}
}

monitorParticipants.front().i.stopRequested = true;
JoinParticipantThreads(participantThreads_Async_Autonomous);

StopRegistry();
}

Expand Down

0 comments on commit c3ae414

Please sign in to comment.