From 7f64b1874c22b52259a8380de13d824e6b0ce2c8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 31 Jul 2016 17:35:03 -0600 Subject: 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: Simon Glass Reported-by: Tom Rini Fixes: 9e17b034 (test/py: Provide a way to check that a command fails) --- test/py/u_boot_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/py/u_boot_utils.py') diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py index e358c58..d71348f 100644 --- a/test/py/u_boot_utils.py +++ b/test/py/u_boot_utils.py @@ -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.run(cmd) except Exception as e: + assert(retcode == runner.exit_status) assert(msg in runner.output) 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: runner.close() -- cgit v1.1