From 2339a410b347ece896b3cdcd877f4a52018b0863 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 18 Feb 2019 16:57:07 +0100 Subject: [PATCH] [xharness] Add UI option to disable auto-clean for successful test runs. (#5621) By default xharness will clean the project after a successful test run (which can be required if running many device tests without enormous amounts of disk space). However, sometimes this can be annoying, in particular if trying to re-run a particular test manually. So add an option in the UI to make cleaning optional. --- tests/xharness/Jenkins.cs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index 1fc8295583..8148c03afa 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -38,6 +38,8 @@ namespace xharness public bool IncludeXtro; public bool IncludeDocs; + public bool CleanSuccessfulTestRuns = true; + public Log MainLog; public Log SimulatorLoadLog; public Log DeviceLoadLog; @@ -1126,6 +1128,22 @@ namespace xharness response.ContentType = System.Net.Mime.MediaTypeNames.Text.Html; GenerateReportImpl (response.OutputStream); break; + case "/set-option": + response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain; + switch (request.Url.Query) { + case "?clean": + CleanSuccessfulTestRuns = true; + break; + case "?do-not-clean": + CleanSuccessfulTestRuns = false; + break; + default: + throw new NotImplementedException (request.Url.Query); + } + using (var writer = new StreamWriter (response.OutputStream)) { + writer.WriteLine ("OK"); + } + break; case "/select": case "/deselect": response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain; @@ -1659,13 +1677,20 @@ namespace xharness "); if (IsServerMode) { - writer.WriteLine (@" + writer.WriteLine ($@"
  • Reload -
  • "); + + +
  • Options + +
  • + "); } writer.WriteLine (""); } @@ -3379,7 +3404,7 @@ namespace xharness MainLog.WriteLine ($"Post-run uninstall failed, exit code: {uninstall_result.ExitCode} (this won't affect the test result)"); // Also clean up after us locally. - if (Harness.InJenkins || Harness.InWrench || Succeeded) + if (Harness.InJenkins || Harness.InWrench || (Jenkins.CleanSuccessfulTestRuns && Succeeded)) await BuildTask.CleanAsync (); } }