From 63966e56a3cd83df36c6357be9e48608e95dac54 Mon Sep 17 00:00:00 2001 From: Patrick Havelange Date: Wed, 20 Nov 2019 14:39:51 +0100 Subject: [PATCH] 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 --- support/testing/infra/basetest.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.30.2