Skip to content

Commit

Permalink
Fix pmi so it works properly with --altjit (dotnet#136)
Browse files Browse the repository at this point in the history
We should always be copying/restoring via the test jit name.
  • Loading branch information
AndyAyersMS authored Jun 18, 2018
1 parent f00f80e commit e9ef330
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions src/jit-diff/diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,47 +515,56 @@ protected override List<string> ConstructArgs(List<string> commandArgs, string c

void InstallBaseJit()
{
string realJitPath = Path.Combine(m_config.CoreRoot, m_defaultJitName);
string tempJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_defaultJitName);
string existingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName);
string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName);
string testJitPath = Path.Combine(m_config.BasePath, m_testJitName);
if (m_config.Verbose)
if (File.Exists(existingJitPath))
{
Console.WriteLine($"Copying default jit: {realJitPath} ==> {tempJitPath}");
if (m_config.Verbose)
{
Console.WriteLine($"Saving off existing jit: {existingJitPath} ==> {backupJitPath}");
}
File.Copy(existingJitPath, backupJitPath, true);
}
File.Copy(realJitPath, tempJitPath, true);
if (m_config.Verbose)
{
Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {realJitPath}");
Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {existingJitPath}");
}
File.Copy(testJitPath, realJitPath, true);
File.Copy(testJitPath, existingJitPath, true);
}

void InstallDiffJit()
{
string realJitPath = Path.Combine(m_config.CoreRoot, m_defaultJitName);
string tempJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_defaultJitName);
string exitingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName);
string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName);
string testJitPath = Path.Combine(m_config.DiffPath, m_testJitName);
if (m_config.Verbose)
if (File.Exists(exitingJitPath))
{
Console.WriteLine($"Copying default jit: {realJitPath} ==> {tempJitPath}");
if (m_config.Verbose)
{
Console.WriteLine($"Saving off existing jit: {exitingJitPath} ==> {backupJitPath}");
}
File.Copy(exitingJitPath, backupJitPath, true);
}
File.Copy(realJitPath, tempJitPath, true);
if (m_config.Verbose)
{
Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {realJitPath}");
Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {exitingJitPath}");
}
File.Copy(testJitPath, realJitPath, true);
File.Copy(testJitPath, exitingJitPath, true);
}

void RestoreDefaultJit()
{
string realJitPath = Path.Combine(m_config.CoreRoot, m_defaultJitName);
string tempJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_defaultJitName);
if (m_config.Verbose)
string existingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName);
string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName);
if (File.Exists(backupJitPath))
{
Console.WriteLine($"Restoring default jit: {tempJitPath} ==> {realJitPath}");
if (m_config.Verbose)
{
Console.WriteLine($"Restoring exsiting jit: {backupJitPath} ==> {existingJitPath}");
}
File.Copy(backupJitPath, existingJitPath, true);
}
File.Copy(tempJitPath, realJitPath, true);
}

// Because pmi modifies the test overlay, we can't run base and diff tasks in an interleaved manner.
Expand Down

0 comments on commit e9ef330

Please sign in to comment.