def askUser(self, test, allowView, process=None): versions = test.app.getSaveableVersions() options = "" for i in range(len(versions)): options += "Save Version " + versions[i] + "(" + str(i + 1) + "), " options += "Save(s) or continue(any other key)?" if allowView: options = "View details(v), " + options plugins.log.info(self.getPrefix(test) + options) response = sys.stdin.readline() exactSave = response.find('+') != -1 if response.startswith('s'): self.save(test, version="", exact=exactSave) elif allowView and response.startswith('v'): return 1 else: for i in range(len(versions)): versionOption = str(i + 1) if response.startswith(versionOption): self.save(test, versions[i], exactSave) if process: sleep(int(os.getenv("TEXTTEST_KILL_GRAPHICAL_CONSOLE_SLEEP", "0"))) plugins.log.info("Terminating graphical viewer...") killSubProcessAndChildren(process) return 0
def notifyKillProcesses(self, sig=None): # Don't leak processes if len(self.processesForKill) == 0: return self.notify("Status", "Terminating all external viewers ...") for pid, (process, description) in self.processesForKill.items(): if self.exitHandlers.has_key(pid): self.exitHandlers.pop(pid) # don't call exit handlers in this case, we're terminating self.notify("ActionProgress", "") guilog.info("Killing '" + description + "' interactive process") killSubProcessAndChildren(process, sig)
def killProcess(self, test): machine = test.app.getRunMachine() if machine != "localhost" and test.getConfigValue("remote_shell_program") == "ssh": self.killRemoteProcess(test, machine) self.killDiag.info("Killing running test (process id " + str(self.currentProcess.pid) + ")") killSubProcessAndChildren(self.currentProcess, cmd=test.getConfigValue("kill_command"))
def kill(self, test, sig): if self.collationProc: proc = self.collationProc self.collationProc = None killSubProcessAndChildren(proc, cmd=test.getConfigValue("kill_command"))