Skip to content

Commit d0052c0

Browse files
committed
8333326: Linux Alpine build fails after 8302744
Reviewed-by: sgehwolf, clanger, stuefe
1 parent 4369856 commit d0052c0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/hotspot/gtest/runtime/test_cgroupSubsystem_linux.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434

3535
#include <stdio.h>
3636

37+
// for basename
38+
#include <libgen.h>
39+
3740
typedef struct {
3841
const char* mount_path;
3942
const char* root_path;
@@ -47,6 +50,7 @@ static bool file_exists(const char* filename) {
4750
return os::stat(filename, &st) == 0;
4851
}
4952

53+
// we rely on temp_file returning modifiable memory in resource area.
5054
static char* temp_file(const char* prefix) {
5155
const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info();
5256
stringStream path;
@@ -89,7 +93,7 @@ static void fill_file(const char* path, const char* content) {
8993
}
9094

9195
TEST(cgroupTest, read_numerical_key_value_failure_cases) {
92-
const char* test_file = temp_file("cgroups");
96+
char* test_file = temp_file("cgroups");
9397
const char* b = basename(test_file);
9498
EXPECT_TRUE(b != nullptr) << "basename was null";
9599
stringStream path;
@@ -135,7 +139,7 @@ TEST(cgroupTest, read_numerical_key_value_failure_cases) {
135139
}
136140

137141
TEST(cgroupTest, read_numerical_key_value_success_cases) {
138-
const char* test_file = temp_file("cgroups");
142+
char* test_file = temp_file("cgroups");
139143
const char* b = basename(test_file);
140144
EXPECT_TRUE(b != nullptr) << "basename was null";
141145
stringStream path;
@@ -235,7 +239,7 @@ TEST(cgroupTest, read_numerical_key_value_null) {
235239
}
236240

237241
TEST(cgroupTest, read_number_tests) {
238-
const char* test_file = temp_file("cgroups");
242+
char* test_file = temp_file("cgroups");
239243
const char* b = basename(test_file);
240244
constexpr julong bad = 0xBAD;
241245
EXPECT_TRUE(b != nullptr) << "basename was null";
@@ -289,7 +293,7 @@ TEST(cgroupTest, read_number_tests) {
289293
}
290294

291295
TEST(cgroupTest, read_string_tests) {
292-
const char* test_file = temp_file("cgroups");
296+
char* test_file = temp_file("cgroups");
293297
const char* b = basename(test_file);
294298
EXPECT_TRUE(b != nullptr) << "basename was null";
295299
stringStream path;
@@ -355,7 +359,7 @@ TEST(cgroupTest, read_string_tests) {
355359
}
356360

357361
TEST(cgroupTest, read_number_tuple_test) {
358-
const char* test_file = temp_file("cgroups");
362+
char* test_file = temp_file("cgroups");
359363
const char* b = basename(test_file);
360364
EXPECT_TRUE(b != nullptr) << "basename was null";
361365
stringStream path;

0 commit comments

Comments
 (0)