From 9e12930a4332bf2b9dc57dac9e9e44029b04cb26 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Tue, 8 Sep 2015 17:42:18 +0100 Subject: [PATCH] dhrystone: kill any running instances during setup (also handle CTRL-C). --- wlauto/workloads/dhrystone/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wlauto/workloads/dhrystone/__init__.py b/wlauto/workloads/dhrystone/__init__.py index 6d43e988..48ca0cac 100644 --- a/wlauto/workloads/dhrystone/__init__.py +++ b/wlauto/workloads/dhrystone/__init__.py @@ -76,9 +76,14 @@ class Dhrystone(Workload): execution_mode, self.threads, self.delay) self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300 + self.device.killall('dhrystone') def run(self, context): - self.output = self.device.execute(self.command, timeout=self.timeout, check_exit_code=False) + try: + self.output = self.device.execute(self.command, timeout=self.timeout, check_exit_code=False) + except KeyboardInterrupt: + self.device.killall('dhrystone') + raise def update_result(self, context): outfile = os.path.join(context.output_directory, 'dhrystone.output')