Skip to content

8333326: Linux Alpine build fails after 8302744 #1660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: pr/1648
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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