Skip to content

Commit e217532

Browse files
mergify[bot]clalancettefujitatomoya
authored
Fix warnings on Windows. (backport #2692) (#2694)
* 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 * resolve backport conflict. Signed-off-by: Tomoya Fujita <[email protected]> --------- Signed-off-by: Tomoya Fujita <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> Co-authored-by: Tomoya Fujita <[email protected]>
1 parent a7b8ada commit e217532

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

rclcpp/test/rclcpp/executors/test_executors.cpp

Lines changed: 11 additions & 10 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,7 @@ 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-
TYPED_TEST(TestExecutors, spin_some_max_duration)
483+
TYPED_TEST(TestExecutors, spinSomeMaxDuration)
484484
{
485485
using ExecutorType = TypeParam;
486486

@@ -772,7 +772,7 @@ TEST(TestExecutors, testSpinWithNonDefaultContext)
772772
rclcpp::shutdown(non_default_context);
773773
}
774774

775-
TYPED_TEST(TestExecutors, release_ownership_entity_after_spinning_cancel)
775+
TYPED_TEST(TestExecutors, releaseOwnershipEntityAfterSpinningCancel)
776776
{
777777
using ExecutorType = TypeParam;
778778
ExecutorType executor;
@@ -808,19 +808,20 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
808808
}
809809

810810
// Create an executor
811-
auto executor = std::make_shared<ExecutorType>();
812-
executor->add_node(this->node);
811+
ExecutorType executor;
812+
executor.add_node(this->node);
813813

814814
// Start spinning
815815
auto executor_thread = std::thread(
816-
[executor]() {
817-
executor->spin();
816+
[&executor]() {
817+
executor.spin();
818818
});
819819

820820
// As the problem is a race, we do this multiple times,
821821
// 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);
822+
for (size_t i = 0; i < 10; i++) {
823+
auto cg = this->node->create_callback_group(
824+
rclcpp::CallbackGroupType::MutuallyExclusive);
824825
auto timer = this->node->create_timer(1s, [] {}, cg);
825826
// sleep a bit, so that the spin thread can pick up the callback group
826827
// and add it to the executor
@@ -831,6 +832,6 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
831832
// If the executor has a race, we will experience a segfault at this point.
832833
}
833834

834-
executor->cancel();
835+
executor.cancel();
835836
executor_thread.join();
836837
}

0 commit comments

Comments
 (0)