Skip to content

Commit

Permalink
Added more immediate stop unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoLusardi committed Jan 24, 2021
1 parent 7f0456b commit 6b156f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option(SSTS_BUILD_TESTS "Build library tests" ON)
option(SSTS_BUILD_EXAMPLES "Build library examples" OFF)
option(SSTS_INSTALL_LIBRARY "Install library" OFF)
option(SSTS_INSTALL_EXAMPLES "Install examples (requires installing library and building examples)" OFF)
option(SSTS_ENABLE_SANITIZERS "" OFF)
option(SSTS_ENABLE_SANITIZERS "Run unit tests with Thread Sanitizer support" ON)

if(${SSTS_ENABLE_SANITIZERS})
if(NOT WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
Expand Down
11 changes: 10 additions & 1 deletion tests/src/test_stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ TEST_F(Stop, ImmediateStop)
EXPECT_EQ(CountScheduledTasks(), 0u);
}

TEST_F(Stop, ImmediateStopLoop)
{
for(auto i= 0; i < 1'000; ++i)
{
InitScheduler(8u);
StopScheduler();
EXPECT_EQ(CountScheduledTasks(), 0u);
}
}

TEST_F(Stop, StopWhileRunningTasks)
{
n_tasks = 32;
Expand All @@ -27,7 +37,6 @@ TEST_F(Stop, StopWhileRunningTasks)
EXPECT_EQ(CountScheduledTasks(), 0u);
}


TEST_F(Stop, NoRunAllowedAfterSchedulerStop)
{
n_tasks = 32;
Expand Down
3 changes: 2 additions & 1 deletion tests/ssts_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ int main(int argc, char** argv)
// ::testing::GTEST_FLAG(filter) = "Stop.*";
// ::testing::GTEST_FLAG(filter) = "Duplicated.*";
// ::testing::GTEST_FLAG(filter) = "Sanitizer.*";

// ::testing::GTEST_FLAG(filter) = "Stop.ImmediateStopLoop*";

::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit 6b156f9

Please sign in to comment.