From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/14] test/py: Provide a way to check that a command fails
Date: Thu, 7 Jul 2016 11:03:51 -0600 [thread overview]
Message-ID: <577E8B77.9020605@wwwdotorg.org> (raw)
In-Reply-To: <1467560446-10628-10-git-send-email-sjg@chromium.org>
On 07/03/2016 09:40 AM, Simon Glass wrote:
> Sometimes we want to run a command and check that it fails. Add a function
> to handle this. It can check the return code and also make sure that the
> output contains a given error message.
> diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
> +def run_and_log_expect_exception(u_boot_console, cmd, retcode, msg):
> + """Run a command which is expected to fail.
> +
> + This runs a command and checks that it fails with the expected return code
> + and exception method. If not, an exception is raised.
> +
> + Args:
> + u_boot_console: A console connection to U-Boot.
> + cmd: The command to run, as an array of argv[].
> + retcode: Expected non-zero return code from the command.
> + msg: String which should be contained within the command's output.
> + """
retcode isn't used anywhere. Do we care what the return code is, so long
as it's something non-zero, and the desired exception message appears?
next prev parent reply other threads:[~2016-07-07 17:03 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-03 15:40 [U-Boot] [PATCH 00/14] test/py: Convert vboot tests to use the test/py framework Simon Glass
2016-07-03 15:40 ` [U-Boot] [PATCH 01/14] test: Add a README Simon Glass
2016-07-03 20:17 ` Teddy Reed
2016-07-03 21:16 ` Simon Glass
2016-07-16 13:49 ` [U-Boot] [U-Boot,01/14] " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 02/14] test: Add a simple script to run tests on sandbox Simon Glass
2016-07-03 20:41 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 03/14] sandbox: Don't exit when bootm completes Simon Glass
2016-07-03 20:31 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 04/14] test/py: Allow tests to control the sandbox device-tree file Simon Glass
2016-07-03 20:18 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 05/14] test/py: Allow RunAndLog() to return the output Simon Glass
2016-07-03 20:43 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 06/14] test/py: Provide output from exceptions with RunAndLog() Simon Glass
2016-07-03 20:49 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 07/14] test/py: Return output from run_and_log() Simon Glass
2016-07-03 21:08 ` Teddy Reed
2016-07-16 13:49 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 08/14] test/py: Add an option to execute a string containing a command Simon Glass
2016-07-03 20:25 ` Teddy Reed
2016-07-07 17:02 ` Stephen Warren
2016-07-07 17:07 ` Stephen Warren
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 09/14] test/py: Provide a way to check that a command fails Simon Glass
2016-07-03 21:06 ` Teddy Reed
2016-07-07 17:03 ` Stephen Warren [this message]
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 10/14] test/py: Add a helper to run a list of U-Boot commands Simon Glass
2016-07-03 21:12 ` Teddy Reed
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-16 13:50 ` Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 11/14] tools: Add an error code when fit_handle_file() fails Simon Glass
2016-07-03 20:09 ` Teddy Reed
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 12/14] tools: Correct error handling in fit_image_process_hash() Simon Glass
2016-07-03 21:16 ` Teddy Reed
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 13/14] test/py: Fix up after the rename of CONFIG_SYS_HUSH_PARSER Simon Glass
2016-07-03 21:13 ` Teddy Reed
2016-07-07 17:12 ` Stephen Warren
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
2016-07-03 15:40 ` [U-Boot] [PATCH 14/14] test: Convert the vboot test to test/py Simon Glass
2016-07-03 21:38 ` Teddy Reed
2016-07-03 23:19 ` Simon Glass
2016-07-07 18:01 ` Stephen Warren
2016-07-07 18:00 ` Stephen Warren
2016-07-16 13:50 ` [U-Boot] [U-Boot, " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=577E8B77.9020605@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox