summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-10-30 15:49:48 -0700
committerJan Kotas <jkotas@microsoft.com>2015-10-30 15:49:48 -0700
commit163e23a4c40923a9538459b8b353c0acdce3bd3b (patch)
tree315874313105c85a4c310a35c9ab36ae1b098caa /tests/src
parent347ab205ca8a48ef445101b7a2e1499a9f59c596 (diff)
parentc34be5c57c352ed92241433a4d7a016d2fef1e5f (diff)
downloadcoreclr-163e23a4c40923a9538459b8b353c0acdce3bd3b.tar.gz
coreclr-163e23a4c40923a9538459b8b353c0acdce3bd3b.tar.bz2
coreclr-163e23a4c40923a9538459b8b353c0acdce3bd3b.zip
Merge pull request #1883 from mono/gc-stress-tests
Make GC stress tests cross platform
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/GC/Stress/Framework/RFLogging.cs12
-rw-r--r--tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs4
-rw-r--r--tests/src/GC/Stress/Framework/ReliabilityFramework.cs8
-rw-r--r--tests/src/GC/Stress/Framework/ReliabilityTest.cs10
4 files changed, 20 insertions, 14 deletions
diff --git a/tests/src/GC/Stress/Framework/RFLogging.cs b/tests/src/GC/Stress/Framework/RFLogging.cs
index 17058c222e..b0648249c8 100644
--- a/tests/src/GC/Stress/Framework/RFLogging.cs
+++ b/tests/src/GC/Stress/Framework/RFLogging.cs
@@ -141,12 +141,15 @@ internal class RFLogging
{
try
{
- string logFilename = logDirectory + "\\instrmentation.log";
+ string logFilename = Path.Combine (logDirectory, "instrmentation.log");
while (File.Exists(logFilename))
{
- logFilename = logDirectory + "\\instrmentation.log-" + DateTime.Now.ToString().Replace('/', '-').Replace(':', '.');
+ logFilename = Path.Combine (logDirectory, "instrmentation.log-" + DateTime.Now.ToString().Replace('/', '-').Replace(':', '.'));
}
+ string logDirname = Path.GetDirectoryName (logFilename);
+ if (!Directory.Exists (logDirname))
+ Directory.CreateDirectory (logDirname);
_instrumentationLogFile = File.Open(logFilename, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
}
catch
@@ -183,7 +186,7 @@ internal class RFLogging
{
fRetry = false;
- string safeName = logDirectory + "\\" + name.Replace('\\', ' ').Replace('*', ' ').Replace('?', ' ').Replace('>', ' ').Replace('<', ' ').Replace('|', ' ').Replace(':', ' ').Replace('/', ' ').Replace('"', ' ');
+ string safeName = Path.Combine (logDirectory, name.Replace('\\', ' ').Replace('*', ' ').Replace('?', ' ').Replace('>', ' ').Replace('<', ' ').Replace('|', ' ').Replace(':', ' ').Replace('/', ' ').Replace('"', ' '));
filename = safeName + ".log";
if (File.Exists(filename))
{
@@ -191,6 +194,9 @@ internal class RFLogging
}
try
{
+ string dirname = Path.GetDirectoryName (filename);
+ if (!Directory.Exists (dirname))
+ Directory.CreateDirectory (dirname);
_logFile = File.Open(filename, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
}
catch (IOException e)
diff --git a/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs b/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
index ac71967d5f..fae4eae1c1 100644
--- a/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
+++ b/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
@@ -1004,13 +1004,13 @@ public class ReliabilityConfig : IEnumerable, IEnumerator
}
- if (basepath.LastIndexOf("\\") == (basepath.Length - 1))
+ if (basepath.LastIndexOf(Path.PathSeparator) == (basepath.Length - 1))
{
return (basepath + trimmedPath);
}
else
{
- return (basepath + "\\" + trimmedPath);
+ return Path.Combine(basepath, trimmedPath);
}
}
diff --git a/tests/src/GC/Stress/Framework/ReliabilityFramework.cs b/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
index ad931bc749..b308b220fa 100644
--- a/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
+++ b/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
@@ -40,9 +40,9 @@ internal class CustomAssemblyResolver : AssemblyLoadContext
string strBVTRoot = Environment.GetEnvironmentVariable("BVT_ROOT");
if (String.IsNullOrEmpty(strBVTRoot))
- strBVTRoot = Directory.GetCurrentDirectory() + "\\Tests";
+ strBVTRoot = Path.Combine(Directory.GetCurrentDirectory(), "Tests");
- string strPath = strBVTRoot + "\\" + assemblyName.Name + ".exe";
+ string strPath = Path.Combine(strBVTRoot, assemblyName.Name + ".exe");
Console.WriteLine("Incoming AssemblyName: {0}\n", assemblyName.ToString());
Console.WriteLine("Trying to Load: {0}\n", strPath);
@@ -636,9 +636,9 @@ public class ReliabilityFramework
if (myProcessName == null)
{
myProcessName = System.Windows.Forms.Application.ExecutablePath;
- if (myProcessName.LastIndexOf("\\") != -1)
+ if (myProcessName.LastIndexOf(Path.PathSeparator) != -1)
{
- myProcessName = myProcessName.Substring(myProcessName.LastIndexOf("\\") + 1);
+ myProcessName = myProcessName.Substring(myProcessName.LastIndexOf(Path.PathSeparator) + 1);
if (myProcessName.LastIndexOf(".") != -1)
{
myProcessName = myProcessName.Substring(0, myProcessName.LastIndexOf("."));
diff --git a/tests/src/GC/Stress/Framework/ReliabilityTest.cs b/tests/src/GC/Stress/Framework/ReliabilityTest.cs
index cc2307cb0a..a22381f6bc 100644
--- a/tests/src/GC/Stress/Framework/ReliabilityTest.cs
+++ b/tests/src/GC/Stress/Framework/ReliabilityTest.cs
@@ -285,7 +285,7 @@ public class ReliabilityTest
#if PROJECTK_BUILD
string strBVTRoot = Environment.GetEnvironmentVariable("BVT_ROOT");
if (String.IsNullOrEmpty(strBVTRoot))
- return (Directory.GetCurrentDirectory() + "\\Tests");
+ return Path.Combine(Directory.GetCurrentDirectory(), "Tests");
else
return strBVTRoot;
#else
@@ -295,9 +295,9 @@ public class ReliabilityTest
if (_basePath.Length > 0)
{
- if (_basePath[_basePath.Length - 1] != '\\')
+ if (_basePath[_basePath.Length - 1] != Path.PathSeparator)
{
- _basePath = _basePath + "\\";
+ _basePath = _basePath + Path.PathSeparator;
}
}
return (_basePath);
@@ -323,7 +323,7 @@ public class ReliabilityTest
// first, check the current directory
string curDir = Directory.GetCurrentDirectory();
string theAnswer;
- if (File.Exists(theAnswer = String.Format("{0}\\{1}", curDir, _debugger)))
+ if (File.Exists(theAnswer = Path.Combine (curDir, _debugger)))
{
return (theAnswer);
}
@@ -338,7 +338,7 @@ public class ReliabilityTest
string[] splitPath = path.Split(new char[] { ';' });
foreach (string curPath in splitPath)
{
- if (File.Exists(theAnswer = String.Format("{0}\\{1}", curPath, _debugger)))
+ if (File.Exists(theAnswer = Path.Combine (curPath, _debugger)))
{
return (theAnswer);
}