8202848: -XX:+ExecuteInternalVMTests asserts with "assert(cd.valid() == true) failed: failed on a valid DirectivesParser string"
Summary: Use "C" locale for correct parsing of decimals in VM internal compiler directive tests.
Reviewed-by: dholmes, coleenp, stuefe, dcubed
--- a/src/hotspot/share/utilities/internalVMTests.cpp Tue May 22 09:04:15 2018 +0200
+++ b/src/hotspot/share/utilities/internalVMTests.cpp Tue May 22 09:10:16 2018 +0200
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#ifndef PRODUCT
+#include <locale.h>
#include "utilities/internalVMTests.hpp"
#include "utilities/macros.hpp"
@@ -47,7 +48,11 @@
run_unit_test(TestMetaspaceUtils_test);
run_unit_test(GCTimer_test);
run_unit_test(ObjectMonitor_test);
+ // These tests require the "C" locale to correctly parse decimal values
+ const char* orig_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
run_unit_test(DirectivesParser_test);
+ setlocale(LC_NUMERIC, orig_locale);
tty->print_cr("All internal VM tests passed");
}