diff options
Diffstat (limited to 'test/Mono.Linker.Tests')
-rw-r--r-- | test/Mono.Linker.Tests/Mono.Linker.Tests.csproj | 38 | ||||
-rw-r--r-- | test/Mono.Linker.Tests/TestCases/TestDatabase.cs | 17 | ||||
-rw-r--r-- | test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs | 7 |
3 files changed, 23 insertions, 39 deletions
diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj index 3653c8e6b..236ff33ab 100644 --- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj +++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj @@ -1,26 +1,20 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project> + <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <PropertyGroup> - <IsTestProject>true</IsTestProject> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <TargetFramework>netcoreapp3.0</TargetFramework> - <ILLinkBuild>true</ILLinkBuild> <DefineConstants>$(DefineConstants);ILLINK</DefineConstants> - <DefineConstants Condition="'$(Configuration)' == 'illink_Debug'">$(DefineConstants);DEBUG</DefineConstants> + <DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants> <!-- Simulate https://github.com/dotnet/sdk/pull/2073 until it ships. --> <DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);NETCOREAPP</DefineConstants> - - <DefineConstants Condition="'$(ArcadeBuild)' == 'true'">$(DefineConstants);ARCADE</DefineConstants> - <!-- Arcade's custom test imports assume that we are using xunit. --> - <DisableArcadeTestFramework Condition="'$(ArcadeBuild)' == 'true'">true</DisableArcadeTestFramework> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <TargetFramework>net471</TargetFramework> - <ILLinkBuild>false</ILLinkBuild> </PropertyGroup> <ItemGroup> @@ -36,7 +30,7 @@ <ProjectReference Include="..\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj" /> </ItemGroup> - <ItemGroup Condition="$(ILLinkBuild)"> + <ItemGroup Condition="'$(MonoBuild)' == ''"> <PackageReference Include="System.CodeDom" Version="4.5.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" /> @@ -48,29 +42,37 @@ <PackageReference Include="System.Threading.AccessControl" Version="4.5.0" /> </ItemGroup> - <Target Name="PrepareTools" BeforeTargets="Build" Condition="$(ILLinkBuild)"> + <Target Name="PrepareTools" BeforeTargets="Build" Condition="'$(MonoBuild)' == ''"> <!-- Restore ilasm using ilasm.ilproj. Restore must be done separately from copy with a different set of input properties, to force MSBuild to re-evaluate using new props and targets from the restored package. --> <PropertyGroup> <IlasmProject>$(MSBuildThisFileDirectory)../../eng/ilasm.ilproj</IlasmProject> - <IlasmDir Condition="'$(ArcadeBuild)' == 'true'">$(ArtifactsDir)tools</IlasmDir> - <IlasmDir Condition="'$(ArcadeBuild)' != 'true'">$(MSBuildThisFileDirectory)$(BaseIntermediateOutputPath)tools</IlasmDir> + <IlasmDir>$(ArtifactsDir)tools</IlasmDir> </PropertyGroup> <MSBuild Projects="$(IlasmProject)" Targets="Restore" Properties="BaseIntermediateOutputPath=$(IlasmDir)" /> <MSBuild Projects="$(IlasmProject)" Targets="CopyILAsmTool" Properties="BaseIntermediateOutputPath=$(IlasmDir);__BuildPhase=Copy" /> </Target> - <ItemGroup Condition="!$(ILLinkBuild)"> + <ItemGroup Condition="'$(MonoBuild)' != ''"> <ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" /> <PackageReference Include="NUnit" Version="3.10.0" /> <PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" /> </ItemGroup> - <Target Name="RunTestsOnMono" Condition="!$(ILLinkBuild)"> + <Target Name="RunTestsOnMono" Condition="'$(MonoBuild)' != ''"> <Exec Command="mono $(PkgNUnit_ConsoleRunner)/tools/nunit3-console.exe --result=TestResults.xml $(OutputPath)Mono.Linker.Tests.dll" /> </Target> + <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> + + <!-- Arcade's custom test imports assume that we are using xunit. --> + <!-- Map the Arcade "Test" target to the "VSTest" target used by "dotnet test" --> + <Target Name="Test" + Condition="'$(MonoBuild)' == ''"> + <MSBuild Projects="$(MSBuildProjectFile)" Targets="VSTest" /> + </Target> + </Project> diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs index b29dd2d43..fbb516153 100644 --- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs +++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs @@ -193,19 +193,11 @@ namespace Mono.Linker.Tests.TestCases static void GetDirectoryPaths(out string rootSourceDirectory, out string testCaseAssemblyPath, [CallerFilePath] string thisFile = null) { -#if ILLINK -#if DEBUG - var configDirectoryName = "illink_Debug"; -#else - var configDirectoryName = "illink_Release"; -#endif -#else #if DEBUG var configDirectoryName = "Debug"; #else var configDirectoryName = "Release"; #endif -#endif #if NETCOREAPP3_0 var tfm = "netcoreapp3.0"; @@ -218,19 +210,12 @@ namespace Mono.Linker.Tests.TestCases #if ILLINK // Deterministic builds sanitize source paths, so CallerFilePathAttribute gives an incorrect path. // Instead, get the testcase dll based on the working directory of the test runner. -#if ARCADE + // working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm> var artifactsBinDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", ".."); rootSourceDirectory = Path.GetFullPath (Path.Combine (artifactsBinDir, "..", "..", "test", "Mono.Linker.Tests.Cases")); testCaseAssemblyPath = Path.GetFullPath (Path.Combine (artifactsBinDir, "Mono.Linker.Tests.Cases", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); #else - // working directory is test/Mono.Linker.Tests/bin/<config>/<tfm> - var testDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", ".."); - rootSourceDirectory = Path.GetFullPath (Path.Combine (testDir, "Mono.Linker.Tests.Cases")); - testCaseAssemblyPath = Path.GetFullPath (Path.Combine (rootSourceDirectory, "bin", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); -#endif // ARCADE - -#else var thisDirectory = Path.GetDirectoryName (thisFile); rootSourceDirectory = Path.GetFullPath (Path.Combine (thisDirectory, "..", "..", "Mono.Linker.Tests.Cases")); testCaseAssemblyPath = Path.GetFullPath (Path.Combine (rootSourceDirectory, "bin", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs index 14ec56d9e..a35c10787 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs @@ -68,13 +68,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { { #if ILLINK var extension = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? ".exe" : ""; -#if ARCADE + // working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm> var toolsDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "..", "tools"); -#else - // working directory is test/Mono.Linker.Tests/bin/<config>/<tfm> - var toolsDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "obj", "tools"); -#endif // ARCADE + var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, "ilasm", $"ilasm{extension}")).ToNPath (); if (ilasmPath.FileExists ()) return ilasmPath; |