Skip to content
Snippets Groups Projects
Commit 7f64b187 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

test: Check exit status in run_and_log_expect_exception()


This check was missed. Add it and make the message more verbose.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reported-by: default avatarTom Rini <trini@konsulko.com>
Fixes: 9e17b034 (test/py: Provide a way to check that a command fails)
parent bcbd0c8f
Branches
Tags
No related merge requests found
...@@ -102,6 +102,7 @@ class RunAndLog(object): ...@@ -102,6 +102,7 @@ class RunAndLog(object):
self.name = name self.name = name
self.chained_file = chained_file self.chained_file = chained_file
self.output = None self.output = None
self.exit_status = None
def close(self): def close(self):
"""Clean up any resources managed by this object.""" """Clean up any resources managed by this object."""
...@@ -166,6 +167,7 @@ class RunAndLog(object): ...@@ -166,6 +167,7 @@ class RunAndLog(object):
# Store the output so it can be accessed if we raise an exception. # Store the output so it can be accessed if we raise an exception.
self.output = output self.output = output
self.exit_status = exit_status
if exception: if exception:
raise exception raise exception
return output return output
......
...@@ -201,9 +201,11 @@ def run_and_log_expect_exception(u_boot_console, cmd, retcode, msg): ...@@ -201,9 +201,11 @@ def run_and_log_expect_exception(u_boot_console, cmd, retcode, msg):
runner = u_boot_console.log.get_runner(cmd[0], sys.stdout) runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
runner.run(cmd) runner.run(cmd)
except Exception as e: except Exception as e:
assert(retcode == runner.exit_status)
assert(msg in runner.output) assert(msg in runner.output)
else: else:
raise Exception('Expected exception, but not raised') raise Exception("Expected an exception with retcode %d message '%s',"
"but it was not raised" % (retcode, msg))
finally: finally:
runner.close() runner.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment