Skip to content

Commit ec85809

Browse files
authored
Merge branch 'release/9.0-staging' into merge/release/9.0-to-release/9.0-staging
2 parents 34e64ad + 20e7f60 commit ec85809

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
<MicrosoftExtensionsLoggingVersion>3.1.7</MicrosoftExtensionsLoggingVersion>
263263
<MicrosoftSymbolStoreVersion>1.0.406601</MicrosoftSymbolStoreVersion>
264264
<!-- sdk version, for testing workloads -->
265-
<!--<SdkVersionForWorkloadTesting>$(MicrosoftDotNetApiCompatTaskVersion)</SdkVersionForWorkloadTesting>-->
265+
<!-- <SdkVersionForWorkloadTesting>$(MicrosoftDotNetApiCompatTaskVersion)</SdkVersionForWorkloadTesting> -->
266266
<SdkVersionForWorkloadTesting>9.0.105</SdkVersionForWorkloadTesting>
267267
<runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion>9.0.0-alpha.1.24175.1</runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion>
268268
<EmsdkPackageVersion>$(MicrosoftNETRuntimeEmscriptenVersion)</EmsdkPackageVersion>

src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Xunit;
1717
using Xunit.Abstractions;
1818
using Xunit.Sdk;
19+
using Microsoft.Build.Logging.StructuredLogger;
1920

2021
#nullable enable
2122

@@ -176,9 +177,48 @@ public BuildTestBase(ProjectProviderBase providerBase, ITestOutputHelper output,
176177
else if (res.ExitCode == 0)
177178
throw new XunitException($"Build should have failed, but it didn't. Process exited with exitCode : {res.ExitCode}");
178179

180+
// Ensure we got all output.
181+
string[] successMessages = ["Build succeeded"];
182+
string[] errorMessages = ["Build failed", "Build FAILED", "Restore failed", "Stopping the build"];
183+
if ((res.ExitCode == 0 && successMessages.All(m => !res.Output.Contains(m))) || (res.ExitCode != 0 && errorMessages.All(m => !res.Output.Contains(m))))
184+
{
185+
_testOutput.WriteLine("Replacing dotnet process output with messages from binlog");
186+
187+
var outputBuilder = new StringBuilder();
188+
var buildRoot = BinaryLog.ReadBuild(logFilePath);
189+
buildRoot.VisitAllChildren<TextNode>(m =>
190+
{
191+
if (m is Message || m is Error || m is Warning)
192+
{
193+
var context = GetBinlogMessageContext(m);
194+
outputBuilder.AppendLine($"{context}{m.Title}");
195+
}
196+
});
197+
198+
res = new CommandResult(res.StartInfo, res.ExitCode, outputBuilder.ToString());
199+
}
200+
179201
return (res, logFilePath);
180202
}
181203

204+
private string GetBinlogMessageContext(TextNode node)
205+
{
206+
var currentNode = node;
207+
while (currentNode != null)
208+
{
209+
if (currentNode is Error error)
210+
{
211+
return $"{error.File}({error.LineNumber},{error.ColumnNumber}): error {error.Code}: ";
212+
}
213+
else if (currentNode is Warning warning)
214+
{
215+
return $"{warning.File}({warning.LineNumber},{warning.ColumnNumber}): warning {warning.Code}: ";
216+
}
217+
currentNode = currentNode.Parent as TextNode;
218+
}
219+
return string.Empty;
220+
}
221+
182222
protected string RunAndTestWasmApp(BuildArgs buildArgs,
183223
RunHost host,
184224
string id,

src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
<ItemGroup>
4949
<PackageReference Include="Microsoft.Playwright" Version="1.21.0" />
50+
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.350" />
5051
<ProjectReference Include="$(RepoRoot)src\tasks\Microsoft.NET.Sdk.WebAssembly.Pack.Tasks\Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj" />
5152
<!-- Update the version provided by Microsoft.Playwright but drop it in favor of framework copy-->
5253
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" PrivateAssets="All" ExcludeAssets="All" />

0 commit comments

Comments
 (0)