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:
Diffstat (limited to 'test')
-rw-r--r--test/Directory.Build.props2
-rw-r--r--test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs12
-rw-r--r--test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs2
-rw-r--r--test/ILLink.RoslynAnalyzer.Tests/generated/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs5
-rw-r--r--test/Mono.Linker.Tests.Cases.Expectations/Metadata/RequiresDynamicCodeAttribute.cs41
-rw-r--r--test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/Serialization/SerializationTypeRecursion.cs6
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/UnreachableBlock/MethodWithParametersSubstitutions.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs2
-rw-r--r--test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs2
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs2
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs4
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs4
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs2
19 files changed, 30 insertions, 68 deletions
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index a014e1bac..107feee22 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -3,7 +3,7 @@
<PropertyGroup>
<RunAnalyzers>false</RunAnalyzers>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project> \ No newline at end of file
diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs
index 69b89381e..ba6f8e54c 100644
--- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs
+++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs
@@ -26,9 +26,9 @@ namespace ILLink.RoslynAnalyzer.Tests
public static readonly ReferenceAssemblies Net6PreviewAssemblies =
new ReferenceAssemblies (
- "net6.0",
- new PackageIdentity ("Microsoft.NETCore.App.Ref", "6.0.0-preview.7.21368.2"),
- Path.Combine ("ref", "net6.0"))
+ "net7.0",
+ new PackageIdentity ("Microsoft.NETCore.App.Ref", "7.0.0-preview.2.22152.2"),
+ Path.Combine ("ref", "net7.0"))
.WithNuGetConfigFilePath (Path.Combine (TestCaseUtils.GetRepoRoot (), "NuGet.config"));
private static ImmutableArray<MetadataReference> s_net6Refs;
@@ -161,11 +161,7 @@ namespace ILLink.RoslynAnalyzer.Tests
var configDirectoryName = "Release";
#endif
-#if NET6_0
- const string tfm = "net6.0";
-#else
- const string tfm = "net5.0";
-#endif
+ const string tfm = "net7.0";
// Working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm>
var artifactsBinDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..");
diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs b/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs
index 585944945..2c49d205c 100644
--- a/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs
+++ b/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs
@@ -263,7 +263,7 @@ namespace ILLink.RoslynAnalyzer.Tests
}
missingDiagnosticMessage = $"Warning '{expectedWarningCode}'. Expected to find warning containing:{string.Join (" ", expectedMessages.Select (m => "'" + m + "'"))}" +
- $", but no such message was found.{ Environment.NewLine}";
+ $", but no such message was found.{Environment.NewLine}";
return false;
bool Matches (Diagnostic diagnostic)
diff --git a/test/ILLink.RoslynAnalyzer.Tests/generated/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs b/test/ILLink.RoslynAnalyzer.Tests/generated/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs
new file mode 100644
index 000000000..b61e47c93
--- /dev/null
+++ b/test/ILLink.RoslynAnalyzer.Tests/generated/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs
@@ -0,0 +1,5 @@
+// <auto-generated/>
+#nullable enable
+#pragma warning disable CS0162 // Unreachable code
+#pragma warning disable CS0164 // Unreferenced label
+#pragma warning disable CS0219 // Variable assigned but never used
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/RequiresDynamicCodeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/RequiresDynamicCodeAttribute.cs
deleted file mode 100644
index d962da8d1..000000000
--- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/RequiresDynamicCodeAttribute.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation and contributors. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-#nullable enable
-
-namespace System.Diagnostics.CodeAnalysis
-{
- /// <summary>
- /// Indicates that the specified method requires the ability to generate new code at runtime,
- /// for example through <see cref="System.Reflection"/>.
- /// </summary>
- /// <remarks>
- /// This allows tools to understand which methods are unsafe to call when compiling ahead of time.
- /// </remarks>
- [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
- public sealed class RequiresDynamicCodeAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="RequiresDynamicCodeAttribute"/> class
- /// with the specified message.
- /// </summary>
- /// <param name="message">
- /// A message that contains information about the usage of dynamic code.
- /// </param>
- public RequiresDynamicCodeAttribute (string message)
- {
- Message = message;
- }
-
- /// <summary>
- /// Gets a message that contains information about the usage of dynamic code.
- /// </summary>
- public string Message { get; }
-
- /// <summary>
- /// Gets or sets an optional URL that contains more information about the method,
- /// why it requires dynamic code, and what options a consumer has to deal with it.
- /// </summary>
- public string? Url { get; set; }
- }
-}
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs
index 359e900a8..ee695fb08 100644
--- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs
+++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs
@@ -21,7 +21,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
[Foo]
[Kept]
[KeptBackingField]
- public string Value { [Foo] [Kept] get; [Foo] [Kept] set; }
+ public string Value { [Foo][Kept] get; [Foo][Kept] set; }
}
class FooAttribute : Attribute
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs
index 6b4437f36..27d50d3cd 100644
--- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs
+++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs
@@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
[KeptAttributeAttribute (typeof (FooAttribute))]
[KeptEventAddMethod]
[KeptEventRemoveMethod]
- public event EventHandler<EventArgs> Something { [Foo] [KeptAttributeAttribute (typeof (FooAttribute))] add { } [Foo] [KeptAttributeAttribute (typeof (FooAttribute))] remove { } }
+ public event EventHandler<EventArgs> Something { [Foo][KeptAttributeAttribute (typeof (FooAttribute))] add { } [Foo][KeptAttributeAttribute (typeof (FooAttribute))] remove { } }
}
[Kept]
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs
index b255ffc23..f4a01cbfb 100644
--- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs
+++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs
@@ -23,7 +23,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
[Kept]
[KeptBackingField]
[KeptAttributeAttribute (typeof (FooAttribute))]
- public string Value { [Foo] [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] get; [Foo] [Kept] [KeptAttributeAttribute (typeof (FooAttribute))]set; }
+ public string Value { [Foo][Kept][KeptAttributeAttribute (typeof (FooAttribute))] get; [Foo][Kept][KeptAttributeAttribute (typeof (FooAttribute))] set; }
}
[Kept]
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs b/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
index 9747f7b6f..b7f4e0f32 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
@@ -245,7 +245,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow
"'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the generic parameter 'T' of 'Mono.Linker.Tests.Cases.DataFlow.VirtualMethodHierarchyDataflowAnnotationValidation.DerivedClass.GenericBaseWithoutDerivedWith<T>()' " +
"don't match overridden generic parameter 'T' of 'Mono.Linker.Tests.Cases.DataFlow.VirtualMethodHierarchyDataflowAnnotationValidation.BaseClass.GenericBaseWithoutDerivedWith<T>()'. " +
"All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.")]
- public override void GenericBaseWithoutDerivedWith<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)]T> () { }
+ public override void GenericBaseWithoutDerivedWith<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] T> () { }
[LogDoesNotContain ("DerivedClass.GenericBaseWithDerivedWith_")]
public override void GenericBaseWithDerivedWith_<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] T> () { }
diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs
index e3c174c61..044bcb27b 100644
--- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs
+++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs
@@ -28,7 +28,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC
class A : IBar, IFoo
{
[Kept]
- int IFoo.Foo { [Kept] [ExpectBodyModified] get; [Kept] [ExpectBodyModified] set; }
+ int IFoo.Foo { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; }
int IBar.Bar { get; set; }
}
diff --git a/test/Mono.Linker.Tests.Cases/Serialization/SerializationTypeRecursion.cs b/test/Mono.Linker.Tests.Cases/Serialization/SerializationTypeRecursion.cs
index dfad711ba..af92529b4 100644
--- a/test/Mono.Linker.Tests.Cases/Serialization/SerializationTypeRecursion.cs
+++ b/test/Mono.Linker.Tests.Cases/Serialization/SerializationTypeRecursion.cs
@@ -54,18 +54,18 @@ namespace Mono.Linker.Tests.Cases.Serialization
[Kept]
[KeptBackingField]
- public GetSetPropertyType p2 { [Kept]get; [Kept]set; }
+ public GetSetPropertyType p2 { [Kept] get; [Kept] set; }
// removed
PrivatePropertyType p3 { get; set; }
[Kept]
[KeptBackingField]
- public PublicGetPrivateSetPropertyType p4 { [Kept]get; [Kept]private set; }
+ public PublicGetPrivateSetPropertyType p4 { [Kept] get; [Kept] private set; }
[Kept]
[KeptBackingField]
- public PrivateGetPublicSetPropertyType p5 { [Kept]private get; [Kept]set; }
+ public PrivateGetPublicSetPropertyType p5 { [Kept] private get; [Kept] set; }
[Kept]
public RecursiveType f4;
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
index f1be225b9..809d0225f 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributesScopeUpdated.cs
@@ -33,7 +33,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding
}
[Kept]
- public static void Test_2<[KeptAttributeAttribute (typeof (TestType3Attribute))] [TestType3 (typeof (ImplementationLibrary))] T> ()
+ public static void Test_2<[KeptAttributeAttribute (typeof (TestType3Attribute))][TestType3 (typeof (ImplementationLibrary))] T> ()
{
}
diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/MethodWithParametersSubstitutions.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/MethodWithParametersSubstitutions.cs
index 51e60defe..e1c7b9def 100644
--- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/MethodWithParametersSubstitutions.cs
+++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/MethodWithParametersSubstitutions.cs
@@ -358,7 +358,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock
[Kept] static void MethodWithParamAndVarArgs_Reached2 () { }
- [Kept] [KeptMember (".ctor()")] class TestClass { }
+ [Kept][KeptMember (".ctor()")] class TestClass { }
[Kept] struct TestStruct { }
[Kept]
diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs
index 7cf0078e4..4ee1ebfcb 100644
--- a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs
+++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs
@@ -21,7 +21,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody
class Foo
{
[Kept]
- public string Property { [Kept] [ExpectBodyModified] get; set; }
+ public string Property { [Kept][ExpectBodyModified] get; set; }
}
}
} \ No newline at end of file
diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs
index 971477418..7dc74a98e 100644
--- a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs
+++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs
@@ -21,7 +21,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody
class Foo
{
[Kept]
- public string Property { get; [Kept] [ExpectBodyModified] set; }
+ public string Property { get; [Kept][ExpectBodyModified] set; }
}
}
} \ No newline at end of file
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs
index 9bec9957a..063580f55 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs
@@ -46,7 +46,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
}
- private string BuildArguments (CompilerOptions options)
+ private static string BuildArguments (CompilerOptions options)
{
var args = new StringBuilder ();
#if NETCOREAPP
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs b/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
index 8c8d3dbb9..4a02b50ac 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
@@ -14,7 +14,9 @@ namespace Mono.Linker.Tests.TestCasesRunner
public const string ConfigDirectoryName = "Release";
#endif
-#if NET6_0
+#if NET7_0
+ public const string TFMDirectoryName = "net7.0";
+#elif NET6_0
public const string TFMDirectoryName = "net6.0";
#elif NET5_0
public const string TFMDirectoryName = "net5.0";
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs
index 991c1860e..51d534be4 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs
@@ -336,7 +336,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
return CompileCSharpAssemblyWithDefaultCompiler (options);
}
- protected NPath CompileCSharpAssemblyWithExternalCompiler (string executable, CompilerOptions options, string compilerSpecificArguments)
+ protected static NPath CompileCSharpAssemblyWithExternalCompiler (string executable, CompilerOptions options, string compilerSpecificArguments)
{
var capturedOutput = new List<string> ();
var process = new Process ();
@@ -365,7 +365,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
return "mcs";
}
- protected string OptionsToCompilerCommandLineArguments (CompilerOptions options, string compilerSpecificArguments)
+ protected static string OptionsToCompilerCommandLineArguments (CompilerOptions options, string compilerSpecificArguments)
{
var builder = new StringBuilder ();
if (!string.IsNullOrEmpty (compilerSpecificArguments))
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
index 510f5a7a1..98528ae8d 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
@@ -19,7 +19,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
static NPath GetArtifactsTestPath ()
{
- // Converts paths like /root-folder/linker/artifacts/bin/Mono.Linker.Tests/Debug/net6.0/illink.dll
+ // Converts paths like /root-folder/linker/artifacts/bin/Mono.Linker.Tests/Debug/<tfm>/illink.dll
// to /root-folder/linker/artifacts/testcases/
string artifacts = Path.GetFullPath (Path.Combine (Path.GetDirectoryName (_linkerAssemblyPath), "..", "..", "..", ".."));
string tests = Path.Combine (artifacts, "testcases");