| 163 | { |
| 164 | public: |
| 165 | CgroupsFilter() |
| 166 | { |
| 167 | #ifdef __linux__ |
| 168 | Try<set<string>> hierarchies = cgroups::hierarchies(); |
| 169 | if (hierarchies.isError()) { |
| 170 | std::cerr |
| 171 | << "-------------------------------------------------------------\n" |
| 172 | << "We cannot run any cgroups tests that require mounting\n" |
| 173 | << "hierarchies because reading cgroup heirarchies failed:\n" |
| 174 | << hierarchies.error() << "\n" |
| 175 | << "We'll disable the CgroupsNoHierarchyTest test fixture for now.\n" |
| 176 | << "-------------------------------------------------------------" |
| 177 | << std::endl; |
| 178 | |
| 179 | error = hierarchies.error(); |
| 180 | } else if (!hierarchies->empty()) { |
| 181 | std::cerr |
| 182 | << "-------------------------------------------------------------\n" |
| 183 | << "We cannot run any cgroups tests that require mounting\n" |
| 184 | << "hierarchies because you have the following hierarchies mounted:\n" |
| 185 | << strings::trim(stringify(hierarchies.get()), " {},") << "\n" |
| 186 | << "We'll disable the CgroupsNoHierarchyTest test fixture for now.\n" |
| 187 | << "-------------------------------------------------------------" |
| 188 | << std::endl; |
| 189 | |
| 190 | error = Error("Hierarchies exist"); |
| 191 | } |
| 192 | #endif // __linux__ |
| 193 | } |
| 194 | |
| 195 | bool disable(const ::testing::TestInfo* test) const override |
| 196 | { |