[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.
This commit is contained in:
Rolf Bjarne Kvinge 2019-02-18 16:57:07 +01:00 коммит произвёл GitHub
Родитель b0975fb7c1
Коммит 2339a410b3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -38,6 +38,8 @@ namespace xharness
public bool IncludeXtro; public bool IncludeXtro;
public bool IncludeDocs; public bool IncludeDocs;
public bool CleanSuccessfulTestRuns = true;
public Log MainLog; public Log MainLog;
public Log SimulatorLoadLog; public Log SimulatorLoadLog;
public Log DeviceLoadLog; public Log DeviceLoadLog;
@ -1126,6 +1128,22 @@ namespace xharness
response.ContentType = System.Net.Mime.MediaTypeNames.Text.Html; response.ContentType = System.Net.Mime.MediaTypeNames.Text.Html;
GenerateReportImpl (response.OutputStream); GenerateReportImpl (response.OutputStream);
break; 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 "/select":
case "/deselect": case "/deselect":
response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain; response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain;
@ -1659,13 +1677,20 @@ namespace xharness
</ul> </ul>
</li>"); </li>");
if (IsServerMode) { if (IsServerMode) {
writer.WriteLine (@" writer.WriteLine ($@"
<li>Reload <li>Reload
<ul> <ul>
<li class=""adminitem""><a href='javascript:sendrequest (""reload-devices"");'>Devices</a></li> <li class=""adminitem""><a href='javascript:sendrequest (""reload-devices"");'>Devices</a></li>
<li class=""adminitem""><a href='javascript:sendrequest (""reload-simulators"");'>Simulators</a></li> <li class=""adminitem""><a href='javascript:sendrequest (""reload-simulators"");'>Simulators</a></li>
</ul> </ul>
</li>"); </li>
<li>Options
<ul>
<li class=""adminitem""><span id='{id_counter++}' class='autorefreshable'><a href='javascript:sendrequest (""set-option?{(CleanSuccessfulTestRuns ? "do-not-clean" : "clean")}"");'>&#x{(CleanSuccessfulTestRuns ? "2705" : "274C")} Clean successful test runs</a></span></li>
</ul>
</li>
");
} }
writer.WriteLine ("</ul>"); writer.WriteLine ("</ul>");
} }
@ -3379,7 +3404,7 @@ namespace xharness
MainLog.WriteLine ($"Post-run uninstall failed, exit code: {uninstall_result.ExitCode} (this won't affect the test result)"); MainLog.WriteLine ($"Post-run uninstall failed, exit code: {uninstall_result.ExitCode} (this won't affect the test result)");
// Also clean up after us locally. // Also clean up after us locally.
if (Harness.InJenkins || Harness.InWrench || Succeeded) if (Harness.InJenkins || Harness.InWrench || (Jenkins.CleanSuccessfulTestRuns && Succeeded))
await BuildTask.CleanAsync (); await BuildTask.CleanAsync ();
} }
} }