From 3f0ff0798aed66904f364e99ec0d3cb3ed4f7b4e Mon Sep 17 00:00:00 2001 From: Mike Voorhees Date: Tue, 16 May 2017 15:15:11 -0400 Subject: Switch to explicit references only. No more assuming all .dlls in the sandboxed directory are meant to be passed as references when compiling the test cases --- linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs | 3 ++- linker/Tests/TestCasesRunner/TestCaseSandbox.cs | 18 +++++++----------- linker/Tests/TestCasesRunner/TestRunner.cs | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) (limited to 'linker') diff --git a/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs b/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs index 477fdcfde..67eb9814c 100644 --- a/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs +++ b/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs @@ -34,8 +34,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { return new TestCaseLinkerOptions {CoreLink = coreLink, Il8n = il8n, IncludeBlacklistStep = blacklist}; } - public virtual IEnumerable GetReferencedAssemblies () + public virtual IEnumerable GetReferencedAssemblies (NPath workingDirectory) { + yield return workingDirectory.Combine ("Mono.Linker.Tests.Cases.Expectations.dll").ToString (); yield return "mscorlib.dll"; foreach (var referenceAttr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (ReferenceAttribute))) { diff --git a/linker/Tests/TestCasesRunner/TestCaseSandbox.cs b/linker/Tests/TestCasesRunner/TestCaseSandbox.cs index 7eb29f4b7..03e990ff0 100644 --- a/linker/Tests/TestCasesRunner/TestCaseSandbox.cs +++ b/linker/Tests/TestCasesRunner/TestCaseSandbox.cs @@ -47,14 +47,6 @@ namespace Mono.Linker.Tests.TestCasesRunner { get { return _directory.Files ("*.cs"); } } - public IEnumerable InputDirectoryReferences { - get { return InputDirectory.Files ("*.dll"); } - } - - public IEnumerable ExpectationsDirectoryReferences { - get { return ExpectationsDirectory.Files ("*.dll"); } - } - public IEnumerable LinkXmlFiles { get { return InputDirectory.Files ("*.xml"); } } @@ -66,18 +58,22 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (_testCase.HasLinkXmlFile) _testCase.LinkXmlFile.Copy (InputDirectory); - GetExpectationsAssemblyPath ().Copy (InputDirectory); + CopyToInputAndExpectations (GetExpectationsAssemblyPath ()); foreach (var dep in metadataProvider.AdditionalFilesToSandbox ()) { dep.FileMustExist ().Copy (_directory); } - - InputDirectoryReferences.Copy (ExpectationsDirectory); } private static NPath GetExpectationsAssemblyPath () { return new Uri (typeof (KeptAttribute).Assembly.CodeBase).LocalPath.ToNPath (); } + + protected void CopyToInputAndExpectations (NPath source) + { + source.Copy (InputDirectory); + source.Copy (ExpectationsDirectory); + } } } \ No newline at end of file diff --git a/linker/Tests/TestCasesRunner/TestRunner.cs b/linker/Tests/TestCasesRunner/TestRunner.cs index b43fda635..f29774064 100644 --- a/linker/Tests/TestCasesRunner/TestRunner.cs +++ b/linker/Tests/TestCasesRunner/TestRunner.cs @@ -40,10 +40,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { var compiler = _factory.CreateCompiler (); var sourceFiles = sandbox.SourceFiles.Select(s => s.ToString()).ToArray(); - var references = metadataProvider.GetReferencedAssemblies ().Concat (sandbox.InputDirectoryReferences.Select (r => r.ToString ())).ToArray (); + var references = metadataProvider.GetReferencedAssemblies(sandbox.InputDirectory); var inputAssemblyPath = compiler.CompileTestIn (sandbox.InputDirectory, sourceFiles, references, null); - references = metadataProvider.GetReferencedAssemblies ().Concat (sandbox.ExpectationsDirectoryReferences.Select (r => r.ToString ())).ToArray (); + references = metadataProvider.GetReferencedAssemblies(sandbox.ExpectationsDirectory); var expectationsAssemblyPath = compiler.CompileTestIn (sandbox.ExpectationsDirectory, sourceFiles, references, new [] { "INCLUDE_EXPECTATIONS" }); return new ManagedCompilationResult (inputAssemblyPath, expectationsAssemblyPath); } -- cgit v1.2.3