8202848: -XX:+ExecuteInternalVMTests asserts with "assert(cd.valid() == true) failed: failed on a valid DirectivesParser string"
authorthartmann
Tue, 22 May 2018 09:10:16 +0200
changeset 50208 a20f2b3c321f
parent 50207 24b5f2e635f6
child 50209 2fdce199fcb9
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
src/hotspot/share/utilities/internalVMTests.cpp
--- 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");
 }