Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests ran counter #111145

Merged
merged 6 commits into from
Feb 3, 2025
Merged

Tests ran counter #111145

merged 6 commits into from
Feb 3, 2025

Conversation

VincentBu
Copy link
Contributor

Record how many times each test ran for. (even if the run is terminated manually)

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 7, 2025
@VincentBu VincentBu requested review from cshung and mrsharm January 7, 2025 09:25
Copy link
Contributor

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

@@ -22,6 +22,7 @@
using System.Linq;

using System.Runtime.Loader;
using Microsoft.CodeAnalysis.CSharp.Syntax;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed

public void RecordTestRanCount()
{
StringBuilder sb = new();
foreach(var item in _testRanCounter)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When called via the CancelKeyPress event, the test will still be running while this code executes. Use _testRanCounterLock here.

Comment on lines 1226 to 1230
if (!_testRanCounter.Keys.Contains(testRefOrID))
{
_testRanCounter[testRefOrID] = 0;
}
_testRanCounter[testRefOrID] ++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(purely a style comment)

You can use _testRanCounter[testRefOrId] = _testRanCounter.GetValueOrDefault(testRefOrId, 0) + 1

(you can even leave off the 0 and use the other GetValueOrDefault overload since 0 is the default value for uint)

sb.AppendLine($"{item.Key}: {item.Value}");
}
}
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, $"Tests ran count:\n{sb}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Tests run* count.

@@ -161,6 +163,11 @@ public static int Main(string[] args)

ReliabilityFramework rf = new ReliabilityFramework();
rf._logger.WriteToInstrumentationLog(null, LoggingLevels.StartupShutdown, "Started");

Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs args) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Since you aren't using either of the parameters of the delegate, you could easily set them to _ to indicate that they aren't used i.e.,

csharp Console.CancelKeyPress += (object _, ConsoleCancelEventArgs _) => { .. }

@@ -314,6 +321,19 @@ public static int Main(string[] args)
return (retVal);
}

public void RecordTestRanCount()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: The name RecordTestRunCount seems more apt.

Copy link
Member

@mrsharm mrsharm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mrsharm mrsharm merged commit b2a6266 into dotnet:main Feb 3, 2025
74 checks passed
grendello added a commit to grendello/runtime that referenced this pull request Feb 4, 2025
* main: (30 commits)
  JIT: Optimize bit-wise AND with a constant mask in combination with a left shift in a compare (dotnet#111979)
  Change how we build the cross-OS DAC to support building in the VMR (dotnet#111927)
  Add Windows Server 2025 to test configurations (dotnet#111938)
  [PERF] Move performance testing YAML from dotnet/runtime to dotnet/performance (dotnet#111454)
  arm64: Add support for Bitwise OR NOT & XOR NOT (dotnet#111893)
  JIT: Fix cross crossgen comparison failures (dotnet#112078)
  Bump `StyleCop.Analyzers` to `1.2.0-beta.556` (dotnet#111278)
  Remove `RequiresProcessIsolation` on InterfaceFolding tests (dotnet#112098)
  Use hardlinks in helixpublishwitharcade (dotnet#112091)
  Update breaking change rules regarding byref/objref fields. (dotnet#112087)
  [daccess] Do not use USE_DAC_TABLE_RVA on Apple platforms (dotnet#112076)
  use collection syntax in illink (dotnet#108458)
  Include PDB for all TfmRuntimeSpecificPackageFile (dotnet#111879)
  [main] Update dependencies from dotnet/emsdk (dotnet#111690)
  Enable Mono tests (dotnet#111981)
  Let the debugger knows DATAS is on (dotnet#107115)
  Tests ran counter (dotnet#111145)
  Some System.Decimal performance improvements (dotnet#99212)
  [mono][mini] Remove support for the Xamarin.iOS and Xamarin.Mac assemblies in the AOT compiler. (dotnet#108886)
  Remove one usage of `Unsafe.AsPointer`. (dotnet#112079)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GC-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants