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 IF "%SKIP_KRE_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\kvm upgrade -svr50 -x86 CALL packages\KoreBuild\build\kvm upgrade -svr50 -x86
CALL packages\KoreBuild\build\kvm install default -svrc50 -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 :run
CALL packages\KoreBuild\build\kvm use default -svr50 -x86 CALL packages\KoreBuild\build\kvm use default -svr50 -x86

View File

@ -24,6 +24,11 @@ namespace MusicStore
configuration.AddJsonFile("LocalConfig.json"); configuration.AddJsonFile("LocalConfig.json");
configuration.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. 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 => app.UseServices(services =>
{ {
//If this type is present - we're on mono //If this type is present - we're on mono
@ -66,11 +71,6 @@ namespace MusicStore
services.AddMvc(); 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 // Add static files to the request pipeline
app.UseStaticFiles(); app.UseStaticFiles();

View File

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

View File

@ -29,10 +29,11 @@
<Compile Include="DeploymentUtility.cs" /> <Compile Include="DeploymentUtility.cs" />
<Compile Include="DbUtils.cs" /> <Compile Include="DbUtils.cs" />
<Compile Include="Extensions.cs" /> <Compile Include="Extensions.cs" />
<Compile Include="KreArchitecture.cs" />
<Compile Include="ServerType.cs" /> <Compile Include="ServerType.cs" />
<Compile Include="HtmlDOMHelper.cs" /> <Compile Include="HtmlDOMHelper.cs" />
<Compile Include="KreFlavor.cs" /> <Compile Include="KreFlavor.cs" />
<Compile Include="SmokeTests.cs" /> <Compile Include="SmokeTests.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <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; private HttpClientHandler httpClientHandler;
[Theory] [Theory]
[InlineData(ServerType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")] [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, "http://localhost:5002/")] [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, "http://localhost:5004/")] [InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/")]
[InlineData(ServerType.Helios, KreFlavor.CoreClr, "http://localhost:5001/")] [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/")]
[InlineData(ServerType.WebListener, KreFlavor.CoreClr, "http://localhost:5002/")] [InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, "http://localhost:5004/")] [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5004/")]
public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, string applicationBaseUrl) [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 testStartTime = DateTime.Now;
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
@ -40,7 +54,7 @@ namespace E2ETests
try try
{ {
hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, musicStoreDbName); hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, architecture, musicStoreDbName);
httpClientHandler = new HttpClientHandler(); httpClientHandler = new HttpClientHandler();
httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) };