diff --git a/src/IISIntegration/IISIntegration.sln b/src/IISIntegration/IISIntegration.sln index 9875c3523a..50d11124bc 100644 --- a/src/IISIntegration/IISIntegration.sln +++ b/src/IISIntegration/IISIntegration.sln @@ -74,10 +74,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OverriddenServerWebSite", " {439824F9-1455-4CC4-BD79-B44FA0A16552} = {439824F9-1455-4CC4-BD79-B44FA0A16552} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLibTests", "test\CommonLibTests\CommonLibTests.vcxproj", "{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest-1.8.0\msvc\gtest.vcxproj", "{2AF210A9-5BDC-45E8-95DD-07B5A2616493}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV1", "AspNetCoreModuleV1", "{16E521CE-77F1-4B1C-A183-520A41C4F372}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV2", "AspNetCoreModuleV2", "{06CA2C2B-83B0-4D83-905A-E0C74790009E}" @@ -228,26 +224,6 @@ Global {FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.Build.0 = Release|x64 {FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.ActiveCfg = Release|x86 {FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.Build.0 = Release|x86 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.ActiveCfg = Debug|x64 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.Build.0 = Debug|x64 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x86.ActiveCfg = Debug|Win32 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x86.Build.0 = Debug|Win32 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|Any CPU.ActiveCfg = Release|Win32 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x64.ActiveCfg = Release|x64 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x64.Build.0 = Release|x64 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x86.ActiveCfg = Release|Win32 - {1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x86.Build.0 = Release|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x64.ActiveCfg = Debug|x64 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x64.Build.0 = Debug|x64 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x86.ActiveCfg = Debug|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x86.Build.0 = Debug|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|Any CPU.ActiveCfg = Release|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x64.ActiveCfg = Release|x64 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x64.Build.0 = Release|x64 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x86.ActiveCfg = Release|Win32 - {2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x86.Build.0 = Release|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Debug|x64 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Debug|x64 @@ -325,8 +301,6 @@ 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/src/IISIntegration/LICENSE.txt b/src/IISIntegration/LICENSE.txt new file mode 100644 index 0000000000..d50cef4a3f --- /dev/null +++ b/src/IISIntegration/LICENSE.txt @@ -0,0 +1,38 @@ +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. + +ASP.NET Core Module + +Copyright (c) .NET Foundation +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the ""Software""), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/src/IISIntegration/build.cmd b/src/IISIntegration/build.cmd new file mode 100644 index 0000000000..f4169ea5e4 --- /dev/null +++ b/src/IISIntegration/build.cmd @@ -0,0 +1,3 @@ +@ECHO OFF +SET RepoRoot="%~dp0..\.." +%RepoRoot%\build.cmd -LockFile %RepoRoot%\korebuild-lock.txt -Path %~dp0 %* diff --git a/src/IISIntegration/build.sh b/src/IISIntegration/build.sh new file mode 100644 index 0000000000..d5bb0cf631 --- /dev/null +++ b/src/IISIntegration/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +repo_root="$DIR/../.." +"$repo_root/build.sh" --path "$DIR" --lockfile "$repo_root/korebuild-lock.txt" "$@" diff --git a/src/IISIntegration/build/build.msbuild b/src/IISIntegration/build/build.msbuild index 55ed0be07c..117ed59bec 100644 --- a/src/IISIntegration/build/build.msbuild +++ b/src/IISIntegration/build/build.msbuild @@ -5,7 +5,6 @@ - diff --git a/src/IISIntegration/build/repo.targets b/src/IISIntegration/build/repo.targets index 97c231e7ba..c39d7367c5 100644 --- a/src/IISIntegration/build/repo.targets +++ b/src/IISIntegration/build/repo.targets @@ -3,7 +3,6 @@ BuildNativeAssets;$(CompileDependsOn) $(PackageDependsOn);PackageNativeProjects - RunNativeTest;$(TestDependsOn) $(RepositoryRoot)NuGetPackageVerifier.xplat.json @@ -26,8 +25,6 @@ Condition="'$(VisualStudioMSBuildx86Path)' != ''" /> - @@ -102,12 +99,4 @@ WorkingDirectory="$(RepositoryRoot)" /> - - - - - - - diff --git a/src/IISIntegration/test/CommonLibTests/CommonLibTests.vcxproj b/src/IISIntegration/test/CommonLibTests/CommonLibTests.vcxproj deleted file mode 100644 index c68f83af6d..0000000000 --- a/src/IISIntegration/test/CommonLibTests/CommonLibTests.vcxproj +++ /dev/null @@ -1,151 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {1eac8125-1765-4e2d-8cbe-56dc98a1c8c1} - Win32Proj - 10.0.15063.0 - Application - v141 - Unicode - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - {55494e58-e061-4c4c-a0a8-837008e72f85} - - - {09d9d1d6-2951-4e14-bc35-76a23cf9391a} - - - {2af210a9-5bdc-45e8-95dd-07b5a2616493} - - - - - - - Use - stdafx.h - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest-1.8.0\include - /D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" - - - true - Console - - - - - - - - - Use - stdafx.h - Disabled - X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest-1.8.0\include - /D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" - - - true - Console - - - - - - - - - Use - stdafx.h - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - Level3 - ProgramDatabase - $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest-1.8.0\include - /D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" - - - true - Console - true - true - - - - - - - - - Use - stdafx.h - X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - Level3 - ProgramDatabase - $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest-1.8.0\include - /D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" - - - true - Console - true - true - - - - - - - - \ No newline at end of file diff --git a/src/IISIntegration/test/CommonLibTests/NativeTests.targets b/src/IISIntegration/test/CommonLibTests/NativeTests.targets deleted file mode 100644 index f3d2caf930..0000000000 --- a/src/IISIntegration/test/CommonLibTests/NativeTests.targets +++ /dev/null @@ -1,8 +0,0 @@ - - - $(VCIDEInstallDir)..\CommonExtensions\Microsoft\TestWindow\vstest.console.exe - - - - - \ No newline at end of file diff --git a/src/IISIntegration/test/CommonLibTests/hostfxr_utility_tests.cpp b/src/IISIntegration/test/CommonLibTests/hostfxr_utility_tests.cpp deleted file mode 100644 index aacb71db56..0000000000 --- a/src/IISIntegration/test/CommonLibTests/hostfxr_utility_tests.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#include "stdafx.h" - -TEST(ParseHostFxrArguments, BasicHostFxrArguments) -{ - DWORD retVal = 0; - BSTR* bstrArray; - PCWSTR exeStr = L"C:/Program Files/dotnet.exe"; - HRESULT hr = HOSTFXR_UTILITY::ParseHostfxrArguments( - L"exec \"test.dll\"", // args - exeStr, // exe path - L"invalid", // physical path to application - NULL, // event log - &retVal, // arg count - &bstrArray); // args array. - - EXPECT_EQ(hr, S_OK); - EXPECT_EQ(DWORD(3), retVal); - ASSERT_STREQ(exeStr, bstrArray[0]); - ASSERT_STREQ(L"exec", bstrArray[1]); - ASSERT_STREQ(L"test.dll", bstrArray[2]); -} - -TEST(ParseHostFxrArguments, NoExecProvided) -{ - DWORD retVal = 0; - BSTR* bstrArray; - PCWSTR exeStr = L"C:/Program Files/dotnet.exe"; - - HRESULT hr = HOSTFXR_UTILITY::ParseHostfxrArguments( - L"test.dll", // args - exeStr, // exe path - L"ignored", // physical path to application - NULL, // event log - &retVal, // arg count - &bstrArray); // args array. - - EXPECT_EQ(hr, S_OK); - EXPECT_EQ(DWORD(2), retVal); - ASSERT_STREQ(exeStr, bstrArray[0]); - ASSERT_STREQ(L"test.dll", bstrArray[1]); -} - -TEST(ParseHostFxrArguments, ConvertDllToAbsolutePath) -{ - DWORD retVal = 0; - BSTR* bstrArray; - PCWSTR exeStr = L"C:/Program Files/dotnet.exe"; - - HRESULT hr = HOSTFXR_UTILITY::ParseHostfxrArguments( - L"exec \"test.dll\"", // args - exeStr, // exe path - L"C:/test", // physical path to application - NULL, // event log - &retVal, // arg count - &bstrArray); // args array. - - EXPECT_EQ(hr, S_OK); - EXPECT_EQ(DWORD(3), retVal); - ASSERT_STREQ(exeStr, bstrArray[0]); - ASSERT_STREQ(L"exec", bstrArray[1]); - ASSERT_STREQ(L"C:\\test\\test.dll", bstrArray[2]); -} - -TEST(ParseHostFxrArguments, ProvideNoArgs_InvalidArgs) -{ - DWORD retVal = 0; - BSTR* bstrArray; - PCWSTR exeStr = L"C:/Program Files/dotnet.exe"; - - HRESULT hr = HOSTFXR_UTILITY::ParseHostfxrArguments( - L"", // args - exeStr, // exe path - L"ignored", // physical path to application - NULL, // event log - &retVal, // arg count - &bstrArray); // args array. - - EXPECT_EQ(E_INVALIDARG, hr); -} - -TEST(GetAbsolutePathToDotnetFromProgramFiles, BackupWorks) -{ - STRU struAbsolutePathToDotnet; - HRESULT hr = S_OK; - BOOL fDotnetInProgramFiles; - BOOL is64Bit; - BOOL fIsWow64 = FALSE; - SYSTEM_INFO systemInfo; - IsWow64Process(GetCurrentProcess(), &fIsWow64); - if (fIsWow64) - { - is64Bit = FALSE; - } - else - { - GetNativeSystemInfo(&systemInfo); - is64Bit = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; - } - - if (is64Bit) - { - fDotnetInProgramFiles = UTILITY::CheckIfFileExists(L"C:/Program Files/dotnet/dotnet.exe"); - } - else - { - fDotnetInProgramFiles = UTILITY::CheckIfFileExists(L"C:/Program Files (x86)/dotnet/dotnet.exe"); - } - - hr = HOSTFXR_UTILITY::GetAbsolutePathToDotnetFromProgramFiles(&struAbsolutePathToDotnet); - if (fDotnetInProgramFiles) - { - EXPECT_EQ(hr, S_OK); - } - else - { - EXPECT_NE(hr, S_OK); - EXPECT_TRUE(struAbsolutePathToDotnet.IsEmpty()); - } -} - -TEST(GetHostFxrArguments, InvalidParams) -{ - DWORD retVal = 0; - BSTR* bstrArray; - STRU struHostFxrDllLocation; - - HRESULT hr = HOSTFXR_UTILITY::GetHostFxrParameters( - INVALID_HANDLE_VALUE, - L"bogus", // processPath - L"", // application physical path, ignored. - L"ignored", //arguments - NULL, // event log - &retVal, // arg count - &bstrArray); // args array. - - EXPECT_EQ(E_INVALIDARG, hr); -} diff --git a/src/IISIntegration/test/CommonLibTests/main.cpp b/src/IISIntegration/test/CommonLibTests/main.cpp deleted file mode 100644 index 49f150778f..0000000000 --- a/src/IISIntegration/test/CommonLibTests/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#include "stdafx.h" - -#if defined(_WIN32) -int wmain(int argc, wchar_t* argv[]) -#else -int main(int argc, char* argv[]) -#endif -{ - ::testing::InitGoogleTest(&argc, argv); - RUN_ALL_TESTS(); - return 0; -} diff --git a/src/IISIntegration/test/CommonLibTests/stdafx.cpp b/src/IISIntegration/test/CommonLibTests/stdafx.cpp deleted file mode 100644 index bd7a85614c..0000000000 --- a/src/IISIntegration/test/CommonLibTests/stdafx.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#include "stdafx.h" diff --git a/src/IISIntegration/test/CommonLibTests/stdafx.h b/src/IISIntegration/test/CommonLibTests/stdafx.h deleted file mode 100644 index e4ee515033..0000000000 --- a/src/IISIntegration/test/CommonLibTests/stdafx.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -#pragma once - -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "stringa.h" -#include "stringu.h" -#include "dbgutil.h" -#include "ahutil.h" -#include "multisz.h" -#include "multisza.h" -#include "base64.h" -#include -#include -#include -#include -#include - -#include "stringu.h" -#include "stringa.h" -#include "multisz.h" -#include "dbgutil.h" -#include "ahutil.h" -#include "hashfn.h" - -#include "hostfxr_utility.h" -#include "environmentvariablehash.h" -#include "aspnetcoreconfig.h" -#include "application.h" -#include "utility.h" -#include "debugutil.h" -#include "requesthandler.h" -#include "resources.h" -#include "aspnetcore_msg.h" - -#undef assert // Macro redefinition in IISLib. -#include "gtest\gtest.h" diff --git a/src/IISIntegration/test/CommonLibTests/utility_tests.cpp b/src/IISIntegration/test/CommonLibTests/utility_tests.cpp deleted file mode 100644 index 0632543999..0000000000 --- a/src/IISIntegration/test/CommonLibTests/utility_tests.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#include "stdafx.h" - -TEST(PassUnexpandedEnvString, ExpandsResult) -{ - HRESULT hr = S_OK; - PCWSTR unexpandedString = L"ANCM_TEST_ENV_VAR"; - PCWSTR unexpandedStringValue = L"foobar"; - STRU struExpandedString; - SetEnvironmentVariable(L"ANCM_TEST_ENV_VAR", unexpandedStringValue); - - hr = struExpandedString.CopyAndExpandEnvironmentStrings(L"%ANCM_TEST_ENV_VAR%"); - EXPECT_EQ(hr, S_OK); - EXPECT_STREQ(L"foobar", struExpandedString.QueryStr()); -} - -TEST(PassUnexpandedEnvString, LongStringExpandsResults) -{ - HRESULT hr = S_OK; - PCWSTR unexpandedString = L"ANCM_TEST_ENV_VAR_LONG"; - STRU struStringValue; - STACK_STRU(struExpandedString, MAX_PATH); - - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - struStringValue.Append(L"TestValueThatIsLongerThan256CharactersLongToTriggerResize"); - - SetEnvironmentVariable(unexpandedString, struStringValue.QueryStr()); - - hr = struExpandedString.CopyAndExpandEnvironmentStrings(L"%ANCM_TEST_ENV_VAR_LONG%"); - EXPECT_EQ(hr, S_OK); - EXPECT_EQ(struStringValue.QueryCCH(), struExpandedString.QueryCCH()); - // The values are exactly the same, however EXPECT_EQ is returning false. - //EXPECT_EQ(struStringValue.QueryStr(), struExpandedString.QueryStr()); - EXPECT_STREQ(struStringValue.QueryStr(), struExpandedString.QueryStr()); -}