Skip to content

Commit e419ce7

Browse files
clalancettemergify[bot]
authored andcommitted
Fix warnings on Windows. (#2692)
For reasons I admit I do not understand, the deprecation warnings for StaticSingleThreadedExecutor on Windows happen when we construct a shared_ptr for it in the tests. If we construct a regular object, then it is fine. Luckily this test does not require a shared_ptr, so just make it a regular object here, which rixes the warning. While we are in here, make all of the tests camel case to be consistent. Signed-off-by: Chris Lalancette <[email protected]> (cherry picked from commit 3310f9e) # Conflicts: # rclcpp/test/rclcpp/executors/test_executors.cpp
1 parent df09c6e commit e419ce7

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

rclcpp/test/rclcpp/executors/test_executors.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ to_nanoseconds_helper(DurationT duration)
388388
// - works nominally (it can execute entities)
389389
// - it can execute multiple items at once
390390
// - it does not wait for work to be available before returning
391-
TYPED_TEST(TestExecutors, spin_some)
391+
TYPED_TEST(TestExecutors, spinSome)
392392
{
393393
using ExecutorType = TypeParam;
394394

@@ -480,7 +480,15 @@ TYPED_TEST(TestExecutors, spin_some)
480480

481481
// The purpose of this test is to check that the ExecutorT.spin_some() method:
482482
// - does not continue executing after max_duration has elapsed
483+
<<<<<<< HEAD
483484
TYPED_TEST(TestExecutors, spin_some_max_duration)
485+
=======
486+
// TODO(wjwwood): The `StaticSingleThreadedExecutor`
487+
// do not properly implement max_duration (it seems), so disable this test
488+
// for them in the meantime.
489+
// see: https://github.com/ros2/rclcpp/issues/2462
490+
TYPED_TEST(TestExecutorsStable, spinSomeMaxDuration)
491+
>>>>>>> 3310f9ea (Fix warnings on Windows. (#2692))
484492
{
485493
using ExecutorType = TypeParam;
486494

@@ -772,7 +780,7 @@ TEST(TestExecutors, testSpinWithNonDefaultContext)
772780
rclcpp::shutdown(non_default_context);
773781
}
774782

775-
TYPED_TEST(TestExecutors, release_ownership_entity_after_spinning_cancel)
783+
TYPED_TEST(TestExecutors, releaseOwnershipEntityAfterSpinningCancel)
776784
{
777785
using ExecutorType = TypeParam;
778786
ExecutorType executor;
@@ -808,19 +816,20 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
808816
}
809817

810818
// Create an executor
811-
auto executor = std::make_shared<ExecutorType>();
812-
executor->add_node(this->node);
819+
ExecutorType executor;
820+
executor.add_node(this->node);
813821

814822
// Start spinning
815823
auto executor_thread = std::thread(
816-
[executor]() {
817-
executor->spin();
824+
[&executor]() {
825+
executor.spin();
818826
});
819827

820828
// As the problem is a race, we do this multiple times,
821829
// to raise our chances of hitting the problem
822-
for(size_t i = 0; i < 10; i++) {
823-
auto cg = this->node->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
830+
for (size_t i = 0; i < 10; i++) {
831+
auto cg = this->node->create_callback_group(
832+
rclcpp::CallbackGroupType::MutuallyExclusive);
824833
auto timer = this->node->create_timer(1s, [] {}, cg);
825834
// sleep a bit, so that the spin thread can pick up the callback group
826835
// and add it to the executor
@@ -831,6 +840,6 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
831840
// If the executor has a race, we will experience a segfault at this point.
832841
}
833842

834-
executor->cancel();
843+
executor.cancel();
835844
executor_thread.join();
836845
}

0 commit comments

Comments
 (0)