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

Function TEST

src/tests/ldd_tests.cpp:40–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace tests {
39
40TEST(Ldd, BinSh)
41{
42 Try<vector<ldcache::Entry>> cache = ldcache::parse();
43 ASSERT_SOME(cache);
44
45 Try<hashset<string>> dependencies = ldd("/bin/sh", cache.get());
46 ASSERT_SOME(dependencies);
47
48 EXPECT_FALSE(dependencies->contains("/bin/sh"));
49
50 auto libc = std::find_if(
51 dependencies->begin(),
52 dependencies->end(),
53 [](const string& dependency) {
54 // On most Linux systems, libc would be in libc.so.6, but
55 // checking the unversioned prefix is robust and is enough
56 // to know that ldd() worked.
57 string basename = Path(dependency).basename();
58 return strings::startsWith(basename, "libc.so");
59 });
60
61 EXPECT_TRUE(libc != dependencies->end());
62}
63
64
65TEST(Ldd, EmptyCache)

Callers

nothing calls this directly

Calls 9

lddFunction · 0.85
PathClass · 0.85
startsWithFunction · 0.85
parseFunction · 0.50
getMethod · 0.45
containsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected