aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2017-10-04 17:32:32 +0100
committerBrendan Jackman <brendan.jackman@arm.com>2017-10-09 18:25:03 +0100
commitdbe568f51be54c4cb2db9540489c8a0de5c6a19b (patch)
tree16b223c4282d8f050ae21d16af32d648b31f36d2
parent0b04ffcc443f27424146905a0525491f90cd084c (diff)
downloaddevlib-dbe568f51be54c4cb2db9540489c8a0de5c6a19b.tar.gz
acmecape: Add check for nonzero return code from iio-capture
-rw-r--r--devlib/instrument/acmecape.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py
index 5300343..0b10d08 100644
--- a/devlib/instrument/acmecape.py
+++ b/devlib/instrument/acmecape.py
@@ -77,17 +77,22 @@ class AcmeCapeInstrument(Instrument):
def stop(self):
self.process.terminate()
timeout_secs = 10
+ output = ''
for _ in xrange(timeout_secs):
if self.process.poll() is not None:
break
time.sleep(1)
else:
- output = _read_nonblock(self.process.stdout)
+ output += _read_nonblock(self.process.stdout)
self.process.kill()
self.logger.error('iio-capture did not terminate gracefully')
if self.process.poll() is None:
msg = 'Could not terminate iio-capture:\n{}'
raise HostError(msg.format(output))
+ if self.process.returncode != 15: # iio-capture exits with 15 when killed
+ output += self.process.stdout.read()
+ raise HostError('iio-capture exited with an error ({}), output:\n{}'
+ .format(self.process.returncode, output))
if not os.path.isfile(self.raw_data_file):
raise HostError('Output CSV not generated.')