Skip to content

Commit c53362a

Browse files
authored
Merge main to rel/4.0 (#6128)
2 parents 5d131b2 + 7bda1c8 commit c53362a

File tree

28 files changed

+206
-79
lines changed

28 files changed

+206
-79
lines changed

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>
1818
<Sha>005149fac82d93baa64fa87c3bae1004c9cd11e1</Sha>
1919
</Dependency>
20-
<Dependency Name="MSTest" Version="3.10.0-preview.25369.5">
20+
<Dependency Name="MSTest" Version="3.10.0-preview.25371.5">
2121
<Uri>https://github.com/microsoft/testfx</Uri>
22-
<Sha>639e5cd9730d9642d93c2828b1e4686a164e040c</Sha>
22+
<Sha>4a8fcdaacd6ff086be895fc4aaf9e5c7d49e9f24</Sha>
2323
</Dependency>
24-
<Dependency Name="Microsoft.Testing.Platform" Version="1.8.0-preview.25369.5">
24+
<Dependency Name="Microsoft.Testing.Platform" Version="1.8.0-preview.25371.5">
2525
<Uri>https://github.com/microsoft/testfx</Uri>
26-
<Sha>639e5cd9730d9642d93c2828b1e4686a164e040c</Sha>
26+
<Sha>4a8fcdaacd6ff086be895fc4aaf9e5c7d49e9f24</Sha>
2727
</Dependency>
2828
</ToolsetDependencies>
2929
</Dependencies>

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>10.0.0-beta.25367.5</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
1111
<MicrosoftTestingExtensionsCodeCoverageVersion>17.14.2</MicrosoftTestingExtensionsCodeCoverageVersion>
1212
<!-- empty line to avoid merge conflicts for darc PRs to update CC and MSTest+MTP -->
13-
<MSTestVersion>3.10.0-preview.25369.5</MSTestVersion>
14-
<MicrosoftTestingPlatformVersion>1.8.0-preview.25369.5</MicrosoftTestingPlatformVersion>
13+
<MSTestVersion>3.10.0-preview.25371.5</MSTestVersion>
14+
<MicrosoftTestingPlatformVersion>1.8.0-preview.25371.5</MicrosoftTestingPlatformVersion>
1515
</PropertyGroup>
1616
</Project>

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tools": {
3-
"dotnet": "10.0.100-preview.7.25359.101",
3+
"dotnet": "10.0.100-preview.7.25368.105",
44
"runtimes": {
55
"dotnet": [
66
"3.1.32",
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"sdk": {
26-
"version": "10.0.100-preview.7.25359.101",
26+
"version": "10.0.100-preview.7.25368.105",
2727
"paths": [
2828
".dotnet",
2929
"$host$"

src/Platform/Microsoft.Testing.Platform/Requests/TreeNodeFilter/OperatorKind.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ internal enum OperatorKind
5555
/// Operator used for combining multiple filters with a logical AND.
5656
/// </summary>
5757
And,
58+
59+
/// <summary>
60+
/// Operator used to negate an expression.
61+
/// </summary>
62+
UnaryNot,
5863
}

src/Platform/Microsoft.Testing.Platform/Requests/TreeNodeFilter/TreeNodeFilter.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private static List<FilterExpression> ParseFilter(string filter)
7777
// of an expression operators are not allowed.
7878
bool isOperatorAllowed = false;
7979
bool isPropAllowed = false;
80-
80+
bool lastWasOpenParen = false;
8181
OperatorKind topStackOperator;
8282

8383
foreach (string token in TokenizeFilter(filter))
@@ -225,13 +225,19 @@ private static List<FilterExpression> ParseFilter(string filter)
225225
isPropAllowed = false;
226226
break;
227227

228+
case "!" when lastWasOpenParen:
229+
operatorStack.Push(OperatorKind.UnaryNot);
230+
break;
231+
228232
default:
229233
expressionStack.Push(new ValueExpression(token));
230234

231235
isOperatorAllowed = true;
232236
isPropAllowed = true;
233237
break;
234238
}
239+
240+
lastWasOpenParen = token == "(";
235241
}
236242

237243
// Note: What we should end with (as long as the expression is a valid filter)
@@ -350,6 +356,11 @@ private static void ProcessStackOperator(OperatorKind op, Stack<FilterExpression
350356
expr.Push(filterExpression);
351357
break;
352358

359+
case OperatorKind.UnaryNot:
360+
FilterExpression notOperator = expr.Pop();
361+
expr.Push(new OperatorExpression(FilterOperator.Not, [notOperator]));
362+
break;
363+
353364
default:
354365
// Note: Handling of other operations in valid scenarios should be handled by the caller.
355366
// Reaching this code for instance means that we're trying to process / operator
@@ -438,6 +449,12 @@ private static IEnumerable<string> TokenizeFilter(string filter)
438449
yield return "!=";
439450
i++;
440451
}
452+
else if (i - 1 >= 0 && filter[i - 1] == '(')
453+
{
454+
// Note: If we have a ! at the start of an expression, we should
455+
// treat it as a NOT operator.
456+
yield return "!";
457+
}
441458
else
442459
{
443460
goto default;

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public async Task SimpleMaxFailedTestsScenario(string tfm)
2626
// We can't know the number of tests that will be executed exactly due to the async
2727
// nature of publish/consume on the platform side. But we expect the cancellation to
2828
// happen "fast" enough that we don't execute all tests.
29-
Assert.IsTrue(total < 12);
30-
Assert.IsTrue(total >= 5);
29+
Assert.IsLessThan(12, total);
30+
Assert.IsGreaterThanOrEqualTo(5, total);
3131

3232
testHostResult = await testHost.ExecuteAsync();
3333
testHostResult.AssertExitCodeIs(ExitCodes.AtLeastOneTestFailed);

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunnerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public async SystemTask EnableMSTestRunner_False_Will_Run_Empty_Program_EntryPoi
102102
{
103103
if (TargetFrameworks.NetFramework.Any(x => x == tfm))
104104
{
105-
Assert.IsTrue(ex.Message.Contains("Program does not contain a static 'Main' method suitable for an entry point"), ex.Message);
105+
Assert.Contains("Program does not contain a static 'Main' method suitable for an entry point", ex.Message, ex.Message);
106106
// .NET Framework does not insert the entry point for empty program.
107107
}
108108
}

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ServerModeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public async Task DiscoverAndRun(string tfm)
3535

3636
await Task.WhenAll(discoveryListener.WaitCompletion(), runListener.WaitCompletion());
3737
Assert.AreEqual(1, discoveryCollector.TestNodeUpdates.Count(x => x.Node.NodeType == "action"), "Wrong number of discovery");
38-
Assert.AreEqual(2, runCollector.TestNodeUpdates.Count, "Wrong number of updates");
38+
Assert.HasCount(2, runCollector.TestNodeUpdates);
3939
Assert.AreNotEqual(0, logs.Count, "Logs are empty");
4040
Assert.IsFalse(telemetry.IsEmpty, "telemetry is empty");
4141
await jsonClient.Exit();

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ private static async Task RunAndAssertWithRunSettingsAsync(string tfm, int timeo
406406

407407
if (assertAttributePrecedence)
408408
{
409-
Assert.IsTrue(stopwatch.Elapsed.TotalSeconds < 25);
409+
Assert.IsLessThan(25, stopwatch.Elapsed.TotalSeconds);
410410
}
411411

412412
testHostResult.AssertOutputContains($"{InfoByKind[entryKind].Prefix} method '{InfoByKind[entryKind].MethodFullName}' timed out after {timeoutValue}ms");

test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashPlusHangDumpTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public async Task CrashPlusHangDump_InCaseOfCrash_CreateCrashDump()
3030
testHostResult.AssertOutputMatchesRegex(@"Test host process with PID \'.+\' crashed, a dump file was generated");
3131
testHostResult.AssertOutputDoesNotContain(@"Hang dump timeout '00:00:08' expired");
3232

33-
Assert.IsTrue(Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_crash.dmp", SearchOption.AllDirectories).Length > 0, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
34-
Assert.IsFalse(Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_hang.dmp", SearchOption.AllDirectories).Length > 0, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
33+
Assert.IsGreaterThan(0, Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_crash.dmp", SearchOption.AllDirectories).Length, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
34+
Assert.IsLessThanOrEqualTo(0, Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_hang.dmp", SearchOption.AllDirectories).Length, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
3535
}
3636

3737
[TestMethod]
@@ -58,8 +58,8 @@ public async Task CrashPlusHangDump_InCaseOfHang_CreateHangDump()
5858
testHostResult.AssertOutputDoesNotMatchRegex(@"Test host process with PID '.+' crashed, a dump file was generated");
5959
testHostResult.AssertOutputContains(@"Hang dump timeout of '00:00:08' expired");
6060

61-
Assert.IsFalse(Directory.GetFiles(resultDirectory, "CrashPlusHangDump.dll*_crash.dmp", SearchOption.AllDirectories).Length > 0, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
62-
Assert.IsTrue(Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_hang.dmp", SearchOption.AllDirectories).Length > 0, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
61+
Assert.IsLessThanOrEqualTo(0, Directory.GetFiles(resultDirectory, "CrashPlusHangDump.dll*_crash.dmp", SearchOption.AllDirectories).Length, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
62+
Assert.IsGreaterThan(0, Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_hang.dmp", SearchOption.AllDirectories).Length, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'");
6363
}
6464

6565
public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)

0 commit comments

Comments
 (0)