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

Function TEST_F

src/tests/containerizer/linux_memfd_tests.cpp:39–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39TEST_F(MemfdTest, CloneSealedFile)
40{
41 const string content = "hello world!";
42 const string filePath = path::join(sandbox.get(), "file");
43 ASSERT_SOME(os::write(filePath, content));
44
45 Try<int_fd> fd = memfd::cloneSealedFile(filePath);
46 ASSERT_SOME(fd);
47
48 const string memFdFile = "/proc/self/fd/" + stringify(fd.get());
49
50 Try<string> actual = os::read(memFdFile);
51 EXPECT_SOME_EQ(content, actual);
52
53 // Make sure we cannot write the cloned file.
54 EXPECT_ERROR(os::write(memFdFile, "xxx"));
55
56 os::close(fd.get());
57}
58
59} // namespace tests {
60} // namespace internal {

Callers

nothing calls this directly

Calls 7

cloneSealedFileFunction · 0.85
joinFunction · 0.50
writeFunction · 0.50
stringifyFunction · 0.50
readFunction · 0.50
closeFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected