From c207a34872be923887feb834fb3971213bfe61d4 Mon Sep 17 00:00:00 2001
From: Sebastian Goscik <sebastian.goscik@live.co.uk>
Date: Thu, 2 Jun 2016 15:14:03 +0100
Subject: [PATCH] cpustates: Now shows a warning when it fails to nudge a core.

Before WA would raise a error message that wasn't very clear.
Now when cpustates tries to nudge cores and and error occurs it
will only show a warning (which promts users to check if the cpu is
hot plugged out) and keep going with the reset of the run without
causing errors in other WA extensions.
---
 wlauto/result_processors/cpustate.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/wlauto/result_processors/cpustate.py b/wlauto/result_processors/cpustate.py
index 5bf20f44..7bc6847b 100755
--- a/wlauto/result_processors/cpustate.py
+++ b/wlauto/result_processors/cpustate.py
@@ -19,7 +19,7 @@ from collections import OrderedDict
 
 from wlauto import ResultProcessor, Parameter
 from wlauto.core import signal
-from wlauto.exceptions import ConfigError
+from wlauto.exceptions import ConfigError, DeviceError
 from wlauto.instrumentation import instrument_is_installed
 from wlauto.utils.power import report_power_stats
 from wlauto.utils.misc import unique
@@ -169,7 +169,10 @@ class CpuStatesProcessor(ResultProcessor):
         self.logger.debug('Nudging all cores awake...')
         for i in xrange(len(device.core_names)):
             command = device.busybox + ' taskset 0x{:x} {}'
-            device.execute(command.format(1 << i, 'ls'))
+            try:
+                device.execute(command.format(1 << i, 'ls'))
+            except DeviceError:
+                self.logger.warning("Failed to nudge CPU %s, has it been hot plugged out?", i)
 
     def process_iteration_result(self, result, context):
         trace = context.get_artifact('txttrace')