2 #include <gtest/gtest.h>
4 #include <sys/socket.h>
6 #include <netinet/in.h>
17 virtual void SetUp()=0;
25 ASSERT_NE(-1,
fd = posix_openpt( O_RDWR | O_NOCTTY | O_NDELAY ));
26 ASSERT_NE(-1, grantpt(
fd));
27 ASSERT_NE(-1, unlockpt(
fd));
30 ASSERT_TRUE((pty_name = ptsname(
fd)) != NULL);
49 ASSERT_GE(inet_pton(AF_INET,
"127.0.0.1", &
serv_addr.sin_addr), 0);
53 for (
int attempt = 0; attempt < 10; attempt++)
55 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
60 fcntl(
fd, F_SETFL, O_NONBLOCK);
66 FAIL() <<
"Unable to connect to rosserial socket server.";
81 if (mode ==
"socket") {
83 }
else if (mode ==
"serial") {
86 FAIL() <<
"Mode specified other than 'serial' or 'socket'.";
92 rosserial::ClientComms::fd =
setup->fd;