MCPcopy Create free account
hub / github.com/apache/mesos / TEST_F

Function TEST_F

3rdparty/libprocess/src/tests/io_tests.cpp:43–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42
43TEST_F(IOTest, PollRead)
44{
45 Try<std::array<int_fd, 2>> pipes = os::pipe();
46 ASSERT_SOME(pipes);
47 ASSERT_SOME(io::prepare_async((*pipes)[0]));
48 ASSERT_SOME(io::prepare_async((*pipes)[1]));
49
50 // Test discard when polling.
51 Future<short> future = io::poll((*pipes)[0], io::READ);
52 EXPECT_TRUE(future.isPending());
53 future.discard();
54 AWAIT_DISCARDED(future);
55
56 // Test successful polling.
57 future = io::poll((*pipes)[0], io::READ);
58
59 // This is not sufficient for ensuring the event loop does
60 // not detect readiness, since it's happening asynchronously
61 // in the kernel.
62 Clock::pause();
63 Clock::settle();
64 Clock::resume();
65
66 EXPECT_TRUE(future.isPending());
67
68 ASSERT_EQ(2, write((*pipes)[1], "hi", 2));
69 AWAIT_EXPECT_EQ(io::READ, future);
70
71 ASSERT_SOME(os::close((*pipes)[0]));
72 ASSERT_SOME(os::close((*pipes)[1]));
73}
74
75
76// We do not support write readiness polling on Windows

Callers 1

io_tests.cppFile · 0.70

Calls 15

strerrorFunction · 0.85
redirectFunction · 0.85
BytesClass · 0.85
MegabytesFunction · 0.85
isReadyMethod · 0.80
pipeFunction · 0.50
prepare_asyncFunction · 0.50
pollFunction · 0.50
writeFunction · 0.50
closeFunction · 0.50
pagesizeFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected