From e889b460c03b3887ec5477fa734c430d3c3a41c8 Mon Sep 17 00:00:00 2001 From: Arno Zeller Date: Mon, 4 Mar 2024 08:40:50 +0000 Subject: [PATCH] 8327071: [Testbug] g-tests for cgroup leave files in /tmp on linux Reviewed-by: mbaesken, gli, stuefe --- .../gtest/os/linux/test_cgroupSubsystem_linux.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp index 3b8e6929730..463955fd401 100644 --- a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp +++ b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp @@ -61,7 +61,7 @@ static void delete_file(const char* filename) { class TestController : public CgroupController { public: 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*)"/"; }; }; @@ -99,6 +99,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesErrorCases) { fill_file(test_file, "foof bar"); err = subsystem_file_line_contents(&my_controller, test_file, "foo", "%s", &s); EXPECT_NE(err, 0) << "Key must be exact match"; + + // Cleanup + delete_file(test_file); } TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) { @@ -149,6 +152,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) { err = subsystem_file_line_contents(&my_controller, test_file, nullptr, "%*s %d", &x); EXPECT_EQ(err, 0); EXPECT_EQ(x, 10001); + + // Cleanup + delete_file(test_file); } TEST(cgroupTest, SubSystemFileLineContentsSingleLine) { @@ -190,6 +196,9 @@ TEST(cgroupTest, SubSystemFileLineContentsSingleLine) { err = subsystem_file_line_contents(&my_controller, test_file, nullptr, JULONG_FORMAT, &z); EXPECT_EQ(err, 0); EXPECT_EQ(z, (julong)1337) << "Wrong value for z"; + + // Cleanup + delete_file(test_file); } #endif // LINUX