From 0e327fc624651e15805d988b7d5aae0459ff3638 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 6 Nov 2015 17:42:51 +0100 Subject: [PATCH] Use InvariantCulture for parsing float arguments in GC stress tests Otherwise they'd fail on cultures where '.' isn't used as a decimal separator. --- tests/src/GC/Stress/Tests/GCSimulator.cs | 4 ++-- tests/src/GC/Stress/Tests/StressAllocator.cs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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) { -- 2.7.4