From 01a03d0e07dbf65f0af198c34b59528d993935a2 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 6 Feb 2017 21:35:37 +0100 Subject: [PATCH] Add support for "wait" option --- sbysrc/sby_core.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index fc630ba..b822343 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -66,7 +66,9 @@ class SbyTask: if self.exit_callback is not None: self.exit_callback(retcode) - def terminate(self): + def terminate(self, timeout=False): + if self.job.waitmode and not timeout: + return if self.running: self.job.log("%s: terminating process" % self.info) self.p.terminate() @@ -241,7 +243,7 @@ class SbyJob: if total_clock_time > int(self.options["timeout"]): self.log("Reached TIMEOUT (%d seconds). Terminating all tasks." % int(self.options["timeout"])) self.status = "TIMEOUT" - self.terminate() + self.terminate(timeout=True) def log(self, logmessage): print("%s %s" % (self.logprefix, logmessage)) @@ -332,9 +334,9 @@ class SbyJob: self.models[model_name] = self.make_model(model_name) return self.models[model_name] - def terminate(self): + def terminate(self, timeout=False): for task in self.tasks_running: - task.terminate() + task.terminate(timeout=timeout) def update_status(self, new_status): assert new_status in ["PASS", "FAIL", "UNKNOWN", "ERROR"] @@ -365,6 +367,10 @@ class SbyJob: if "expect" in self.options: self.expect = self.options["expect"].upper().split(",") + self.waitmode = False + if "wait" in self.options: + self.waitmode = self.options["wait"] == "on" + self.copy_src() if self.options["mode"] == "bmc": -- 2.30.2