Skip to content
Permalink
Browse files
8266942: gtest/GTestWrapper.java os.iso8601_time_vm failed
Reviewed-by: dcubed
  • Loading branch information
tstuefe committed May 15, 2021
1 parent 7ab6dc8 commit f3fb5a4524255487f95a93e50da6b230de0b31ce
Showing with 6 additions and 5 deletions.
  1. +6 −5 test/hotspot/gtest/runtime/test_os.cpp
@@ -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');

1 comment on commit f3fb5a4

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on f3fb5a4 May 15, 2021

Please sign in to comment.