Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,19 @@ public IReadOnlyDictionary<string, DotNetFileName> FindAndAssertDotnetFiles(
if (!match.Success)
return true;

actual[expectedFilename] = new(ExpectedFilename: expectedFilename,
Hash: match.Groups[1].Value,
ActualPath: actualFile);
// Multiple fingerprinted variants of the same logical file can coexist when
// republishing into an existing output directory: the previous publish's
// fingerprinted copy is not removed, and a rebuild that changes the file's
// content produces a new fingerprint alongside the stale one. Keep the newest
// file so the assertion compares against the current (re)build output instead
// of picking a stale artifact by filename ordering.
if (!actual.TryGetValue(expectedFilename, out DotNetFileName? existingMatch) ||
File.GetLastWriteTimeUtc(actualFile) >= File.GetLastWriteTimeUtc(existingMatch.ActualPath))
{
Comment thread
pavelsavara marked this conversation as resolved.
actual[expectedFilename] = new(ExpectedFilename: expectedFilename,
Hash: match.Groups[1].Value,
ActualPath: actualFile);
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
public class Test
{
public static int Main()
Expand All @@ -12,6 +13,13 @@ public static int Main()
byte[] hashBytes = sha256.ComputeHash(inputBytes);
Console.WriteLine($"Hash of {input}: {Convert.ToBase64String(hashBytes)}");
}

// Also reference System.Text.RegularExpressions, which is not otherwise part of
// the test app's closure, so that rebuilding pulls in a *new* assembly. This
// ensures native artifacts that depend on the set of assemblies (e.g. the AOT
// modules table driver-gen.c) are regenerated on rebuild.
bool isMatch = Regex.IsMatch(input, "[A-Za-z]+");
Console.WriteLine($"Input '{input}' matches: {isMatch}");
return 42;
}
}