From: Patrick Havelange Date: Wed, 20 Nov 2019 13:39:51 +0000 (+0100) Subject: support/testing: add assertRunOk method to BRTest class X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63966e56a3cd83df36c6357be9e48608e95dac54;p=buildroot.git 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 Signed-off-by: Thomas Petazzoni --- diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py index a176bc328a..023039f6af 100644 --- a/support/testing/infra/basetest.py +++ b/support/testing/infra/basetest.py @@ -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)