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:
authorMichael Voorhees <michaelv@unity3d.com>2020-03-25 15:53:06 +0300
committerMarek Safar <marek.safar@gmail.com>2020-03-25 18:25:13 +0300
commiteb4ae9b9ed0f9de2f1cb97b97d392f78524791d1 (patch)
tree3c782fd06d174eaa694aaaa64780b32d874ec505 /test/Mono.Linker.Tests
parent607f6d38221d13ca01a0adf2152ff2cb8c501399 (diff)
Fix for pinvoke output test
Don't assume that the test is running from the project directory. Some test runners will set the CurrentDirectory to a temporary directory.
Diffstat (limited to 'test/Mono.Linker.Tests')
-rw-r--r--test/Mono.Linker.Tests/TestCases/IndividualTests.cs4
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestDatabase.cs8
2 files changed, 11 insertions, 1 deletions
diff --git a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
index 7ded3ee80..44e1a6e9b 100644
--- a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
+++ b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
@@ -19,6 +19,8 @@ namespace Mono.Linker.Tests.TestCases
[TestFixture]
public class IndividualTests
{
+ private NPath TestsDirectory => TestDatabase.TestCasesRootDirectory.Parent.Combine ("Mono.Linker.Tests");
+
[Test]
public void CanSkipUnresolved ()
{
@@ -45,7 +47,7 @@ namespace Mono.Linker.Tests.TestCases
var jsonSerializer = new DataContractJsonSerializer (typeof (List<PInvokeInfo>));
using (var fsActual = File.Open(outputPath, FileMode.Open))
- using (var fsExpected = File.Open("TestCases/Dependencies/PInvokesExpectations.json", FileMode.Open)) {
+ using (var fsExpected = File.Open (TestsDirectory.Combine ("TestCases/Dependencies/PInvokesExpectations.json"), FileMode.Open)) {
var actual = jsonSerializer.ReadObject (fsActual) as List<PInvokeInfo>;
var expected = jsonSerializer.ReadObject (fsExpected) as List<PInvokeInfo>;
foreach (var pinvokePair in Enumerable.Zip(actual, expected, (fst, snd) => Tuple.Create(fst, snd))) {
diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
index 41f37400a..fe40ae4d5 100644
--- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
+++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using System.Runtime.CompilerServices;
using System.IO;
+using Mono.Linker.Tests.Extensions;
using Mono.Linker.Tests.TestCasesRunner;
namespace Mono.Linker.Tests.TestCases
@@ -162,6 +163,13 @@ namespace Mono.Linker.Tests.TestCases
return new TestCaseCollector (rootSourceDirectory, testCaseAssemblyPath);
}
+ public static NPath TestCasesRootDirectory {
+ get {
+ GetDirectoryPaths (out string rootSourceDirectory, out string _);
+ return rootSourceDirectory.ToNPath ();
+ }
+ }
+
static IEnumerable<TestCase> AllCases ()
{
if (_cachedAllCases == null)