Răsfoiți Sursa

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>
Patrick Havelange 5 ani în urmă
părinte
comite
63966e56a3
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      support/testing/infra/basetest.py

+ 6 - 0
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)