Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2020-02-06 12:57:51 +0300
committerGitHub <noreply@github.com>2020-02-06 12:57:51 +0300
commitec876591ca3102629400e2ec912c5a958516967e (patch)
treeb533cc09045c6eeb02c66e68481c689cbe93b5e8 /test/Mono.Linker.Tests
parentbc937463aeb42db2d541135a71e29fdf301ac355 (diff)
Run illink tests on CI (#937)
* Set ILLink.Tasks.Tests to be test project * Unconditionally use arcade * Fix ILLink.Tasks test project - Renamed to ILLink.Tasks.IntegrationTests because it depends on the .nupkg and arcade schedules Test projects before Pack - Fixed path to nupgk in nuget config - Move override of Test target for NUnit project from root Directory.Build.targets. For some reason Condition doesn't work there so the target would always be overriden. - Disabled MusicStore tests They were already disabled in https://github.com/mono/linker/commit/04eb53822f98749bdf6ab47009ba7c269f504eae because of https://github.com/mono/linker/commit/04eb53822f98749bdf6ab47009ba7c269f504eae but looks like that got reverted somehow * Make arcade enabled builds the default and remove special illink_ configs Mono builds can be done with /p:MonoBuild=true * Remove .net framework targets from netcore build * Update ILLink.Tasks to netcore3.0 * Fix netcore condition * More netcore3.0 updates * Try to mimic weird arcade behaviour * Enable test results publishing in arcade * Remove DisableArcadeImport property and use temp folder for ILLink.Tasks test projects instead * Fix net471 build on Unix * Use a temp folder in the repo and write empty Directory.Build.props/targets instead This works better with arcade temp folder overrides. * Revert "Try to mimic weird arcade behaviour" This reverts commit 3923c5410bf2d17073373924dc53020c91fea346. * Force always downloading a local dotnet We need this for the ILLink.Tasks tests. Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Diffstat (limited to 'test/Mono.Linker.Tests')
-rw-r--r--test/Mono.Linker.Tests/Mono.Linker.Tests.csproj38
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestDatabase.cs17
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs7
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;