Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Change ReadOnlySpan indexer to return ref readonly #14727

Merged
merged 6 commits into from
Dec 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove debug statements.
  • Loading branch information
ahsonkhan committed Dec 15, 2017
commit 7198b344f571f49d5c02a1344e40d99e78fdf271
48 changes: 10 additions & 38 deletions tests/src/JIT/superpmi/superpmicollect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,32 +166,26 @@ private static int RunProgram(string program, string arguments)
// under the appropriate shell.
if (Global.IsWindows)
{
Console.WriteLine("================AD==========");
if ((program.LastIndexOf(".bat") != -1) || (program.LastIndexOf(".cmd") != -1))
{
Console.WriteLine("================AG==========");
string programArgumentSep = String.IsNullOrEmpty(arguments) ? "" : " ";
arguments = "/c " + program + programArgumentSep + arguments;
program = Environment.GetEnvironmentVariable("ComSpec"); // path to CMD.exe
}
}
else
{
Console.WriteLine("================AE==========");
if (program.LastIndexOf(".sh") != -1)
{
Console.WriteLine("================AF==========");
string programArgumentSep = String.IsNullOrEmpty(arguments) ? "" : " ";
arguments = "bash " + program + programArgumentSep + arguments;
program = "/usr/bin/env";
}
}
Console.WriteLine("================AA==========");

Console.WriteLine("Running: " + program + " " + arguments);
Process p = Process.Start(program, arguments);
Console.WriteLine("================AB==========" + program + " : " + arguments);
p.WaitForExit();
Console.WriteLine("================AC========== " + p.ExitCode);
return p.ExitCode;
}

Expand All @@ -205,20 +199,17 @@ private static void RunTest(string testName)

if (Global.IsWindows)
{
Console.WriteLine("================O==========");
int lastIndex = testName.LastIndexOf("\\");
if (lastIndex == -1)
{
Console.WriteLine("================Q==========");
throw new SpmiException("test path doesn't have any directory separators? " + testName);
}
testDir = testName.Substring(0, lastIndex);
Console.WriteLine("================R========== " + testDir);
}
else
{
// Just in case we've been given a test name in Windows format, convert it to Unix format here.
Console.WriteLine("================P==========");

testName = testName.Replace("\\", "/");
testName = testName.Replace(".cmd", ".sh");
testName = testName.Replace(".bat", ".sh");
Expand All @@ -233,28 +224,25 @@ private static void RunTest(string testName)
RunProgram("/bin/chmod", "+x \"" + testName + "\"");

// Now, figure out how to run the test.
Console.WriteLine("================S========== " + testName);

int lastIndex = testName.LastIndexOf("/");
if (lastIndex == -1)
{
throw new SpmiException("test path doesn't have any directory separators? " + testName);
}
testDir = testName.Substring(0, lastIndex);
Console.WriteLine("================T========== " + testDir);
}

// Run the script in the same directory where the test lives.
string originalDir = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(testDir);
Console.WriteLine("================U========== " + originalDir);

try
{
Console.WriteLine("================W========== ");
RunProgram(testName, "");
}
finally
{
Console.WriteLine("================V==========");
// Restore the original current directory from before the test run.
Directory.SetCurrentDirectory(originalDir);
}
Expand Down Expand Up @@ -285,24 +273,22 @@ private static void RunTestProgramsWhileCollecting()
// Figure out the root of the test binaries directory.
// Perhaps this (or something similar) would be a better way to figure out the binary root dir:
// testBinaryRootDir = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
Console.WriteLine("================L==========");

string thisTestDir = Directory.GetCurrentDirectory();
int lastIndex = thisTestDir.LastIndexOf("JIT");
if (lastIndex == -1)
{
throw new SpmiException("we expect the current directory when the test is run to be within the JIT test binaries tree, but it is not: " + thisTestDir);
}
string testBinaryRootDir = thisTestDir.Substring(0, lastIndex);
Console.WriteLine("================M==========");

// Run the tests
foreach (string test in SuperPMICollectionTestProgramsList)
{
Console.WriteLine("================N========== " + test);
string testFullPath = Path.Combine(testBinaryRootDir, test);
try
{
RunTest(testFullPath);
Console.WriteLine("================P========== " + testFullPath);
}
catch (SpmiException ex)
{
Expand All @@ -312,7 +298,6 @@ private static void RunTestProgramsWhileCollecting()

Console.Error.WriteLine("WARNING: test failed (ignoring): " + ex.Message);
}
Console.WriteLine("================O==========");
}
}

Expand All @@ -321,13 +306,11 @@ private static void RunProgramsWhileCollecting(string runProgramPath, string run
{
if (runProgramPath == null)
{
Console.WriteLine("================J==========");
// No program was given to use for collection, so use our default set.
RunTestProgramsWhileCollecting();
}
else
{
Console.WriteLine("================K========== " + runProgramPath + " : " + runProgramArguments);
RunProgram(runProgramPath, runProgramArguments);
}
}
Expand All @@ -350,23 +333,21 @@ private static void CollectMCFiles(string runProgramPath, string runProgramArgum
Environment.SetEnvironmentVariable("SuperPMIShimPath", Global.JitPath);
Environment.SetEnvironmentVariable("COMPlus_AltJit", "*");
Environment.SetEnvironmentVariable("COMPlus_AltJitName", Global.CollectorShimName);
Console.WriteLine("================H==========");

RunProgramsWhileCollecting(runProgramPath, runProgramArguments);
Console.WriteLine("================G==========");

// Un-set environment variables
Environment.SetEnvironmentVariable("SuperPMIShimLogPath", "");
Environment.SetEnvironmentVariable("SuperPMIShimPath", "");
Environment.SetEnvironmentVariable("COMPlus_AltJit", "");
Environment.SetEnvironmentVariable("COMPlus_AltJitName", "");
Console.WriteLine("================F==========");

// Did any .mc files get generated?
string[] mcFiles = Directory.GetFiles(s_tempDir, "*.mc");
if (mcFiles.Length == 0)
{
Console.WriteLine("UH OH");
throw new SpmiException("no .mc files generated");
}
Console.WriteLine("================I==========");
}

// Merge MC files:
Expand Down Expand Up @@ -584,23 +565,14 @@ public static int Collect(string outputMchPath, string runProgramPath, string ru

try
{
Console.WriteLine("CreateTempDirectory");
CreateTempDirectory(tempPath);
Console.WriteLine("ChooseFilePaths");
ChooseFilePaths(outputMchPath);
Console.WriteLine("CollectMCFiles");
CollectMCFiles(runProgramPath, runProgramArguments);
Console.WriteLine("MergeMCFiles");
MergeMCFiles();
Console.WriteLine("CreateCleanMCHFile");
CreateCleanMCHFile();
Console.WriteLine("CreateThinUniqueMCH");
CreateThinUniqueMCH();
Console.WriteLine("CreateTOC");
CreateTOC();
Console.WriteLine("VerifyFinalMCH");
VerifyFinalMCH();
Console.WriteLine("Success");

// Success!
result = 100;
Expand Down Expand Up @@ -805,4 +777,4 @@ private static int Main(string[] args)
}
}

}
}