mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 12:44:10 -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>
(cherry picked from commit 03783de150)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
parent
6bd78ceced
commit
aeb8e127a2
1 changed files with 11 additions and 0 deletions
|
|
@ -91,3 +91,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))
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue