8327071: [Testbug] g-tests for cgroup leave files in /tmp on linux
Reviewed-by: mbaesken, gli, stuefe
This commit is contained in:
parent
7c71f188a3
commit
e889b460c0
@ -61,7 +61,7 @@ static void delete_file(const char* filename) {
|
|||||||
class TestController : public CgroupController {
|
class TestController : public CgroupController {
|
||||||
public:
|
public:
|
||||||
char* subsystem_path() override {
|
char* subsystem_path() override {
|
||||||
// The real subsystem is in /tmp/, generaed by temp_file()
|
// The real subsystem is in /tmp/, generated by temp_file()
|
||||||
return (char*)"/";
|
return (char*)"/";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -99,6 +99,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesErrorCases) {
|
|||||||
fill_file(test_file, "foof bar");
|
fill_file(test_file, "foof bar");
|
||||||
err = subsystem_file_line_contents(&my_controller, test_file, "foo", "%s", &s);
|
err = subsystem_file_line_contents(&my_controller, test_file, "foo", "%s", &s);
|
||||||
EXPECT_NE(err, 0) << "Key must be exact match";
|
EXPECT_NE(err, 0) << "Key must be exact match";
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
delete_file(test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) {
|
TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) {
|
||||||
@ -149,6 +152,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) {
|
|||||||
err = subsystem_file_line_contents(&my_controller, test_file, nullptr, "%*s %d", &x);
|
err = subsystem_file_line_contents(&my_controller, test_file, nullptr, "%*s %d", &x);
|
||||||
EXPECT_EQ(err, 0);
|
EXPECT_EQ(err, 0);
|
||||||
EXPECT_EQ(x, 10001);
|
EXPECT_EQ(x, 10001);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
delete_file(test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(cgroupTest, SubSystemFileLineContentsSingleLine) {
|
TEST(cgroupTest, SubSystemFileLineContentsSingleLine) {
|
||||||
@ -190,6 +196,9 @@ TEST(cgroupTest, SubSystemFileLineContentsSingleLine) {
|
|||||||
err = subsystem_file_line_contents(&my_controller, test_file, nullptr, JULONG_FORMAT, &z);
|
err = subsystem_file_line_contents(&my_controller, test_file, nullptr, JULONG_FORMAT, &z);
|
||||||
EXPECT_EQ(err, 0);
|
EXPECT_EQ(err, 0);
|
||||||
EXPECT_EQ(z, (julong)1337) << "Wrong value for z";
|
EXPECT_EQ(z, (julong)1337) << "Wrong value for z";
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
delete_file(test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LINUX
|
#endif // LINUX
|
||||||
|
Loading…
x
Reference in New Issue
Block a user