mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
support/testing: infra: add assertRunNotOk()
There are a number of runtime tests that checks that a command fails as expected, so add an assertRunNotOk() similar to the existing assertRunOk() to handle that instead of open coding it everywhere. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Fiona Klute <fiona.klute@gmx.de> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
@@ -150,3 +150,14 @@ class BRTest(BRConfigTest):
|
||||
0,
|
||||
"\nFailed to run: {}\noutput was:\n{}".format(cmd, ' '+'\n '.join(out))
|
||||
)
|
||||
|
||||
# Run the given 'cmd' with a 'timeout' on the target and
|
||||
# assert that the command fails; on success, print the
|
||||
# faulty command and its output
|
||||
def assertRunNotOk(self, cmd, timeout=-1):
|
||||
out, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertNotEqual(
|
||||
exit_code,
|
||||
0,
|
||||
"\nUnexpected success: {}\noutput was:\n{}".format(cmd, ' '+'\n '.join(out))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user