3 #include <gtest/gtest.h>
5 #include <boost/interprocess/shared_memory_object.hpp>
10 #include <ros/duration.h>
12 #include <ros/node_handle.h>
13 #include <ros/subscriber.h>
15 #include <std_msgs/String.h>
21 namespace ipc = boost::interprocess;
68 EXPECT_FALSE(ros::isShuttingDown());
69 EXPECT_THROW(ipc::shared_memory_object(ipc::open_only, test_server_name_shm.c_str(), ipc::read_write), ipc::interprocess_exception);
74 EXPECT_FALSE(ros::isShuttingDown());
76 EXPECT_FALSE(ros::isShuttingDown());
77 ros::Duration(1.1).sleep();
78 EXPECT_FALSE(ros::isShuttingDown());
83 EXPECT_FALSE(ros::isShuttingDown());
85 EXPECT_FALSE(ros::isShuttingDown());
86 ipc::shared_memory_object::remove(test_server_name_shm.c_str());
87 ros::Duration(1.1).sleep();
88 EXPECT_TRUE(ros::isShuttingDown());
94 ros::Duration(5.).sleep();
97 EXPECT_FALSE(ros::isShuttingDown());
98 EXPECT_TRUE(correct_hostname);
102 int main(
int argc,
char **argv)
104 ros::init(argc, argv,
"shm_server_behaviour");
105 testing::InitGoogleTest(&argc, argv);
106 return RUN_ALL_TESTS();