Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <llsan@microsoft.com>2018-07-19 12:01:33 +0300
committerGitHub <noreply@github.com>2018-07-19 12:01:33 +0300
commit827c074a2ee451386a8ddad7ad438f1ac096e21a (patch)
tree5470d29fb53f1373a56c3b778cbe532b5afe9e61 /main/src/addins/MonoDevelop.UnitTesting
parent493af9dad5e7d641a645768948b5b44acd500432 (diff)
parenta2e1a827c3c9cde75e0107fabf82edbd51958bc7 (diff)
Merge pull request #5408 from mono/fast-build-check-for-test
Fast build check for test
Diffstat (limited to 'main/src/addins/MonoDevelop.UnitTesting')
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs36
1 files changed, 15 insertions, 21 deletions
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs
index 865e531c30..8ebf9a13c3 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs
@@ -105,7 +105,7 @@ namespace MonoDevelop.UnitTesting
public static AsyncOperation RunTest (UnitTest test, MonoDevelop.Projects.ExecutionContext context)
{
- var result = RunTest (test, context, IdeApp.Preferences.BuildBeforeRunningTests);
+ var result = RunTest (test, context, true);
result.Task.ContinueWith (t => OnTestSessionCompleted (), TaskScheduler.FromCurrentSynchronizationContext ());
return result;
}
@@ -126,32 +126,26 @@ namespace MonoDevelop.UnitTesting
if (buildOwnerObject) {
var build_targets = new HashSet<IBuildTarget> ();
foreach (var t in tests) {
- IBuildTarget bt = t.OwnerObject as IBuildTarget;
- if (bt != null)
+ if (t.OwnerObject is IBuildTarget bt)
build_targets.Add (bt);
}
- if (build_targets.Count > 0) {
- if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) {
- MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations ();
- await IdeApp.ProjectOperations.CurrentRunOperation.Task;
- }
- foreach (var bt in build_targets) {
- var res = await IdeApp.ProjectOperations.Build (bt, cs.Token).Task;
- if (res.HasErrors)
- return;
- }
+ var res = await IdeApp.ProjectOperations.CheckAndBuildForExecute (
+ build_targets, IdeApp.Workspace.ActiveConfiguration, IdeApp.Preferences.BuildBeforeRunningTests,
+ false, null, cs.Token);
+
+ if (!res)
+ return;
- var test_names = new HashSet<string> (tests.Select ((v) => v.FullName));
+ var test_names = new HashSet<string> (tests.Select ((v) => v.FullName));
- await RefreshTests (cs.Token);
+ await RefreshTests (cs.Token);
- tests = test_names.Select ((fullName) => SearchTest (fullName)).Where ((t) => t != null).ToList ();
+ tests = test_names.Select ((fullName) => SearchTest (fullName)).Where ((t) => t != null).ToList ();
- if (tests.Any ())
- await RunTests (tests, context, false, checkCurrentRunOperation, cs);
- return;
- }
+ if (tests.Any ())
+ await RunTests (tests, context, false, checkCurrentRunOperation, cs);
+ return;
}
if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation ())
@@ -176,7 +170,7 @@ namespace MonoDevelop.UnitTesting
public static AsyncOperation RunTests (IEnumerable<UnitTest> tests, MonoDevelop.Projects.ExecutionContext context)
{
- var result = RunTests (tests, context, IdeApp.Preferences.BuildBeforeRunningTests);
+ var result = RunTests (tests, context);
result.Task.ContinueWith (t => OnTestSessionCompleted (), TaskScheduler.FromCurrentSynchronizationContext ());
return result;
}