Change tests to not modify Core_Root (#23470)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Tue, 2 Apr 2019 23:39:11 +0000 (16:39 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Apr 2019 23:39:11 +0000 (16:39 -0700)
commit2516a53b75ef74b585cc507e07d39e37675993b9
tree4d49073d0ee1453f3e49f91413c18e5d486bbae9
parentf036d2339b030258bf31bc73ebc23f553744fa04
Change tests to not modify Core_Root (#23470)

Redesign tests that needed to modify Core_Root to no longer do so.

- Loader.FromNativePaths: Use `CORE_LIBRARIES` instead of `COREROOT`
- Loader.AssemblyDependencyResolver: Split out the invalid hosting test that needs hostpolicy to not be preloaded. Have `CoreRun` and `CoreShim` preload hostpolicy when a path to a hostpolicy is specified in the `MOCK_HOSTPOLICY` environment variable.
- Add a `CLRTest.MockHosting.targets` file that is imported when a test requires hostpolicy. It adds the reference to the mock hostpolicy and ensures that the `MOCK_HOSTPOLICY` environment variable is correctly set in the test scripts.

Fixes #23429.
22 files changed:
src/coreclr/hosts/corerun/corerun.cpp
src/coreclr/hosts/coreshim/CoreShim.cpp
src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
tests/src/CLRTest.Execute.Bash.targets
tests/src/CLRTest.Execute.targets
tests/src/CLRTest.MockHosting.targets [new file with mode: 0644]
tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs
tests/src/Interop/COM/Activator/Activator.csproj
tests/src/Interop/COM/NativeClients/DefaultInterfaces.csproj
tests/src/Interop/COM/NativeClients/Licensing.csproj
tests/src/Interop/COM/NativeClients/Primitives.csproj
tests/src/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.csproj
tests/src/Interop/Interop.settings.targets
tests/src/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs [moved from tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs with 97% similarity]
tests/src/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj [moved from tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj with 70% similarity]
tests/src/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs [moved from tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs with 100% similarity]
tests/src/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/TestBase.cs [moved from tests/src/Loader/AssemblyDependencyResolverTests/TestBase.cs with 100% similarity]
tests/src/Loader/AssemblyDependencyResolver/MissingHostPolicyTests/InvalidHostingTest.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolver/MissingHostPolicyTests/MissingHostPolicyTests.csproj [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs [deleted file]
tests/src/Loader/NativeLibs/FromNativePaths.cs
tests/src/Loader/NativeLibs/FromNativePaths.csproj