From 5c91dbe062f83960f0454ec385b75958f68ff9bc Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 10 Apr 2018 10:41:38 -0700 Subject: [PATCH] Get tests working --- .gitignore | 1 + IISIntegration.sln | 2 + NuGetPackageVerifier.json | 3 +- build/repo.targets | 8 ++ build/testsite.props | 9 +- .../AspNetCore/AspNetCore.vcxproj | 4 + .../AspNetCore/Inc/applicationmanager.h | 2 +- .../AspNetCore/aspnetcore_msg.rc | 2 - .../AspNetCore/aspnetcoremodule.rc | 117 ++++++++++++++++++ src/AspNetCoreModuleV1/AspNetCore/resource.h | 18 +++ .../IISLib/Debug/IISLib.log | 1 - .../OutOfProcess/HelloWorldTest.cs | 23 ++-- .../OutOfProcess/HttpsTest.cs | 63 ++++++---- .../OutOfProcess/NtlmAuthentationTest.cs | 28 +++-- 14 files changed, 231 insertions(+), 50 deletions(-) delete mode 100644 src/AspNetCoreModuleV1/AspNetCore/aspnetcore_msg.rc create mode 100644 src/AspNetCoreModuleV1/AspNetCore/aspnetcoremodule.rc create mode 100644 src/AspNetCoreModuleV1/AspNetCore/resource.h delete mode 100644 src/AspNetCoreModuleV2/IISLib/Debug/IISLib.log diff --git a/.gitignore b/.gitignore index 588d3402c3..f86f68b748 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ x64/ *.lib *.idb +src/*/AspNetCore/aspnetcoremodule.h src/*/AspNetCore/aspnetcore_msg.h src/*/AspNetCore/aspnetcore_msg.rc src/*/*/version.h diff --git a/IISIntegration.sln b/IISIntegration.sln index 2cd32d88d2..9875c3523a 100644 --- a/IISIntegration.sln +++ b/IISIntegration.sln @@ -325,6 +325,8 @@ Global {064D860B-4D7C-4B1D-918F-E020F1B99E2A} = {EF30B533-D715-421A-92B7-92FEF460AC9C} {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} = {EF30B533-D715-421A-92B7-92FEF460AC9C} {FC2A97F8-A749-4C04-97D1-97500066A820} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} + {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1} = {EF30B533-D715-421A-92B7-92FEF460AC9C} + {2AF210A9-5BDC-45E8-95DD-07B5A2616493} = {EF30B533-D715-421A-92B7-92FEF460AC9C} {16E521CE-77F1-4B1C-A183-520A41C4F372} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD} {06CA2C2B-83B0-4D83-905A-E0C74790009E} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD} {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {16E521CE-77F1-4B1C-A183-520A41C4F372} diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index ceddc22350..eea701bb65 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -2,7 +2,8 @@ "adx-nonshipping": { "rules": [], "packages": { - "Microsoft.AspNetCore.AspNetCoreModule": {} + "Microsoft.AspNetCore.AspNetCoreModule": {}, + "Microsoft.AspNetCore.AspNetCoreModuleV1": {} } }, "Default": { diff --git a/build/repo.targets b/build/repo.targets index 097a0b8e4c..ca6de98b68 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -39,6 +39,14 @@ + + NuGetPackage + Microsoft.AspNetCore.AspNetCoreModuleV1 + $(PackageVersion) + $(RepositoryRoot) + + + ZipArchive $(RepositoryRoot) diff --git a/build/testsite.props b/build/testsite.props index 6e72d7f0a2..118b1889c9 100644 --- a/build/testsite.props +++ b/build/testsite.props @@ -26,13 +26,18 @@ Set the base path to the request handler --> $(NativePlatform)\ + - + + + + + /config:"$(IISExpressAppHostConfig)" @@ -56,7 +61,7 @@ - + $(MSBuildThisFileDirectory)..\test\TestTasks\bin\$(Configuration)\$(TargetFramework)\TestTasks diff --git a/src/AspNetCoreModuleV1/AspNetCore/AspNetCore.vcxproj b/src/AspNetCoreModuleV1/AspNetCore/AspNetCore.vcxproj index 2b8e6678e0..cc87c5c618 100644 --- a/src/AspNetCoreModuleV1/AspNetCore/AspNetCore.vcxproj +++ b/src/AspNetCoreModuleV1/AspNetCore/AspNetCore.vcxproj @@ -264,8 +264,12 @@ + + + + {4787a64f-9a3e-4867-a55a-70cb4b2b2ffe} diff --git a/src/AspNetCoreModuleV1/AspNetCore/Inc/applicationmanager.h b/src/AspNetCoreModuleV1/AspNetCore/Inc/applicationmanager.h index 75df270fc1..d9e626262d 100644 --- a/src/AspNetCoreModuleV1/AspNetCore/Inc/applicationmanager.h +++ b/src/AspNetCoreModuleV1/AspNetCore/Inc/applicationmanager.h @@ -155,4 +155,4 @@ private: SRWLOCK m_srwLock; HTTP_DATA_CHUNK *m_pHttp502ErrorPage; LPSTR m_pstrErrorInfo; -}; \ No newline at end of file +}; diff --git a/src/AspNetCoreModuleV1/AspNetCore/aspnetcore_msg.rc b/src/AspNetCoreModuleV1/AspNetCore/aspnetcore_msg.rc deleted file mode 100644 index 0abcb0fa2c..0000000000 --- a/src/AspNetCoreModuleV1/AspNetCore/aspnetcore_msg.rc +++ /dev/null @@ -1,2 +0,0 @@ -LANGUAGE 0x9,0x1 -1 11 "MSG00001.bin" diff --git a/src/AspNetCoreModuleV1/AspNetCore/aspnetcoremodule.rc b/src/AspNetCoreModuleV1/AspNetCore/aspnetcoremodule.rc new file mode 100644 index 0000000000..fc9f40f623 --- /dev/null +++ b/src/AspNetCoreModuleV1/AspNetCore/aspnetcoremodule.rc @@ -0,0 +1,117 @@ +// Microsoft Visual C++ generated resource script. +// +#include +#include "version.h" +#include "resource.h" +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// 11 +// + +//1 11 +//BEGIN +// 0x0001, 0x0000, 0x03e8, 0x0000, 0x03ed, 0x0000, 0x0010, 0x0000, 0x0010, +// 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, +// 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, +// 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, +// 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, +// 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, +// 0x0000, 0x0000 +//END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION FileVersion + PRODUCTVERSION ProductVersion + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Microsoft" + VALUE "FileDescription", "IIS ASP.NET Core Module" + VALUE "FileVersion", FileVersionStr + VALUE "InternalName", "aspnetcore.dll" + VALUE "LegalCopyright", "Copyright (C) 2016" + VALUE "OriginalFilename", "aspnetcore.dll" + VALUE "ProductName", "ASP.NET Core Module" + VALUE "ProductVersion", ProductVersionStr + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_INVALID_PROPERTY "Property name '%s' in system.webServer/aspNetCore section has invalid value '%s' which does not conform to the prescribed format" + IDS_SERVER_ERROR "There was a connection error while trying to route the request." +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/src/AspNetCoreModuleV1/AspNetCore/resource.h b/src/AspNetCoreModuleV1/AspNetCore/resource.h new file mode 100644 index 0000000000..493c3e2797 --- /dev/null +++ b/src/AspNetCoreModuleV1/AspNetCore/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by aspnetcoremodule.rc +// +#define ASPNETCORE_EVENT_MSG_BUFFER_SIZE 256 +#define IDS_INVALID_PROPERTY 1000 +#define IDS_SERVER_ERROR 1001 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/AspNetCoreModuleV2/IISLib/Debug/IISLib.log b/src/AspNetCoreModuleV2/IISLib/Debug/IISLib.log deleted file mode 100644 index f33106cbee..0000000000 --- a/src/AspNetCoreModuleV2/IISLib/Debug/IISLib.log +++ /dev/null @@ -1 +0,0 @@ - IISLib.vcxproj -> C:\Users\jukotali\code\IISIntegration\Debug\IISLib.lib diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs index 19f272a491..370ce2cf63 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs @@ -19,19 +19,23 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { } - [Fact(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] - public Task HelloWorld_IISExpress_Clr_X64_Portable() + [Theory(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] + [InlineData("V1")] + [InlineData("V2")] + public Task HelloWorld_IISExpress_Clr_X64_Portable(string ancmVersion) { - return HelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable); + return HelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, ancmVersion); } - [Fact] - public Task HelloWorld_IISExpress_CoreClr_X64_Portable() + [Theory] + [InlineData("V1")] + [InlineData("V2")] + public Task HelloWorld_IISExpress_CoreClr_X64_Portable(string ancmVersion) { - return HelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable); + return HelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, ancmVersion); } - private async Task HelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType) + private async Task HelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, string ancmVersion) { var serverType = ServerType.IISExpress; var architecture = RuntimeArchitecture.x64; @@ -49,10 +53,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests ApplicationType = applicationType, Configuration = #if DEBUG - "Debug" + "Debug", #else - "Release" + "Release", #endif + AdditionalPublishParameters = $" /p:ANCMVersion={ancmVersion}" }; using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs index a91a3b78d3..0e71a21fdc 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs @@ -25,19 +25,23 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { } - [Fact(Skip = "Full framework web.config generation is currently incorrect. See: https://github.com/aspnet/websdk/pull/322")] - public Task Https_HelloWorld_CLR_X64() + [Theory(Skip = "Full framework web.config generation is currently incorrect. See: https://github.com/aspnet/websdk/pull/322")] + [InlineData("V1")] + [InlineData("V2")] + public Task Https_HelloWorld_CLR_X64(string ancmVersion) { - return HttpsHelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44396); + return HttpsHelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44396, ancmVersion); } - [Fact] - public Task Https_HelloWorld_CoreCLR_X64_Portable() + [Theory] + [InlineData("V1")] + [InlineData("V2")] + public Task Https_HelloWorld_CoreCLR_X64_Portable(string ancmVersion) { - return HttpsHelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44394); + return HttpsHelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44394, ancmVersion); } - private async Task HttpsHelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port) + private async Task HttpsHelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, string ancmVersion) { var serverType = ServerType.IISExpress; var architecture = RuntimeArchitecture.x64; @@ -58,10 +62,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests ApplicationType = applicationType, Configuration = #if DEBUG - "Debug" + "Debug", #else - "Release" + "Release", #endif + AdditionalPublishParameters = $" /p:ANCMVersion={ancmVersion}" + }; using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) @@ -93,35 +99,43 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests } } - [Fact] - public Task Https_HelloWorld_NoClientCert_CoreCLR_X64_Portable() + [Theory] + [InlineData("V1")] + [InlineData("V2")] + public Task Https_HelloWorld_NoClientCert_CoreCLR_X64_Portable(string ancmVersion) { - return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable , port: 44397, sendClientCert: false); + return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable , port: 44397, sendClientCert: false, ancmVersion); } - [Fact(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] - public Task Https_HelloWorld_NoClientCert_Clr_X64() + [Theory(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] + [InlineData("V1")] + [InlineData("V2")] + public Task Https_HelloWorld_NoClientCert_Clr_X64(string ancmVersion) { - return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44398, sendClientCert: false); + return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44398, sendClientCert: false, ancmVersion); } #pragma warning disable xUnit1004 // Test methods should not be skipped - [Fact(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")] + [Theory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")] + [InlineData("V1")] + [InlineData("V2")] #pragma warning restore xUnit1004 // Test methods should not be skipped - public Task Https_HelloWorld_ClientCert_Clr_X64() + public Task Https_HelloWorld_ClientCert_Clr_X64(string ancmVersion) { - return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44301, sendClientCert: true); + return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44301, sendClientCert: true, ancmVersion); } #pragma warning disable xUnit1004 // Test methods should not be skipped - [Fact(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")] + [Theory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")] + [InlineData("V1")] + [InlineData("V2")] #pragma warning restore xUnit1004 // Test methods should not be skipped - public Task Https_HelloWorld_ClientCert_CoreCLR_X64_Portable() + public Task Https_HelloWorld_ClientCert_CoreCLR_X64_Portable(string ancmVersion) { - return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44302, sendClientCert: true); + return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44302, sendClientCert: true, ancmVersion); } - private async Task HttpsHelloWorldCerts(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, bool sendClientCert) + private async Task HttpsHelloWorldCerts(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, bool sendClientCert, string ancmVersion) { var serverType = ServerType.IISExpress; var architecture = RuntimeArchitecture.x64; @@ -141,10 +155,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests ApplicationType = applicationType, Configuration = #if DEBUG - "Debug" + "Debug", #else - "Release" + "Release", #endif + AdditionalPublishParameters = $" /p:ANCMVersion={ancmVersion}" }; using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs index fe3b583a0f..809c213b27 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs @@ -25,19 +25,23 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { } - [Fact(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] - public Task NtlmAuthentication_Clr_X64() + [Theory(Skip = "Full framework web.config generation is currently incorrect. See https://github.com/aspnet/websdk/pull/322")] + [InlineData("V1")] + [InlineData("V2")] + public Task NtlmAuthentication_Clr_X64(string ancmVersion) { - return NtlmAuthentication(RuntimeFlavor.Clr, ApplicationType.Portable, port: 5051); + return NtlmAuthentication(RuntimeFlavor.Clr, ApplicationType.Portable, port: 5051, ancmVersion); } - [Fact] - public Task NtlmAuthentication_CoreClr_X64_Portable() + [Theory] + [InlineData("V1")] + [InlineData("V2")] + public Task NtlmAuthentication_CoreClr_X64_Portable(string ancmVersion) { - return NtlmAuthentication(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 5052); + return NtlmAuthentication(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 5052, ancmVersion); } - private async Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port) + private async Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, string ancmVersion) { var serverType = ServerType.IISExpress; var architecture = RuntimeArchitecture.x64; @@ -49,7 +53,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var windowsRid = architecture == RuntimeArchitecture.x64 ? "win7-x64" : "win7-x86"; + var additionalPublishParameters = $" /p:ANCMVersion={ancmVersion}"; + if (ApplicationType.Standalone == applicationType && RuntimeFlavor.CoreClr == runtimeFlavor) + { + additionalPublishParameters += " -r " + windowsRid; + } + var deploymentParameters = new DeploymentParameters(Helpers.GetOutOfProcessTestSitesPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = $"http://localhost:{port}", @@ -58,9 +68,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0", ApplicationType = applicationType, - AdditionalPublishParameters = ApplicationType.Standalone == applicationType && RuntimeFlavor.CoreClr == runtimeFlavor - ? "-r " + windowsRid - : null, + AdditionalPublishParameters = additionalPublishParameters, Configuration = #if DEBUG "Debug"