[xharness] Cleanup must be done by the last test, not the first test.

This commit is contained in:
Rolf Bjarne Kvinge 2016-06-15 23:48:42 -07:00
Родитель cf060f4611
Коммит bd993fbe0d
2 изменённых файлов: 19 добавлений и 4 удалений

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

@ -598,7 +598,7 @@ namespace xharness
File.WriteAllText (run_log.Path, proc.ReadCurrentOutput ());
// cleanup after us
KillEverything ();
CleanupSimulator ();
} else {
FindDevice ();
@ -822,11 +822,16 @@ namespace xharness
return rv;
}
void KillEverything ()
void CleanupSimulator ()
{
if (SkipSimulatorCleanup)
return;
KillEverything ();
}
public void KillEverything ()
{
var to_kill = new string [] { "iPhone Simulator", "iOS Simulator", "Simulator", "Simulator (Watch)", "com.apple.CoreSimulator.CoreSimulatorService" };
foreach (var k in to_kill)
ExecuteCommand ("killall", "-9 \"" + k + "\"", true, output_verbosity_level: 1);

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

@ -892,6 +892,13 @@ function toggleContainerVisibility (containerName)
}
}
public Task CleanupSimulatorAsync ()
{
if (runner != null)
runner.KillEverything ();
return Task.FromResult (true);
}
public Task PrepareSimulatorAsync (bool initialize)
{
if (Finished)
@ -907,7 +914,7 @@ function toggleContainerVisibility (containerName)
Harness = Harness,
ProjectFile = ProjectFile,
SkipSimulatorSetup = !initialize,
SkipSimulatorCleanup = !initialize,
SkipSimulatorCleanup = true,
Target = AppRunnerTarget,
LogDirectory = LogDirectory,
};
@ -990,6 +997,9 @@ function toggleContainerVisibility (containerName)
run_timer.Start ();
foreach (var task in Tasks)
await task.RunAsync ();
await Tasks.Last ().CleanupSimulatorAsync ();
run_timer.Stop ();
}