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

Method CfsFilter

src/tests/environment.cpp:114–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112{
113public:
114 CfsFilter()
115 {
116#ifdef __linux__
117 Result<string> hierarchy = cgroups::hierarchy("cpu");
118 if (hierarchy.isSome()) {
119 bool cfsQuotaEnabled =
120 os::exists(path::join(hierarchy.get(), "cpu.cfs_quota_us"));
121
122 if (cfsQuotaEnabled) {
123 cfsError = None();
124 } else {
125 cfsError = Error("CFS bandwidth control is not available");
126 }
127 } else if (hierarchy.isError()) {
128 cfsError = Error(
129 "There was an error finding the 'cpu' cgroup hierarchy:\n" +
130 hierarchy.error());
131 } else {
132 cfsError = Error(
133 "The 'cpu' cgroup hierarchy was not found, which means\n"
134 "that CFS bandwidth control is not available");
135 }
136
137 if (cfsError.isSome()) {
138 std::cerr
139 << "-------------------------------------------------------------\n"
140 << "The 'CFS_' tests cannot be run because:\n"
141 << cfsError->message << "\n"
142 << "-------------------------------------------------------------"
143 << std::endl;
144 }
145#else
146 cfsError = Error(
147 "These tests require CFS bandwidth control, which is a "
148 "Linux kernel feature, but Linux has not been detected");
149#endif // __linux__
150 }
151
152 bool disable(const ::testing::TestInfo* test) const override
153 {

Callers

nothing calls this directly

Calls 9

NoneClass · 0.85
errorMethod · 0.65
hierarchyFunction · 0.50
existsFunction · 0.50
joinFunction · 0.50
ErrorFunction · 0.50
isSomeMethod · 0.45
getMethod · 0.45
isErrorMethod · 0.45

Tested by

no test coverage detected