Skip to content

Commit

Permalink
Robot-merge branch net232 into net232-dommes-bp-deferred-cache-merged…
Browse files Browse the repository at this point in the history
… by mikhail.ustinov <mikhail.ustinov@jetbrains.com>
  • Loading branch information
Merge Robot committed Jun 5, 2023
2 parents bced19c + 0d7887e commit 48f13c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected DelegatingDebuggerSessionOptions(IDebuggerSessionOptions debuggerSessi
public bool ForceLoadMethodByToken => DebuggerSessionOptionsImplementation.ForceLoadMethodByToken;
public HotReloadInfo HotReload => DebuggerSessionOptionsImplementation.HotReload;
public bool DisableRuntimeLoadTimeout => DebuggerSessionOptionsImplementation.DisableRuntimeLoadTimeout;
public bool DisableSteppingHandlers => DebuggerSessionOptionsImplementation.DisableSteppingHandlers;
public bool TrackHandledExceptionsInAsyncCode => DebuggerSessionOptionsImplementation.TrackHandledExceptionsInAsyncCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ private void RefreshAndRunTask(IUnitTestRun run, TaskCompletionSource<bool> tcs,
launch.ClientControllerInfo);
model.UnitTestLaunch.SetValue(launch);
SubscribeResults(run, lt, launch);
launch.RunResult.Advise(lt, result => { tcs.SetResult(result.Passed); });
StartTests(model, run, tcs, lt);
}
});
Expand Down Expand Up @@ -293,12 +294,9 @@ private Task Refresh(Lifetime lifetime, TaskCompletionSource<bool> tcs, Cancella

cancellationToken.Register(() =>
{
// On cancel we don't want to stop run, if tests are already running, but we want to stop, if we are waiting for refresh
if (refreshLifetimeDef.Lifetime.IsAlive)
{
tcs.TrySetCanceled();
refreshLifetimeDef.Terminate();
}
// We may not be able to stop tests in Unity, but still we need to allow stopping Rider part of the tests
tcs.TrySetCanceled();
refreshLifetimeDef.Terminate();
});

WaitForUnityEditorConnectedAndIdle(refreshLifetime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,20 @@ internal static void SupportAbortNew(UnitTestLaunch launch)
{
try
{
const string assemblyName = "UnityEditor.TestRunner";
const string typeName = "UnityEditor.TestTools.TestRunner.Api.TestRunnerApi";
const string methodName = "CancelAllTestRuns";

MethodInfo stopRunMethod = null;

var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name.Equals(assemblyName));
if (assembly == null)
ourLogger.Verbose($"Could not find {assemblyName} in the AppDomain.");
else
var riderPackageAssembly = RiderPackageInterop.GetAssembly();
var apiType = riderPackageAssembly?.GetType("Packages.Rider.Editor.UnitTesting.RiderTestRunner");
if (apiType == null)
{
var apiType = assembly.GetType(typeName);
if (apiType == null)
ourLogger.Verbose($"Could not find {typeName} in the {assemblyName}.");
else
{
stopRunMethod = apiType.GetMethod(methodName);
if (stopRunMethod == null)
ourLogger.Verbose($"Could not find {methodName} in the {typeName}.");
}
}
ourLogger.Verbose($"Could not find RiderTestRunner in the {riderPackageAssembly}.");
return;
};

var methodName = "CancelTestRun";
var stopRunMethod = apiType.GetMethod(methodName);
if (stopRunMethod == null)
stopRunMethod = apiType.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic);
if (stopRunMethod == null)
ourLogger.Verbose($"Could not find {methodName} in the {apiType.Name}.");

launch.Abort.Set((lifetime, _) =>
{
Expand Down

0 comments on commit 48f13c7

Please sign in to comment.