Fix EndToEnd tests for RHEL.

This commit is contained in:
Sridhar Periyasamy 2016-03-07 20:23:41 -05:00
parent c4cb1f2d53
commit 53fd607584

View file

@ -83,15 +83,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
[Fact]
public void TestDotnetBuildNativeRyuJit()
{
if(IsCentOSorRHEL())
if(!IsNativeCompilationSupported())
{
Console.WriteLine("Skipping native compilation tests on CentOS/RHEL - https://github.com/dotnet/cli/issues/453");
return;
}
if (IsWinX86())
{
Console.WriteLine("Skipping native compilation tests on Windows x86 - https://github.com/dotnet/cli/issues/1550");
return;
}
@ -105,15 +98,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
[Fact]
public void TestDotnetBuildNativeCpp()
{
if(IsCentOSorRHEL())
{
Console.WriteLine("Skipping native compilation tests on CentOS/RHEL - https://github.com/dotnet/cli/issues/453");
return;
}
if (IsWinX86())
{
Console.WriteLine("Skipping native compilation tests on Windows x86 - https://github.com/dotnet/cli/issues/1550");
if(!IsNativeCompilationSupported())
{
return;
}
@ -127,15 +113,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
[Fact]
public void TestDotnetCompileNativeCppIncremental()
{
if (IsCentOSorRHEL())
{
Console.WriteLine("Skipping native compilation tests on CentOS/RHEL - https://github.com/dotnet/cli/issues/453");
return;
}
if (IsWinX86())
{
Console.WriteLine("Skipping native compilation tests on Windows x86 - https://github.com/dotnet/cli/issues/1550");
if(!IsNativeCompilationSupported())
{
return;
}
@ -236,26 +215,26 @@ namespace Microsoft.DotNet.Tests.EndToEnd
Directory.SetCurrentDirectory(currentDirectory);
}
private bool IsCentOSorRHEL()
private bool IsNativeCompilationSupported()
{
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
bool isSupported = true;
var platform = PlatformServices.Default.Runtime.OperatingSystem.ToLower();
switch (platform)
{
const string OSIDFILE = "/etc/os-release";
if(File.Exists(OSIDFILE))
{
string osidcontent = File.ReadAllText(OSIDFILE).ToLower();
return osidcontent.Contains("centos") || osidcontent.Contains("rhel");
}
case "centos":
case "rhel":
Console.WriteLine("Skipping native compilation tests on CentOS/RHEL - https://github.com/dotnet/cli/issues/453");
isSupported = false;
break;
case "windows":
Console.WriteLine("Skipping native compilation tests on Windows x86 - https://github.com/dotnet/cli/issues/1550");
isSupported = RuntimeInformation.ProcessArchitecture != Architecture.X86;
break;
default:
break;
}
return false;
}
private bool IsWinX86()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
RuntimeInformation.ProcessArchitecture == Architecture.X86;
return isSupported;
}
private static DateTime GetLastWriteTimeUtcOfDirectoryFiles(string outputDirectory)