Skip to content

Commit 2460429

Browse files
author
v-wuzhai
authored
[automated] Merge branch 'release/8.0.3xx' => 'release/8.0.4xx' (#46699)
2 parents e2f6140 + 4ba9421 commit 2460429

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,25 @@ public void NativeAot_hw_runs_with_no_warnings_when_PublishAot_is_enabled(string
3939
{
4040
testProject.AdditionalProperties["StripSymbols"] = "true";
4141
}
42-
var testAsset = _testAssetsManager.CreateTestProject(testProject);
42+
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework);
43+
44+
string[] ignoredPatterns = null;
45+
46+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
47+
{
48+
ignoredPatterns = new string[]
49+
{
50+
// Both these exclusions can be removed once the min tested version is .NET 10 and the min supported
51+
// XCode version is XCode 16.
52+
53+
// -ld_classic option is required to workaround bugs in XCode 15 and .NET 9 and older runtimes.
54+
// See https://github.com/dotnet/runtime/issues/97745 for details.
55+
"ld: warning: -ld_classic is deprecated and will be removed in a future release",
56+
// These warnings show up when dotnet/runtime compiled using Apple clang 15+ is used
57+
// with classic linker (either Apple clang 14 or clang 15+ with -ld_classic).
58+
"ld: warning: __LD,__compact_unwind entries for",
59+
};
60+
}
4361

4462
var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name));
4563
publishCommand
@@ -48,7 +66,7 @@ public void NativeAot_hw_runs_with_no_warnings_when_PublishAot_is_enabled(string
4866
.And.NotHaveStdOutContaining("IL2026")
4967
.And.NotHaveStdErrContaining("NETSDK1179")
5068
.And.NotHaveStdErrContaining("warning")
51-
.And.NotHaveStdOutContaining("warning");
69+
.And.NotHaveStdOutContaining("warning", ignoredPatterns);
5270

5371
var buildProperties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework);
5472
var rid = buildProperties["NETCoreSdkPortableRuntimeIdentifier"];

src/Tests/Microsoft.NET.TestFramework/Assertions/CommandResultAssertions.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,23 @@ public AndConstraint<CommandResultAssertions> HaveStdOutContaining(Func<string,
6666
return new AndConstraint<CommandResultAssertions>(this);
6767
}
6868

69-
public AndConstraint<CommandResultAssertions> NotHaveStdOutContaining(string pattern)
69+
public AndConstraint<CommandResultAssertions> NotHaveStdOutContaining(string pattern, string[] ignoredPatterns = null)
7070
{
71-
Execute.Assertion.ForCondition(!_commandResult.StdOut.Contains(pattern))
71+
string filteredStdOut = _commandResult.StdOut;
72+
if (ignoredPatterns != null && ignoredPatterns.Length > 0)
73+
{
74+
foreach (var ignoredPattern in ignoredPatterns)
75+
{
76+
filteredStdOut = string.Join(Environment.NewLine, filteredStdOut
77+
.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
78+
.Where(line => !line.Contains(ignoredPattern)));
79+
}
80+
}
81+
82+
// Perform the assertion on the filtered output
83+
Execute.Assertion.ForCondition(!filteredStdOut.Contains(pattern))
7284
.FailWith(AppendDiagnosticsTo($"The command output contained a result it should not have contained: {pattern}{Environment.NewLine}"));
85+
7386
return new AndConstraint<CommandResultAssertions>(this);
7487
}
7588

0 commit comments

Comments
 (0)