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:
authorMike Voorhees <mrvoorhe@users.noreply.github.com>2021-08-26 21:28:31 +0300
committerGitHub <noreply@github.com>2021-08-26 21:28:31 +0300
commit38544e820223e60d0abe2801b2856cd124679522 (patch)
treeb32e2d3c9d2362af254fccb959121bfc6460610f
parente92ede15d5c2e33ed640375b1eac02d6af166238 (diff)
Remove hard coded case directory name (#2235)
This causes us problems with our test framework since our assembly containing additional test cases is called Unity.Linker.Tests.Cases.
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestCase.cs3
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs13
2 files changed, 7 insertions, 9 deletions
diff --git a/test/Mono.Linker.Tests/TestCases/TestCase.cs b/test/Mono.Linker.Tests/TestCases/TestCase.cs
index 5507c137d..a0000d1d9 100644
--- a/test/Mono.Linker.Tests/TestCases/TestCase.cs
+++ b/test/Mono.Linker.Tests/TestCases/TestCase.cs
@@ -9,6 +9,7 @@ namespace Mono.Linker.Tests.TestCases
public TestCase (NPath sourceFile, NPath rootCasesDirectory, NPath originalTestCaseAssemblyPath)
{
SourceFile = sourceFile;
+ RootCasesDirectory = rootCasesDirectory;
OriginalTestCaseAssemblyPath = originalTestCaseAssemblyPath;
Name = sourceFile.FileNameWithoutExtension;
DisplayName = $"{sourceFile.RelativeTo (rootCasesDirectory).Parent.ToString (SlashMode.Forward).Replace ('/', '.')}.{sourceFile.FileNameWithoutExtension}";
@@ -21,6 +22,8 @@ namespace Mono.Linker.Tests.TestCases
TestSuiteDirectory = rootCasesDirectory.Combine (firstParentRelativeToRoot);
}
+ public NPath RootCasesDirectory { get; }
+
public string Name { get; }
public string DisplayName { get; }
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
index 9fc1bfa2c..79e754cb7 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
@@ -42,16 +42,11 @@ namespace Mono.Linker.Tests.TestCasesRunner
{
_testCase = testCase;
- _directory = rootTemporaryDirectory.Combine (string.IsNullOrEmpty (namePrefix) ? "linker_tests" : namePrefix);
+ var rootDirectory = rootTemporaryDirectory.Combine (string.IsNullOrEmpty (namePrefix) ? "linker_tests" : namePrefix);
- const string tcases_name = "Mono.Linker.Tests.Cases";
- var location = testCase.SourceFile.Parent.ToString ();
- int idx = location.IndexOf (tcases_name + Path.DirectorySeparatorChar);
- if (idx < 0)
- throw new ArgumentException ("Unknown test cases location");
-
- _directory = _directory.Combine (location.Substring (idx + tcases_name.Length + 1));
- _directory = _directory.Combine (testCase.SourceFile.FileNameWithoutExtension);
+ var locationRelativeToRoot = testCase.SourceFile.Parent.RelativeTo (testCase.RootCasesDirectory);
+ var suiteDirectory = rootDirectory.Combine (locationRelativeToRoot);
+ _directory = suiteDirectory.Combine (testCase.SourceFile.FileNameWithoutExtension);
_directory.DeleteContents ();