From 4714fdcd6a1615b9d357dab0116a579c1cd5bfb5 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 27 Apr 2022 04:58:13 +0000 Subject: [PATCH] 8285279: ArgumentsTest.set_numeric_flag_double_vm fails on some locales (again) Reviewed-by: dholmes --- test/hotspot/gtest/runtime/test_arguments.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hotspot/gtest/runtime/test_arguments.cpp b/test/hotspot/gtest/runtime/test_arguments.cpp index b67d306baab..1069be61dfe 100644 --- a/test/hotspot/gtest/runtime/test_arguments.cpp +++ b/test/hotspot/gtest/runtime/test_arguments.cpp @@ -593,13 +593,13 @@ TEST_VM_F(ArgumentsTest, set_numeric_flag_double) { for (uint i = 0; i < ARRAY_SIZE(more_test_strings); i++) { const char* str = more_test_strings[i]; - char* dummy; + char* end; errno = 0; - double expected = strtod(str, &dummy); - if (errno == 0) { + double expected = strtod(str, &end); + if (errno == 0 && end != NULL && *end == '\0') { ASSERT_TRUE(ArgumentsTest::parse_argument(flag->name(), str)) << "Test string '" << - str << "' did not parse for type " << flag->type_string() << "."; + str << "' did not parse for type " << flag->type_string() << ". (Expected value = " << expected << ")"; double d = flag->get_double(); ASSERT_TRUE(d == expected) << "Parsed number " << d << " is not the same as expected " << expected;