Skip to content

Commit

Permalink
8333326: Linux Alpine build fails after 8302744
Browse files Browse the repository at this point in the history
Reviewed-by: sgehwolf, clanger, stuefe
  • Loading branch information
MBaesken committed Jun 5, 2024
1 parent 4369856 commit d0052c0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/hotspot/gtest/runtime/test_cgroupSubsystem_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

#include <stdio.h>

// for basename
#include <libgen.h>

typedef struct {
const char* mount_path;
const char* root_path;
Expand All @@ -47,6 +50,7 @@ static bool file_exists(const char* filename) {
return os::stat(filename, &st) == 0;
}

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

TEST(cgroupTest, read_numerical_key_value_failure_cases) {
const char* test_file = temp_file("cgroups");
char* test_file = temp_file("cgroups");
const char* b = basename(test_file);
EXPECT_TRUE(b != nullptr) << "basename was null";
stringStream path;
Expand Down Expand Up @@ -135,7 +139,7 @@ TEST(cgroupTest, read_numerical_key_value_failure_cases) {
}

TEST(cgroupTest, read_numerical_key_value_success_cases) {
const char* test_file = temp_file("cgroups");
char* test_file = temp_file("cgroups");
const char* b = basename(test_file);
EXPECT_TRUE(b != nullptr) << "basename was null";
stringStream path;
Expand Down Expand Up @@ -235,7 +239,7 @@ TEST(cgroupTest, read_numerical_key_value_null) {
}

TEST(cgroupTest, read_number_tests) {
const char* test_file = temp_file("cgroups");
char* test_file = temp_file("cgroups");
const char* b = basename(test_file);
constexpr julong bad = 0xBAD;
EXPECT_TRUE(b != nullptr) << "basename was null";
Expand Down Expand Up @@ -289,7 +293,7 @@ TEST(cgroupTest, read_number_tests) {
}

TEST(cgroupTest, read_string_tests) {
const char* test_file = temp_file("cgroups");
char* test_file = temp_file("cgroups");
const char* b = basename(test_file);
EXPECT_TRUE(b != nullptr) << "basename was null";
stringStream path;
Expand Down Expand Up @@ -355,7 +359,7 @@ TEST(cgroupTest, read_string_tests) {
}

TEST(cgroupTest, read_number_tuple_test) {
const char* test_file = temp_file("cgroups");
char* test_file = temp_file("cgroups");
const char* b = basename(test_file);
EXPECT_TRUE(b != nullptr) << "basename was null";
stringStream path;
Expand Down

0 comments on commit d0052c0

Please sign in to comment.