From: Alexander Köplinger Date: Fri, 6 Nov 2015 16:42:51 +0000 (+0100) Subject: Use InvariantCulture for parsing float arguments in GC stress tests X-Git-Tag: accepted/tizen/base/20180629.140029~6154^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e327fc624651e15805d988b7d5aae0459ff3638;p=platform%2Fupstream%2Fcoreclr.git Use InvariantCulture for parsing float arguments in GC stress tests Otherwise they'd fail on cultures where '.' isn't used as a decimal separator. --- diff --git a/tests/src/GC/Stress/Tests/GCSimulator.cs b/tests/src/GC/Stress/Tests/GCSimulator.cs index b5564bf..ad62c69 100644 --- a/tests/src/GC/Stress/Tests/GCSimulator.cs +++ b/tests/src/GC/Stress/Tests/GCSimulator.cs @@ -825,7 +825,7 @@ namespace GCSimulator else if (currentArg.StartsWith("datapinned") || currentArg.StartsWith("dp")) // percentage data pinned { currentArgValue = args[++i]; - s_percentPinned = float.Parse(currentArgValue); + s_percentPinned = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); if (s_percentPinned < 0 || s_percentPinned > 1) { Console.WriteLine("Error! datapinned should be a number from 0 to 1"); @@ -848,7 +848,7 @@ namespace GCSimulator else if (currentArg.StartsWith("dataweak") || currentArg.StartsWith("dw")) { currentArgValue = args[++i]; - s_percentWeak = float.Parse(currentArgValue); + s_percentWeak = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); if (s_percentWeak < 0 || s_percentWeak > 1) { Console.WriteLine("Error! dataweak should be a number from 0 to 1"); diff --git a/tests/src/GC/Stress/Tests/StressAllocator.cs b/tests/src/GC/Stress/Tests/StressAllocator.cs index 2e0ec1a..2c3c89e 100644 --- a/tests/src/GC/Stress/Tests/StressAllocator.cs +++ b/tests/src/GC/Stress/Tests/StressAllocator.cs @@ -518,7 +518,7 @@ namespace StressAllocator else if (String.Compare(currentArg.ToLower(), "pinned") == 0) { currentArgValue = args[++i]; - percentPinned = float.Parse(currentArgValue); + percentPinned = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); } else if (String.Compare(currentArg.ToLower(), "lohpin") == 0) //for LOH compacting testing, this is the option to apply the pinning percentage to LOH { @@ -527,22 +527,22 @@ namespace StressAllocator else if (String.Compare(currentArg.ToLower(), "bucket1") == 0) { currentArgValue = args[++i]; - percentBucket1 = float.Parse(currentArgValue); + percentBucket1 = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); } else if (String.Compare(currentArg.ToLower(), "bucket2") == 0) { currentArgValue = args[++i]; - percentBucket2 = float.Parse(currentArgValue); + percentBucket2 = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); } else if (String.Compare(currentArg.ToLower(), "bucket3") == 0) { currentArgValue = args[++i]; - percentBucket3 = float.Parse(currentArgValue); + percentBucket3 = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); } else if (String.Compare(currentArg.ToLower(), "bucket4") == 0) { currentArgValue = args[++i]; - percentBucket4 = float.Parse(currentArgValue); + percentBucket4 = float.Parse(currentArgValue, System.Globalization.CultureInfo.InvariantCulture); } else if (String.Compare(currentArg.ToLower(), "nolocks") == 0) {