Merge pull request #178 from suhasj/AddArch

Added support for kre architecture
This commit is contained in:
Suhas Joshi 2014-07-24 15:44:39 -07:00
commit f61dd99c64
6 changed files with 67 additions and 32 deletions

View File

@ -22,6 +22,10 @@ IF EXIST packages\KoreBuild goto run
IF "%SKIP_KRE_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\kvm upgrade -svr50 -x86
CALL packages\KoreBuild\build\kvm install default -svrc50 -x86
IF "%Processor_Architecture%" == "AMD64"(
CALL packages\KoreBuild\build\kvm install default -svr50 -x64
CALL packages\KoreBuild\build\kvm install default -svrc50 -x64
)
:run
CALL packages\KoreBuild\build\kvm use default -svr50 -x86

View File

@ -24,6 +24,11 @@ namespace MusicStore
configuration.AddJsonFile("LocalConfig.json");
configuration.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
/* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
* Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
*/
app.UseErrorPage(ErrorPageOptions.ShowAll);
app.UseServices(services =>
{
//If this type is present - we're on mono
@ -66,11 +71,6 @@ namespace MusicStore
services.AddMvc();
});
/* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
* Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
*/
app.UseErrorPage(ErrorPageOptions.ShowAll);
// Add static files to the request pipeline
app.UseStaticFiles();

View File

@ -1,8 +1,9 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.Framework.Runtime;
using Microsoft.Framework.Runtime.Infrastructure;
@ -10,19 +11,23 @@ namespace E2ETests
{
internal class DeploymentUtility
{
private static string GetIISExpressPath()
private static string GetIISExpressPath(KreArchitecture architecture)
{
// Get path to program files
var iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IIS Express", "iisexpress.exe");
//If X86 version does not exist
if (!File.Exists(iisExpressPath))
// Get path to 64 bit of IIS Express
if (architecture == KreArchitecture.x64)
{
iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "IIS Express", "iisexpress.exe");
if (!File.Exists(iisExpressPath))
{
throw new Exception("Unable to find IISExpress on the machine");
}
// If process is 32 bit, the path points to x86. Replace path to point to x64
iisExpressPath = Environment.Is64BitProcess ? iisExpressPath : iisExpressPath.Replace(" (x86)", "");
}
if (!File.Exists(iisExpressPath))
{
throw new Exception("Unable to find IISExpress on the machine");
}
return iisExpressPath;
@ -48,11 +53,11 @@ namespace E2ETests
private const string APP_RELATIVE_PATH = @"..\..\src\MusicStore\";
public static Process StartApplication(ServerType hostType, KreFlavor kreFlavor, string identityDbName)
public static Process StartApplication(ServerType hostType, KreFlavor kreFlavor, KreArchitecture kreArchitecture, string identityDbName)
{
string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH));
//Tweak the %PATH% to the point to the right KREFLAVOR
Environment.SetEnvironmentVariable("PATH", SwitchPathToKreFlavor(kreFlavor));
Environment.SetEnvironmentVariable("PATH", SwitchPathToKreFlavor(kreFlavor, kreArchitecture));
var backupKreDefaultLibPath = Environment.GetEnvironmentVariable("KRE_DEFAULT_LIB");
//To avoid the KRE_DEFAULT_LIB of the test process flowing into Helios, set it to empty
Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty);
@ -60,7 +65,7 @@ namespace E2ETests
if (hostType == ServerType.Helios)
{
hostProcess = StartHeliosHost(applicationPath);
hostProcess = StartHeliosHost(applicationPath, kreArchitecture);
}
else
{
@ -72,13 +77,13 @@ namespace E2ETests
return hostProcess;
}
private static Process StartHeliosHost(string applicationPath)
private static Process StartHeliosHost(string applicationPath, KreArchitecture kreArchitecture)
{
CopyAspNetLoader(applicationPath);
var startInfo = new ProcessStartInfo
{
FileName = GetIISExpressPath(),
FileName = GetIISExpressPath(kreArchitecture),
Arguments = string.Format("/port:5001 /path:{0}", applicationPath),
UseShellExecute = true,
CreateNoWindow = true
@ -111,15 +116,18 @@ namespace E2ETests
return hostProcess;
}
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor)
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture kreArchitecture)
{
var pathValue = Environment.GetEnvironmentVariable("PATH");
Console.WriteLine();
Console.WriteLine("Current %PATH% value : {0}", pathValue);
pathValue = (kreFlavor == KreFlavor.CoreClr) ?
pathValue.Replace("KRE-svr50-", "KRE-svrc50-") :
pathValue.Replace("KRE-svrc50-", "KRE-svr50-");
StringBuilder replaceStr = new StringBuilder();
replaceStr.Append("KRE");
replaceStr.Append((kreFlavor == KreFlavor.CoreClr) ? "-svrc50" : "-svr50");
replaceStr.Append((kreArchitecture == KreArchitecture.x86) ? "-x86" : "-x64");
pathValue = Regex.Replace(pathValue, "KRE-(svr|svrc)50-(x86|x64)", replaceStr.ToString(), RegexOptions.IgnoreCase);
Console.WriteLine();
Console.WriteLine("Setting %PATH% value to : {0}", pathValue);

View File

@ -29,10 +29,11 @@
<Compile Include="DeploymentUtility.cs" />
<Compile Include="DbUtils.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="KreArchitecture.cs" />
<Compile Include="ServerType.cs" />
<Compile Include="HtmlDOMHelper.cs" />
<Compile Include="KreFlavor.cs" />
<Compile Include="SmokeTests.cs" />
</ItemGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

View File

@ -0,0 +1,8 @@
namespace E2ETests
{
public enum KreArchitecture
{
x64,
x86
}
}

View File

@ -16,15 +16,29 @@ namespace E2ETests
private HttpClientHandler httpClientHandler;
[Theory]
[InlineData(ServerType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, "http://localhost:5004/")]
[InlineData(ServerType.Helios, KreFlavor.CoreClr, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.CoreClr, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, "http://localhost:5004/")]
public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, string applicationBaseUrl)
[InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/")]
[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5004/")]
[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x64, "http://localhost:5002/")]
// Uncomment Core CLR on x64 after following bugs are resolved
// https://github.com/aspnet/Identity/issues/157
// https://github.com/aspnet/Mvc/issues/846
//[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")]
//[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5004/")]
public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl)
{
Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, applicationBaseUrl = {2}", hostType, kreFlavor, applicationBaseUrl);
Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", hostType, kreFlavor, architecture, applicationBaseUrl);
// Check if processor architecture is x64, else ship test
if (architecture == KreArchitecture.x64 && !Environment.Is64BitOperatingSystem)
{
Console.WriteLine("Skipping x64 test since machine is of type x86");
Assert.True(true);
return;
}
var testStartTime = DateTime.Now;
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
@ -40,7 +54,7 @@ namespace E2ETests
try
{
hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, musicStoreDbName);
hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, architecture, musicStoreDbName);
httpClientHandler = new HttpClientHandler();
httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) };