diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs index efda20786e..32251577aa 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs @@ -100,6 +100,7 @@ public override (string ID, string Name, string Code) GetAssetsToGenerate() => ( + @@ -233,6 +234,7 @@ public override (string ID, string Name, string Code) GetAssetsToGenerate() => ( + diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs index bf099284bc..940fb2c83c 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs @@ -26,7 +26,7 @@ public sealed class TelemetryTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{MTPAssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + #endregion public sealed class TestAssetFixture() : TestAssetFixtureBase() diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs index a025b50d32..4197891766 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs @@ -15,7 +15,7 @@ public sealed class TelemetryDisabledTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{AssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithoutTelemetry = nameof(WithoutTelemetry); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs index 0272637c43..f8ae989fec 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs @@ -15,7 +15,7 @@ public class TelemetryTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{AssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithTelemetry = nameof(WithTelemetry);