Skip to content
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

JDK-8266942: gtest/GTestWrapper.java os.iso8601_time_vm failed #4013

Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
@@ -782,28 +782,29 @@ TEST_VM(os, iso8601_time) {
buffer[os::iso8601_timestamp_size] = 'X'; // canary
const char* result = NULL;
// YYYY-MM-DDThh:mm:ss.mmm+zzzz
const char* const pattern = "dddd-dd-dd.dd:dd:dd.ddd+dddd";
const char* const pattern_utc = "dddd-dd-dd.dd:dd:dd.ddd.0000";
const char* const pattern_local = "dddd-dd-dd.dd:dd:dd.ddd.dddd";

result = os::iso8601_time(buffer, sizeof(buffer), true);
tty->print_cr("%s", result);
EXPECT_EQ(result, buffer);
EXPECT_TRUE(very_simple_string_matcher(pattern, result));
EXPECT_TRUE(very_simple_string_matcher(pattern_utc, result));

result = os::iso8601_time(buffer, sizeof(buffer), false);
tty->print_cr("%s", result);
EXPECT_EQ(result, buffer);
EXPECT_TRUE(very_simple_string_matcher(pattern, result));
EXPECT_TRUE(very_simple_string_matcher(pattern_local, result));

// Test with explicit timestamps
result = os::iso8601_time(0, buffer, sizeof(buffer), true);
tty->print_cr("%s", result);
EXPECT_EQ(result, buffer);
EXPECT_TRUE(very_simple_string_matcher("1970-01-01.00:00:00.000+dddd", result));
EXPECT_TRUE(very_simple_string_matcher("1970-01-01.00:00:00.000+0000", result));

result = os::iso8601_time(17, buffer, sizeof(buffer), true);
tty->print_cr("%s", result);
EXPECT_EQ(result, buffer);
EXPECT_TRUE(very_simple_string_matcher("1970-01-01.00:00:00.017+dddd", result));
EXPECT_TRUE(very_simple_string_matcher("1970-01-01.00:00:00.017+0000", result));

// Canary should still be intact
EXPECT_EQ(buffer[os::iso8601_timestamp_size], 'X');