MCPcopy Create free account
hub / github.com/ceph/ceph / TEST_P

Function TEST_P

src/test/msgr/test_async_driver.cc:105–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105TEST_P(EventDriverTest, PipeTest) {
106 int fds[2];
107 vector<FiredFileEvent> fired_events;
108 int r;
109 struct timeval tv;
110 tv.tv_sec = 0;
111 tv.tv_usec = 1;
112
113 r = pipe(fds);
114 ASSERT_EQ(r, 0);
115 r = driver->add_event(fds[0], EVENT_NONE, EVENT_READABLE);
116 ASSERT_EQ(r, 0);
117 r = driver->event_wait(fired_events, &tv);
118 ASSERT_EQ(r, 0);
119
120 char c = 'A';
121 r = write(fds[1], &c, sizeof(c));
122 ASSERT_EQ(r, 1);
123 r = driver->event_wait(fired_events, &tv);
124 ASSERT_EQ(r, 1);
125 ASSERT_EQ(fired_events[0].fd, fds[0]);
126
127
128 fired_events.clear();
129 r = write(fds[1], &c, sizeof(c));
130 ASSERT_EQ(r, 1);
131 r = driver->event_wait(fired_events, &tv);
132 ASSERT_EQ(r, 1);
133 ASSERT_EQ(fired_events[0].fd, fds[0]);
134
135 fired_events.clear();
136 driver->del_event(fds[0], EVENT_READABLE, EVENT_READABLE);
137 r = write(fds[1], &c, sizeof(c));
138 ASSERT_EQ(r, 1);
139 r = driver->event_wait(fired_events, &tv);
140 ASSERT_EQ(r, 0);
141}
142
143void* echoclient(void *arg)
144{

Callers

nothing calls this directly

Calls 10

pipeFunction · 0.85
set_nonblockFunction · 0.85
bindClass · 0.85
pthread_createFunction · 0.85
writeFunction · 0.50
readFunction · 0.50
add_eventMethod · 0.45
event_waitMethod · 0.45
clearMethod · 0.45
del_eventMethod · 0.45

Tested by

no test coverage detected