summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2015-11-02 13:48:31 +0100
committerAlexander Köplinger <alex.koeplinger@outlook.com>2015-11-02 20:42:50 +0100
commitabad1fd7bf8a33bbaa1a6982d2a6d61647c4464c (patch)
tree26d55f816eb675fdf99119f3025ebc5c0f1ef520 /tests/src
parent83b2cb83b32faa45b4f790237b5c5e259692294a (diff)
downloadcoreclr-abad1fd7bf8a33bbaa1a6982d2a6d61647c4464c.tar.gz
coreclr-abad1fd7bf8a33bbaa1a6982d2a6d61647c4464c.tar.bz2
coreclr-abad1fd7bf8a33bbaa1a6982d2a6d61647c4464c.zip
Remove Env helper class in tests
It's not used in a lot of places and just makes life more complicated, because Utilities.IsWindows is hardcoded to true right now (which should be fixed separately). See https://github.com/dotnet/coreclr/pull/1907 for some details.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj1
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/Env.cs115
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/TestFramework.cs4
-rw-r--r--tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionctor2.cs2
-rw-r--r--tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionmessage.cs6
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathaltdirectoryseparatorchar.cs2
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathcombine.cs21
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathdirectoryseparatorchar.cs2
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathgetdirectoryname.cs5
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathpathseparator.cs2
-rw-r--r--tests/src/CoreMangLib/cti/system/io/path/pathvolumeseparatorchar.cs2
-rw-r--r--tests/src/CoreMangLib/cti/system/objectdisposedexception/objectdisposedexceptionmessage.cs18
-rw-r--r--tests/src/CoreMangLib/cti/system/runtime/compilerservices/internalsvisibletoattribute/internalsvisibletoattributeassemblyname.cs2
-rw-r--r--tests/src/JIT/Directed/intrinsic/pow/pow1.cs4
-rw-r--r--tests/src/baseservices/exceptions/unittests/trace.cs2
15 files changed, 35 insertions, 153 deletions
diff --git a/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj b/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
index 2043f5ddde..f0c88c070b 100644
--- a/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
+++ b/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
@@ -32,7 +32,6 @@
<ItemGroup>
<Compile Include="CalendarHelpers.cs" />
<Compile Include="EndianessChecker.cs" />
- <Compile Include="Env.cs" />
<Compile Include="Generator.cs" />
<Compile Include="GlobLocHelper.cs" />
<Compile Include="Logging.cs" />
diff --git a/tests/src/Common/CoreCLRTestLibrary/Env.cs b/tests/src/Common/CoreCLRTestLibrary/Env.cs
deleted file mode 100644
index e7f1819420..0000000000
--- a/tests/src/Common/CoreCLRTestLibrary/Env.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
-
-namespace TestLibrary
-{
- public static partial class Env
- {
- const int MAX_PATH = 260;
- const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
-
- public static string NewLine
- {
- get
- {
- if (Utilities.IsWindows)
- {
- return "\r\n";
- }
- else
- {
- return "\n";
- }
- }
- }
-
- public static string FileSeperator
- {
- get
- {
- if (Utilities.IsWindows)
- {
- return "\\";
- }
- else
- {
- return "/";
- }
- }
- }
-
- public static string VolumeSeperator
- {
- get
- {
- if (Utilities.IsWindows)
- {
- return ":";
- }
- else
- {
- return "/";
- }
- }
- }
-
- public static string AltFileSeperator
- {
- get
- {
- if (Utilities.IsWindows)
- {
- return "/";
- }
- else
- {
- return "\\";
- }
- }
- }
-
- public static string PathDelimiter
- {
- get
- {
- if (Utilities.IsWindows)
- {
- return ";";
- }
- else
- {
- return ":";
- }
- }
- }
-
- public static int MaxPath
- {
- get
- {
- return 248;
- }
- }
-
- public static int MaxFileName
- {
- get
- {
- return 260;
- }
- }
-
- public static String CurrentDirectory
- {
- get { return ""; }
- }
- }
-}
diff --git a/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs b/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs
index ff094a3d42..7208009f98 100644
--- a/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs
+++ b/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs
@@ -29,11 +29,11 @@ namespace TestLibrary
#else
Random rand = new Random();
- if (Env.GetEnvVariable("CORECLR_SEED") != null)
+ if (Environment.GetEnvironmentVariable("CORECLR_SEED") != null)
{
try
{
- seed = int.Parse(Env.GetEnvVariable("CORECLR_SEED"));
+ seed = int.Parse(Environment.GetEnvironmentVariable("CORECLR_SEED"));
}
catch (FormatException) { seed = rand.Next(); }
}
diff --git a/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionctor2.cs b/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionctor2.cs
index 88e37e82d8..ce5632d6a4 100644
--- a/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionctor2.cs
+++ b/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionctor2.cs
@@ -37,7 +37,7 @@ public class ArgumentOutOfRangeExceptionCtor2
TestLibrary.TestFramework.LogError("001", "The result is not the value as expected");
retVal = false;
}
- if ((argumentOutOfRangeException.Message != "Specified argument was out of the range of valid values."+TestLibrary.Env.NewLine+"Parameter name: " + randValue) &
+ if ((argumentOutOfRangeException.Message != "Specified argument was out of the range of valid values."+Environment.NewLine+"Parameter name: " + randValue) &
(!argumentOutOfRangeException.Message.Contains("[Arg_ArgumentOutOfRangeException]")))
{
TestLibrary.TestFramework.LogError("002", "The result is not the value as expected" + argumentOutOfRangeException.Message);
diff --git a/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionmessage.cs b/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionmessage.cs
index 204569955f..9d0e755d73 100644
--- a/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionmessage.cs
+++ b/tests/src/CoreMangLib/cti/system/argumentoutofrangeexception/argumentoutofrangeexceptionmessage.cs
@@ -34,7 +34,7 @@ public class ArgumentOutOfRangeExceptionMessage
{
string randValue = TestLibrary.Generator.GetString(-55, false, c_MIN_STRING_LENGTH, c_MAX_STRING_LENGTH);
ArgumentOutOfRangeException argumentOutOfRangeException = new ArgumentOutOfRangeException(randValue);
- if ((argumentOutOfRangeException.Message != "Specified argument was out of the range of valid values." + TestLibrary.Env.NewLine + "Parameter name: " + randValue) &
+ if ((argumentOutOfRangeException.Message != "Specified argument was out of the range of valid values." + Environment.NewLine + "Parameter name: " + randValue) &
(!argumentOutOfRangeException.Message.Contains("[Arg_ArgumentOutOfRangeException]")))
{
TestLibrary.TestFramework.LogError("001", "The result is not the value as expected");
@@ -61,7 +61,7 @@ public class ArgumentOutOfRangeExceptionMessage
string randValue = TestLibrary.Generator.GetString(-55, false, c_MIN_STRING_LENGTH, c_MAX_STRING_LENGTH);
string paramName = TestLibrary.Generator.GetString(-55, false, c_MIN_STRING_LENGTH, c_MAX_STRING_LENGTH);
ArgumentOutOfRangeException argumentOutOfRangeException = new ArgumentOutOfRangeException(paramName, randValue);
- if ((argumentOutOfRangeException.Message != randValue + "" + TestLibrary.Env.NewLine + "Parameter name: " + paramName) &
+ if ((argumentOutOfRangeException.Message != randValue + "" + Environment.NewLine + "Parameter name: " + paramName) &
(argumentOutOfRangeException.Message != randValue))
{
TestLibrary.TestFramework.LogError("003", "The result is not the value as expected");
@@ -88,7 +88,7 @@ public class ArgumentOutOfRangeExceptionMessage
string paramName = TestLibrary.Generator.GetString(-55, false, c_MIN_STRING_LENGTH, c_MAX_STRING_LENGTH);
string Value = null;
ArgumentOutOfRangeException argumentOutOfRangeException = new ArgumentOutOfRangeException(paramName, Value);
- if ((argumentOutOfRangeException.Message != "Exception of type 'System.ArgumentOutOfRangeException' was thrown." + TestLibrary.Env.NewLine + "Parameter name: " + paramName) &
+ if ((argumentOutOfRangeException.Message != "Exception of type 'System.ArgumentOutOfRangeException' was thrown." + Environment.NewLine + "Parameter name: " + paramName) &
(argumentOutOfRangeException.Message != "Exception of type 'System.ArgumentOutOfRangeException' was thrown."))
{
TestLibrary.TestFramework.LogError("005", "The result is not the value as expected");
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathaltdirectoryseparatorchar.cs b/tests/src/CoreMangLib/cti/system/io/path/pathaltdirectoryseparatorchar.cs
index 8db8ac580e..e75d80f03f 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathaltdirectoryseparatorchar.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathaltdirectoryseparatorchar.cs
@@ -45,7 +45,7 @@ public class PathAltDirectorySeparatorChar
const string c_TEST_DESC = "PosTest1: Verify the Path.AltDirectorySeparatorChar value is '/' ";
const string c_TEST_ID = "P001";
- char correctChar = Env.AltFileSeperator[0];
+ char correctChar = Utilities.IsWindows ? '/' : '/';
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathcombine.cs b/tests/src/CoreMangLib/cti/system/io/path/pathcombine.cs
index 2bcc905f99..d5afdad80e 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathcombine.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathcombine.cs
@@ -10,6 +10,7 @@ using TestLibrary;
/// </summary>
public class PathCombine
{
+ char fileSeperator = Utilities.IsWindows ? '\\' : '/';
public static int Main()
{
@@ -59,9 +60,9 @@ public class PathCombine
const string c_TEST_DESC = "PosTest1: Verify Combine two paths . ";
const string c_TEST_ID = "P001";
- string path1 = @"mydir" + Env.FileSeperator + "myfolder" + Env.FileSeperator + "";
- string path2 = @"youfolder" + Env.FileSeperator + "youfile";
- string resPath = @"mydir" + Env.FileSeperator + "myfolder" + Env.FileSeperator + "youfolder" + Env.FileSeperator + "youfile";
+ string path1 = @"mydir" + fileSeperator + "myfolder" + fileSeperator + "";
+ string path2 = @"youfolder" + fileSeperator + "youfile";
+ string resPath = @"mydir" + fileSeperator + "myfolder" + fileSeperator + "youfolder" + fileSeperator + "youfile";
string newPath ;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
@@ -93,9 +94,9 @@ public class PathCombine
const string c_TEST_DESC = "PosTest2: path1 does not end with a valid separator character. ";
const string c_TEST_ID = "P002";
- string path1 = @"mydir" + Env.FileSeperator + "myfolder";
- string path2 = @"youfolder" + Env.FileSeperator + "youfile";
- string resPath = @"mydir" + Env.FileSeperator + "myfolder" + Env.FileSeperator + "youfolder" + Env.FileSeperator + "youfile";
+ string path1 = @"mydir" + fileSeperator + "myfolder";
+ string path2 = @"youfolder" + fileSeperator + "youfile";
+ string resPath = @"mydir" + fileSeperator + "myfolder" + fileSeperator + "youfolder" + fileSeperator + "youfile";
string newPath;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
@@ -128,8 +129,8 @@ public class PathCombine
const string c_TEST_ID = "P003";
string path1 = "";
- string path2 = @"yourfolder" + Env.FileSeperator + "" + Env.FileSeperator + "youfile";
- string resPath = @"yourfolder" + Env.FileSeperator + "" + Env.FileSeperator + "youfile";
+ string path2 = @"yourfolder" + fileSeperator + "" + fileSeperator + "youfile";
+ string resPath = @"yourfolder" + fileSeperator + "" + fileSeperator + "youfile";
string newPath;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
@@ -229,9 +230,9 @@ public class PathCombine
const string c_TEST_DESC = "PosTest6: path2 have a willcard";
const string c_TEST_ID = "P006";
- string path1 = "mydir" + Env.FileSeperator + "my folder";
+ string path1 = "mydir" + fileSeperator + "my folder";
string path2 = "*.txt";
- string resPath = "mydir" + Env.FileSeperator + "my folder" + Env.FileSeperator + "*.txt";
+ string resPath = "mydir" + fileSeperator + "my folder" + fileSeperator + "*.txt";
string newPath;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathdirectoryseparatorchar.cs b/tests/src/CoreMangLib/cti/system/io/path/pathdirectoryseparatorchar.cs
index f1b92b2f0d..2c94db7087 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathdirectoryseparatorchar.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathdirectoryseparatorchar.cs
@@ -45,7 +45,7 @@ public class PathDirectorySeparatorChar
const string c_TEST_DESC = "PosTest1: Verify the Path.DirectorySeparatorChar value is backslash... ";
const string c_TEST_ID = "P001";
- char correctChar = Env.FileSeperator[0];
+ char correctChar = Utilities.IsWindows ? '\\' : '/';
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathgetdirectoryname.cs b/tests/src/CoreMangLib/cti/system/io/path/pathgetdirectoryname.cs
index 9ad31c2770..5ce9d9b546 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathgetdirectoryname.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathgetdirectoryname.cs
@@ -9,6 +9,7 @@ using TestLibrary;
public class PathGetDirectoryName
{
private const int c_MAX_PATH_LEN = 256;
+ char fileSeperator = Utilities.IsWindows ? '\\' : '/';
public static int Main()
{
@@ -54,8 +55,8 @@ public class PathGetDirectoryName
const string c_TEST_DESC = "PosTest1:the source path is a file name.";
const string c_TEST_ID = "P001";
- string sourcePath = @"C:" + Env.FileSeperator + "mydir" + Env.FileSeperator + "myfolder" + Env.FileSeperator + "test.txt";
- string directoryName = @"C:" + Env.FileSeperator + "mydir" + Env.FileSeperator + "myfolder";
+ string sourcePath = @"C:" + fileSeperator + "mydir" + fileSeperator + "myfolder" + fileSeperator + "test.txt";
+ string directoryName = @"C:" + fileSeperator + "mydir" + fileSeperator + "myfolder";
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathpathseparator.cs b/tests/src/CoreMangLib/cti/system/io/path/pathpathseparator.cs
index 3772d679eb..94bf9e00cf 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathpathseparator.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathpathseparator.cs
@@ -45,7 +45,7 @@ public class PathPathSeparator
const string c_TEST_DESC = "PosTest1: Verify the Path.PathSeparator value is semicolon ... ";
const string c_TEST_ID = "P001";
- char correctChar = Env.PathDelimiter[0];
+ char correctChar = Utilities.IsWindows ? ';' : ':';
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/io/path/pathvolumeseparatorchar.cs b/tests/src/CoreMangLib/cti/system/io/path/pathvolumeseparatorchar.cs
index dd348a7175..a2be8259e8 100644
--- a/tests/src/CoreMangLib/cti/system/io/path/pathvolumeseparatorchar.cs
+++ b/tests/src/CoreMangLib/cti/system/io/path/pathvolumeseparatorchar.cs
@@ -45,7 +45,7 @@ public class PathVolumeSeparatorChar
const string c_TEST_DESC = "PosTest1: Verify the Path.VolumeSeparatorChar value is colon ... ";
const string c_TEST_ID = "P001";
- char correctChar = Env.VolumeSeperator[0];
+ char correctChar = Utilities.IsWindows ? ':' : '/';
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
diff --git a/tests/src/CoreMangLib/cti/system/objectdisposedexception/objectdisposedexceptionmessage.cs b/tests/src/CoreMangLib/cti/system/objectdisposedexception/objectdisposedexceptionmessage.cs
index 948e96edbe..bb0d126945 100644
--- a/tests/src/CoreMangLib/cti/system/objectdisposedexception/objectdisposedexceptionmessage.cs
+++ b/tests/src/CoreMangLib/cti/system/objectdisposedexception/objectdisposedexceptionmessage.cs
@@ -43,9 +43,9 @@ public class ObjectDisposedExceptionMessage
if (index == -1)
{
string errorDesc = "Message shoule contains the object name";
- errorDesc += TestLibrary.Env.NewLine + "objectName is " + name;
- errorDesc += TestLibrary.Env.NewLine + "message is " + message;
- errorDesc += TestLibrary.Env.NewLine + "exception's message is " + exception.Message;
+ errorDesc += Environment.NewLine + "objectName is " + name;
+ errorDesc += Environment.NewLine + "message is " + message;
+ errorDesc += Environment.NewLine + "exception's message is " + exception.Message;
TestLibrary.TestFramework.LogError("001 " + "TestID_" + c_TEST_ID, errorDesc);
retVal = false;
}
@@ -53,9 +53,9 @@ public class ObjectDisposedExceptionMessage
if (index == -1)
{
string errorDesc = "Message shoule contains the message";
- errorDesc += TestLibrary.Env.NewLine + "objectName is " + name;
- errorDesc += TestLibrary.Env.NewLine + "message is " + message;
- errorDesc += TestLibrary.Env.NewLine + "exception's message is " + exception.Message;
+ errorDesc += Environment.NewLine + "objectName is " + name;
+ errorDesc += Environment.NewLine + "message is " + message;
+ errorDesc += Environment.NewLine + "exception's message is " + exception.Message;
TestLibrary.TestFramework.LogError("001 " + "TestID_" + c_TEST_ID, errorDesc);
retVal = false;
}
@@ -92,9 +92,9 @@ public class ObjectDisposedExceptionMessage
if (index == -1)
{
string errorDesc = "Message shoule contains the message";
- errorDesc += TestLibrary.Env.NewLine + "objectName is empty";
- errorDesc += TestLibrary.Env.NewLine + "message parameter" + message;
- errorDesc += TestLibrary.Env.NewLine + "exception's message is " + exception.Message;
+ errorDesc += Environment.NewLine + "objectName is empty";
+ errorDesc += Environment.NewLine + "message parameter" + message;
+ errorDesc += Environment.NewLine + "exception's message is " + exception.Message;
TestLibrary.TestFramework.LogError("003 " + "TestID_" + c_TEST_ID, errorDesc);
retVal = false;
}
diff --git a/tests/src/CoreMangLib/cti/system/runtime/compilerservices/internalsvisibletoattribute/internalsvisibletoattributeassemblyname.cs b/tests/src/CoreMangLib/cti/system/runtime/compilerservices/internalsvisibletoattribute/internalsvisibletoattributeassemblyname.cs
index c7d253f802..49cb5bcdba 100644
--- a/tests/src/CoreMangLib/cti/system/runtime/compilerservices/internalsvisibletoattribute/internalsvisibletoattributeassemblyname.cs
+++ b/tests/src/CoreMangLib/cti/system/runtime/compilerservices/internalsvisibletoattribute/internalsvisibletoattributeassemblyname.cs
@@ -151,7 +151,7 @@ public class InternalsVisibleToAttributeAssemblyName
string assemblyName;
string actualFriendAssemblyName;
- assemblyName = "::B:" + TestLibrary.Env.FileSeperator + "\n\v\r\t\0myTestCase.dll";
+ assemblyName = "::B:" + System.IO.Path.DirectorySeparatorChar + "\n\v\r\t\0myTestCase.dll";
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
try
{
diff --git a/tests/src/JIT/Directed/intrinsic/pow/pow1.cs b/tests/src/JIT/Directed/intrinsic/pow/pow1.cs
index ef7cfd4aae..faf4bcf5a3 100644
--- a/tests/src/JIT/Directed/intrinsic/pow/pow1.cs
+++ b/tests/src/JIT/Directed/intrinsic/pow/pow1.cs
@@ -18,11 +18,7 @@ internal class pow1
string processorArchEnvVar = null;
-#if CORECLR
- processorArchEnvVar = TestLibrary.Env.GetEnvVariable("PROCESSOR_ARCHITECTURE");
-#else
processorArchEnvVar = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
-#endif
if ((processorArchEnvVar != null) && processorArchEnvVar.Equals("ARM", StringComparison.CurrentCultureIgnoreCase))
{
diff --git a/tests/src/baseservices/exceptions/unittests/trace.cs b/tests/src/baseservices/exceptions/unittests/trace.cs
index 43ca62aa1d..d001f762be 100644
--- a/tests/src/baseservices/exceptions/unittests/trace.cs
+++ b/tests/src/baseservices/exceptions/unittests/trace.cs
@@ -24,7 +24,7 @@ public class Trace
public void WriteLine(string str)
{
_actual += str;
- _actual += Env.NewLine;
+ _actual += Environment.NewLine;
// Console.WriteLine(str);
}