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:
authorVitek Karas <vitek.karas@microsoft.com>2020-05-20 18:23:01 +0300
committerGitHub <noreply@github.com>2020-05-20 18:23:01 +0300
commit7d149f673b921ecc23372a5741082c9cd0a6b70a (patch)
tree356fb78247cf42609406155e3b6c9de4509e3ed8 /test/Mono.Linker.Tests/TestCases/TestSuites.cs
parent3409a1a819e380c0ffeedfaaccc74f064b67b2ff (diff)
Implement support for RequiresUnreferencedCodeAttribute (#1204)
Introduces a cache of "linker attributes", currently only RequiresUnreferencedCodeAttribute is supported, but it's highly likely we will need this for other attributes as well (DynamicDependency, future AOT/Single-file related attributes, UnconditionalSuppressMessage, ...). The cache is on Annotations class and should also act as a natural point to unify attribute and XML based inputs (once we have the XML based attribute injection). RequiresUnreferencedCode now causes a linker warning whenever a method with it is called. It also auto-suppresses warnings within the method with this attribute - it actually disables data flow analysis on the method right now. In the future when we have AOT/Single-File related analysis we will need to modify this to selectively support a subset and only auto-suppress warnings related to the relevant subsets. Extends the LogContains/LogDoesNotContain test attributes so that they can appear on anything within the test class. Functionality is still the same as if they're on the class, but it makes it easier to structure the tests and make them more readable. Once we have solid warning origins, we could also auto-validate that the warning came from the method it is on. Added support for multiple attributes of the same type. Added logic to detect multiple instances of attribute where there should only be one - in this case linker will issue a warning and use the first instance only.
Diffstat (limited to 'test/Mono.Linker.Tests/TestCases/TestSuites.cs')
-rw-r--r--test/Mono.Linker.Tests/TestCases/TestSuites.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests/TestCases/TestSuites.cs b/test/Mono.Linker.Tests/TestCases/TestSuites.cs
index f50995fa8..2d72ae770 100644
--- a/test/Mono.Linker.Tests/TestCases/TestSuites.cs
+++ b/test/Mono.Linker.Tests/TestCases/TestSuites.cs
@@ -212,6 +212,12 @@ namespace Mono.Linker.Tests.TestCases
Run (testCase);
}
+ [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.RequiresCapabilityTests))]
+ public void RequiresCapabilityTests (TestCase testCase)
+ {
+ Run (testCase);
+ }
+
protected virtual void Run (TestCase testCase)
{
var runner = new TestRunner (new ObjectFactory ());