support/testing: add assertRunOk method to BRTest class

This method asserts that the given command ran successfully.
The goal is for it to be used by the different tests when needed.

Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Patrick Havelange 2019-11-20 14:39:51 +01:00 committed by Thomas Petazzoni
parent a3a4b092c8
commit 63966e56a3

View File

@ -84,3 +84,9 @@ class BRTest(BRConfigTest):
if self.emulator:
self.emulator.stop()
super(BRTest, self).tearDown()
# Run the given 'cmd' with a 'timeout' on the target and
# assert that the command succeeded
def assertRunOk(self, cmd, timeout=-1):
_, exit_code = self.emulator.run(cmd, timeout)
self.assertEqual(exit_code, 0)