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
path: root/test
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
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')
-rw-r--r--test/ILLink.Tasks.IntegrationTests/CommandRunner.cs (renamed from test/ILLink.Tasks.Tests/CommandRunner.cs)0
-rw-r--r--test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs (renamed from test/ILLink.Tasks.Tests/HelloWorldTest.cs)7
-rw-r--r--test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj20
-rw-r--r--test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs (renamed from test/ILLink.Tasks.Tests/IntegrationTestBase.cs)41
-rw-r--r--test/ILLink.Tasks.IntegrationTests/Loggers.cs (renamed from test/ILLink.Tasks.Tests/Loggers.cs)0
-rwxr-xr-xtest/ILLink.Tasks.IntegrationTests/MusicStoreReflection.xml (renamed from test/ILLink.Tasks.Tests/MusicStoreReflection.xml)0
-rw-r--r--test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs (renamed from test/ILLink.Tasks.Tests/MusicStoreTest.cs)19
-rw-r--r--test/ILLink.Tasks.IntegrationTests/TestContext.cs (renamed from test/ILLink.Tasks.Tests/TestContext.cs)11
-rw-r--r--test/ILLink.Tasks.IntegrationTests/WebApiTest.cs (renamed from test/ILLink.Tasks.Tests/WebApiTest.cs)6
-rw-r--r--test/ILLink.Tasks.IntegrationTests/xunit.runner.json (renamed from test/ILLink.Tasks.Tests/xunit.runner.json)0
-rw-r--r--test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj33
-rw-r--r--test/ILLink.Tasks.Tests/nuget/NuGet.config11
-rw-r--r--test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj6
-rw-r--r--test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj10
-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
17 files changed, 112 insertions, 114 deletions
diff --git a/test/ILLink.Tasks.Tests/CommandRunner.cs b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs
index bc790c09a..bc790c09a 100644
--- a/test/ILLink.Tasks.Tests/CommandRunner.cs
+++ b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs
diff --git a/test/ILLink.Tasks.Tests/HelloWorldTest.cs b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs
index b9d1528c5..63b0990c9 100644
--- a/test/ILLink.Tasks.Tests/HelloWorldTest.cs
+++ b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs
@@ -17,8 +17,8 @@ namespace ILLink.Tests
public string SetupProject()
{
- string projectRoot = "helloworld";
- string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj");
+ string projectRoot = CreateTestFolder("helloworld");
+ string csproj = Path.Combine(projectRoot, $"helloworld.csproj");
if (File.Exists(csproj)) {
LogMessage ($"using existing project {csproj}");
@@ -38,9 +38,10 @@ namespace ILLink.Tests
AddLinkerReference(csproj);
+ AddNuGetConfig(projectRoot);
+
return csproj;
}
-
}
public class HelloWorldTest : IntegrationTestBase, IClassFixture<HelloWorldFixture>
diff --git a/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj b/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj
new file mode 100644
index 000000000..81a44f503
--- /dev/null
+++ b/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj
@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Content Remove="MusicStoreReflection.xml" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="MusicStoreReflection.xml" LogicalName="MusicStoreReflection.xml" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <!-- tell xunit to log diagnostic messages -->
+ <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
+ </ItemGroup>
+
+</Project>
diff --git a/test/ILLink.Tasks.Tests/IntegrationTestBase.cs b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs
index 3027f4fca..d65990895 100644
--- a/test/ILLink.Tasks.Tests/IntegrationTestBase.cs
+++ b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Xml.Linq;
using Xunit;
@@ -32,6 +33,27 @@ namespace ILLink.Tests
CommandHelper = new CommandHelper (logger);
}
+ protected void AddNuGetConfig(string projectRoot)
+ {
+ var nugetConfig = Path.Combine(projectRoot, "NuGet.config");
+ var xdoc = new XDocument();
+ var configuration = new XElement("configuration");
+ var packageSources = new XElement("packageSources");
+ packageSources.Add(new XElement("add",
+ new XAttribute("key", "dotnet-core"),
+ new XAttribute("value", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json")));
+ packageSources.Add(new XElement("add",
+ new XAttribute("key", "local linker feed"),
+ new XAttribute("value", TestContext.PackageSource)));
+
+ configuration.Add(packageSources);
+ xdoc.Add(configuration);
+
+ using (var fs = new FileStream(nugetConfig, FileMode.Create)) {
+ xdoc.Save(fs);
+ }
+ }
+
protected void AddLinkerReference(string csproj)
{
var xdoc = XDocument.Load(csproj);
@@ -59,6 +81,25 @@ namespace ILLink.Tests
}
}
+ protected string CreateTestFolder(string projectName)
+ {
+ string tempFolder = Path.GetFullPath(Path.Combine("tests-temp", projectName));
+ Directory.CreateDirectory(tempFolder);
+
+ // write empty Directory.Build.props and Directory.Build.targets to disable accidental import of arcade from repo root
+ File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.props"), "<Project></Project>");
+ File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.targets"), "<Project></Project>");
+
+ return Path.Combine(tempFolder, projectName);
+ }
+
+ protected void WriteEmbeddedResource(string resourceName, string destination)
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ var resourceStream = assembly.GetManifestResourceStream(resourceName);
+ resourceStream.CopyTo(File.Create(destination));
+ }
+
static void AddLinkerRoots(string csproj, List<string> rootFiles)
{
var xdoc = XDocument.Load(csproj);
diff --git a/test/ILLink.Tasks.Tests/Loggers.cs b/test/ILLink.Tasks.IntegrationTests/Loggers.cs
index 083cb2769..083cb2769 100644
--- a/test/ILLink.Tasks.Tests/Loggers.cs
+++ b/test/ILLink.Tasks.IntegrationTests/Loggers.cs
diff --git a/test/ILLink.Tasks.Tests/MusicStoreReflection.xml b/test/ILLink.Tasks.IntegrationTests/MusicStoreReflection.xml
index e35f91155..e35f91155 100755
--- a/test/ILLink.Tasks.Tests/MusicStoreReflection.xml
+++ b/test/ILLink.Tasks.IntegrationTests/MusicStoreReflection.xml
diff --git a/test/ILLink.Tasks.Tests/MusicStoreTest.cs b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs
index 0ae386cf2..cbb78b62b 100644
--- a/test/ILLink.Tasks.Tests/MusicStoreTest.cs
+++ b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs
@@ -13,7 +13,6 @@ namespace ILLink.Tests
public static List<string> rootFiles = new List<string> { "MusicStoreReflection.xml" };
private static string gitRepo = "http://github.com/aspnet/JitBench";
- private static string repoName = "JitBench";
// Revision can also be a branch name. We generally
// want to ensure that we are able to link the latest
@@ -57,6 +56,7 @@ namespace ILLink.Tests
string SetupProject()
{
int ret;
+ string repoName = CreateTestFolder("MusicStore");
string demoRoot = Path.Combine(repoName, Path.Combine("src", "MusicStore"));
string csproj = Path.Combine(demoRoot, "MusicStore.csproj");
@@ -86,8 +86,10 @@ namespace ILLink.Tests
Assert.True(false);
}
- // Copy root files into the project directory
- CopyRootFiles(demoRoot);
+ // Write root files into the project directory
+ foreach (var rf in rootFiles) {
+ WriteEmbeddedResource(rf, Path.Combine(demoRoot, rf));
+ }
// This is necessary because JitBench comes with a
// NuGet.Config that has a <clear /> line, preventing
@@ -175,13 +177,6 @@ namespace ILLink.Tests
return GetDotnetToolPath(dotnetDir);
}
- static void CopyRootFiles(string demoRoot)
- {
- foreach (var rf in rootFiles) {
- File.Copy(rf, Path.Combine(demoRoot, rf));
- }
- }
-
private void AddLocalNugetFeedAfterClear(string nugetConfig)
{
string localPackagePath = Path.GetFullPath(TestContext.PackageSource);
@@ -211,14 +206,14 @@ namespace ILLink.Tests
// context.DotnetToolPath = ObtainSDK(context.TestBin, repoName);
}
- [Fact]
+ //[Fact] // https://github.com/aspnet/JitBench/issues/96
public void RunMusicStoreStandalone()
{
string executablePath = BuildAndLink(MusicStoreFixture.csproj, MusicStoreFixture.rootFiles, MusicStoreFixture.VersionPublishArgs, selfContained: true);
CheckOutput(executablePath, selfContained: true);
}
- [Fact]
+ //[Fact] // https://github.com/aspnet/JitBench/issues/96
public void RunMusicStorePortable()
{
Dictionary<string, string> extraPublishArgs = new Dictionary<string, string>(MusicStoreFixture.VersionPublishArgs);
diff --git a/test/ILLink.Tasks.Tests/TestContext.cs b/test/ILLink.Tasks.IntegrationTests/TestContext.cs
index 593e5ec95..d8f7f0b6d 100644
--- a/test/ILLink.Tasks.Tests/TestContext.cs
+++ b/test/ILLink.Tasks.IntegrationTests/TestContext.cs
@@ -69,9 +69,14 @@ namespace ILLink.Tests
var testBin = Path.Combine(Environment.CurrentDirectory, "..", "..");
var repoRoot = Path.GetFullPath(Path.Combine(testBin, "..", "..", ".."));
+ // We want to build and link integration projects in the
+ // release configuration.
+ Configuration = "Release";
+ TestBin = testBin;
+
// Locate task package
var packageName = "ILLink.Tasks";
- var packageSource = Path.Combine(repoRoot, "src", "ILLink.Tasks", "bin", "nupkgs");
+ var packageSource = Path.Combine(repoRoot, "artifacts", "packages", Configuration, "Shipping");
var tasksPackages = Directory.GetFiles(packageSource)
.Where(p => Path.GetExtension(p) == ".nupkg")
.Select(p => Path.GetFileNameWithoutExtension(p))
@@ -110,10 +115,6 @@ namespace ILLink.Tests
{
RuntimeIdentifier = "osx.10.13-x64";
}
- // We want to build and link integration projects in the
- // release configuration.
- Configuration = "Release";
- TestBin = testBin;
}
}
}
diff --git a/test/ILLink.Tasks.Tests/WebApiTest.cs b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs
index 2cdd3495a..334468167 100644
--- a/test/ILLink.Tasks.Tests/WebApiTest.cs
+++ b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs
@@ -16,8 +16,8 @@ namespace ILLink.Tests
public string SetupProject()
{
- string projectRoot = "webapi";
- string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj");
+ string projectRoot = CreateTestFolder("webapi");
+ string csproj = Path.Combine(projectRoot, $"webapi.csproj");
if (File.Exists(csproj)) {
LogMessage($"using existing project {csproj}");
@@ -39,6 +39,8 @@ namespace ILLink.Tests
AddLinkerReference(csproj);
+ AddNuGetConfig(projectRoot);
+
return csproj;
}
diff --git a/test/ILLink.Tasks.Tests/xunit.runner.json b/test/ILLink.Tasks.IntegrationTests/xunit.runner.json
index 40be06652..40be06652 100644
--- a/test/ILLink.Tasks.Tests/xunit.runner.json
+++ b/test/ILLink.Tasks.IntegrationTests/xunit.runner.json
diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
deleted file mode 100644
index 5ce4708cc..000000000
--- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>netcoreapp3.0</TargetFramework>
-
- <IsPackable>false</IsPackable>
- <IsTestProject>false</IsTestProject>
- </PropertyGroup>
-
- <ItemGroup>
- <Content Include="MusicStoreReflection.xml">
- <!-- It doesn't seem to get copied unless we specify this
- explicitly. -->
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
-
- <Target Name="CopyNuGetConfig" AfterTargets="AfterBuild">
- <Copy SourceFiles="nuget/NuGet.config" DestinationFolder="$(OutDir)" />
- </Target>
-
- <ItemGroup>
- <!-- tell xunit to log diagnostic messages -->
- <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.1" />
- <PackageReference Include="xunit" Version="2.4.0" />
- <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
- </ItemGroup>
-
-</Project>
diff --git a/test/ILLink.Tasks.Tests/nuget/NuGet.config b/test/ILLink.Tasks.Tests/nuget/NuGet.config
deleted file mode 100644
index 1954d0af0..000000000
--- a/test/ILLink.Tasks.Tests/nuget/NuGet.config
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <packageSources>
- <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
- <!-- When the tests are run from the repo's test bin directory,
- this NuGet.config should be read to find the local package
- directory. The path is relative to the test <baseoutputpath>/<config>/<tfm>
- directory. -->
- <add key="local linker packages" value="../../../../../src/ILLink.Tasks/bin/nupkgs" />
- </packageSources>
-</configuration>
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
index db2718da3..a7faebae5 100644
--- a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
+++ b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <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>
</PropertyGroup>
- <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))">
+ <PropertyGroup Condition="'$(MonoBuild)' != ''">
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
index f1b5db37a..852a4a5bb 100644
--- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
+++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
@@ -6,18 +6,16 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>8.0</LangVersion>
- <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>
</PropertyGroup>
- <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))">
+ <PropertyGroup Condition="'$(MonoBuild)' != ''">
<TargetFramework>net471</TargetFramework>
- <ILLinkBuild>false</ILLinkBuild>
</PropertyGroup>
<ItemGroup>
@@ -131,7 +129,7 @@
<EmbeddedResource Include="LinkXml\CanPreserveExcludedFeatureCom.xml" />
</ItemGroup>
- <ItemGroup Condition="$(ILLinkBuild)">
+ <ItemGroup Condition="'$(MonoBuild)' == ''">
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.6.1" />
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;