From 6fb56ccdad78f54bc8dcd298e036d144b02b7f1a Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 12:00:39 -0700 Subject: [PATCH 1/8] Added support for kre architecture --- test/E2ETests/DeploymentUtility.cs | 18 +++++++++++------- test/E2ETests/E2ETests.kproj | 3 ++- test/E2ETests/KreArchitecture.cs | 8 ++++++++ test/E2ETests/SmokeTests.cs | 17 +++++++++-------- 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 test/E2ETests/KreArchitecture.cs diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index c954f38305..cd871ee2a4 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -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; @@ -48,11 +49,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); @@ -111,15 +112,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); diff --git a/test/E2ETests/E2ETests.kproj b/test/E2ETests/E2ETests.kproj index 0ca3bfdf03..ad0e1100e6 100644 --- a/test/E2ETests/E2ETests.kproj +++ b/test/E2ETests/E2ETests.kproj @@ -29,10 +29,11 @@ + - + \ No newline at end of file diff --git a/test/E2ETests/KreArchitecture.cs b/test/E2ETests/KreArchitecture.cs new file mode 100644 index 0000000000..e12d87eb1c --- /dev/null +++ b/test/E2ETests/KreArchitecture.cs @@ -0,0 +1,8 @@ +namespace E2ETests +{ + public enum KreArchitecture + { + x64, + x86 + } +} \ No newline at end of file diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index 07390d531c..c42156ba3b 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -16,13 +16,14 @@ 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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "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/")] + public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, applicationBaseUrl = {2}", hostType, kreFlavor, applicationBaseUrl); @@ -40,7 +41,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) }; From c74bb9258a76535e6d5789bbebca160f00b23c2e Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 14:38:34 -0700 Subject: [PATCH 2/8] Handled starting IISExpress based on architecture --- build.cmd | 4 ++++ src/MusicStore/Startup.cs | 10 +++++----- test/E2ETests/DeploymentUtility.cs | 24 ++++++++++++++---------- test/E2ETests/SmokeTests.cs | 16 +++++++++++++--- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/build.cmd b/build.cmd index 3aaf957583..91d1f7b0a4 100644 --- a/build.cmd +++ b/build.cmd @@ -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 EXIST "%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 diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index f8c63f3360..39c30f6add 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -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(); diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index cd871ee2a4..7f1601d068 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -11,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; @@ -61,7 +65,7 @@ namespace E2ETests if (hostType == ServerType.Helios) { - hostProcess = StartHeliosHost(applicationPath); + hostProcess = StartHeliosHost(applicationPath, kreArchitecture); } else { @@ -73,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 diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index c42156ba3b..45689f53b4 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -16,16 +16,26 @@ namespace E2ETests private HttpClientHandler httpClientHandler; [Theory] - [InlineData(ServerType.Helios, KreFlavor.DesktopClr,KreArchitecture.x86, "http://localhost:5001/")] - [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] + [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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] + [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x64, "http://localhost:5002/")] + [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); From fb32578f372634c8291d3d59c629af285441d400 Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 14:40:44 -0700 Subject: [PATCH 3/8] Fixed check to install x64 KRE --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index 91d1f7b0a4..fc46f01044 100644 --- a/build.cmd +++ b/build.cmd @@ -22,7 +22,7 @@ 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 EXIST "%Processor_Architecture%" == "AMD64"( +IF "%Processor_Architecture%" == "AMD64"( CALL packages\KoreBuild\build\kvm install default -svr50 -x64 CALL packages\KoreBuild\build\kvm install default -svrc50 -x64 ) From c391427f65e7ae8520870f093783c3f604454551 Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 15:29:38 -0700 Subject: [PATCH 4/8] Formatted document and added bug numbers --- test/E2ETests/DeploymentUtility.cs | 6 +++--- test/E2ETests/SmokeTests.cs | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index 7f1601d068..63f1538f5c 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -17,7 +17,7 @@ namespace E2ETests var iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IIS Express", "iisexpress.exe"); // Get path to 64 bit of IIS Express - if(architecture == KreArchitecture.x64) + if (architecture == KreArchitecture.x64) { iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "IIS Express", "iisexpress.exe"); @@ -57,7 +57,7 @@ namespace E2ETests { 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,kreArchitecture)); + 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); @@ -116,7 +116,7 @@ namespace E2ETests return hostProcess; } - private static string SwitchPathToKreFlavor(KreFlavor kreFlavor,KreArchitecture kreArchitecture) + private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture kreArchitecture) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index 45689f53b4..fc8dbbd598 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -22,9 +22,12 @@ namespace E2ETests [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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x64, "http://localhost:5002/")] - [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5004/")] + // 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}, Architecture = {2}, applicationBaseUrl = {3}", hostType, kreFlavor, architecture, applicationBaseUrl); @@ -32,9 +35,9 @@ namespace E2ETests // 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; + Console.WriteLine("Skipping x64 test since machine is of type x86"); + Assert.True(true); + return; } var testStartTime = DateTime.Now; From 759eee9734f1419ed0d696beaba551b0942ed5f8 Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 12:00:39 -0700 Subject: [PATCH 5/8] Added support for kre architecture --- test/E2ETests/DeploymentUtility.cs | 18 +++++++++++------- test/E2ETests/E2ETests.kproj | 3 ++- test/E2ETests/KreArchitecture.cs | 8 ++++++++ test/E2ETests/SmokeTests.cs | 17 +++++++++-------- 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 test/E2ETests/KreArchitecture.cs diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index c954f38305..cd871ee2a4 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -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; @@ -48,11 +49,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); @@ -111,15 +112,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); diff --git a/test/E2ETests/E2ETests.kproj b/test/E2ETests/E2ETests.kproj index 0ca3bfdf03..ad0e1100e6 100644 --- a/test/E2ETests/E2ETests.kproj +++ b/test/E2ETests/E2ETests.kproj @@ -29,10 +29,11 @@ + - + \ No newline at end of file diff --git a/test/E2ETests/KreArchitecture.cs b/test/E2ETests/KreArchitecture.cs new file mode 100644 index 0000000000..e12d87eb1c --- /dev/null +++ b/test/E2ETests/KreArchitecture.cs @@ -0,0 +1,8 @@ +namespace E2ETests +{ + public enum KreArchitecture + { + x64, + x86 + } +} \ No newline at end of file diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index 07390d531c..c42156ba3b 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -16,13 +16,14 @@ 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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "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/")] + public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, applicationBaseUrl = {2}", hostType, kreFlavor, applicationBaseUrl); @@ -40,7 +41,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) }; From 77a9885118c07fb0f2f9c0480595adda947cf105 Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 14:38:34 -0700 Subject: [PATCH 6/8] Handled starting IISExpress based on architecture --- build.cmd | 4 ++++ src/MusicStore/Startup.cs | 10 +++++----- test/E2ETests/DeploymentUtility.cs | 24 ++++++++++++++---------- test/E2ETests/SmokeTests.cs | 16 +++++++++++++--- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/build.cmd b/build.cmd index 3aaf957583..91d1f7b0a4 100644 --- a/build.cmd +++ b/build.cmd @@ -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 EXIST "%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 diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index f8c63f3360..39c30f6add 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -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(); diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index cd871ee2a4..7f1601d068 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -11,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; @@ -61,7 +65,7 @@ namespace E2ETests if (hostType == ServerType.Helios) { - hostProcess = StartHeliosHost(applicationPath); + hostProcess = StartHeliosHost(applicationPath, kreArchitecture); } else { @@ -73,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 diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index c42156ba3b..45689f53b4 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -16,16 +16,26 @@ namespace E2ETests private HttpClientHandler httpClientHandler; [Theory] - [InlineData(ServerType.Helios, KreFlavor.DesktopClr,KreArchitecture.x86, "http://localhost:5001/")] - [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] + [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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] + [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x64, "http://localhost:5002/")] + [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); From d1f5802c875c83627a34ea56c6d99f9054b494bf Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 14:40:44 -0700 Subject: [PATCH 7/8] Fixed check to install x64 KRE --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index 91d1f7b0a4..fc46f01044 100644 --- a/build.cmd +++ b/build.cmd @@ -22,7 +22,7 @@ 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 EXIST "%Processor_Architecture%" == "AMD64"( +IF "%Processor_Architecture%" == "AMD64"( CALL packages\KoreBuild\build\kvm install default -svr50 -x64 CALL packages\KoreBuild\build\kvm install default -svrc50 -x64 ) From ae7fae0bce61b23f7e62b34eaacc1ce040946bc4 Mon Sep 17 00:00:00 2001 From: Suhas Joshi Date: Thu, 24 Jul 2014 15:29:38 -0700 Subject: [PATCH 8/8] Formatted document and added bug numbers --- test/E2ETests/DeploymentUtility.cs | 6 +++--- test/E2ETests/SmokeTests.cs | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index 7f1601d068..63f1538f5c 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -17,7 +17,7 @@ namespace E2ETests var iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IIS Express", "iisexpress.exe"); // Get path to 64 bit of IIS Express - if(architecture == KreArchitecture.x64) + if (architecture == KreArchitecture.x64) { iisExpressPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "IIS Express", "iisexpress.exe"); @@ -57,7 +57,7 @@ namespace E2ETests { 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,kreArchitecture)); + 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); @@ -116,7 +116,7 @@ namespace E2ETests return hostProcess; } - private static string SwitchPathToKreFlavor(KreFlavor kreFlavor,KreArchitecture kreArchitecture) + private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture kreArchitecture) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index 45689f53b4..fc8dbbd598 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -22,9 +22,12 @@ namespace E2ETests [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.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x64, "http://localhost:5002/")] - [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5004/")] + // 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}, Architecture = {2}, applicationBaseUrl = {3}", hostType, kreFlavor, architecture, applicationBaseUrl); @@ -32,9 +35,9 @@ namespace E2ETests // 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; + Console.WriteLine("Skipping x64 test since machine is of type x86"); + Assert.True(true); + return; } var testStartTime = DateTime.Now;