From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] test/py: add various utility code
Date: Fri, 22 Jan 2016 09:45:13 -0700 [thread overview]
Message-ID: <56A25C99.2080902@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ1pm_durLqBkYtQoY_iXmC94wAq=fpjukVOp=DpYc3HwQ@mail.gmail.com>
On 01/21/2016 08:36 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 20 January 2016 at 15:15, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> Add various common utility functions. These will be used by a forthcoming
>> re-written UMS test, and a brand-new DFU test.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> test/py/u_boot_console_base.py | 19 +++++
>> test/py/u_boot_utils.py | 171 +++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 190 insertions(+)
>> create mode 100644 test/py/u_boot_utils.py
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
>> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
>> index 433bec6e9fdd..06f61f987180 100644
>> --- a/test/py/u_boot_console_base.py
>> +++ b/test/py/u_boot_console_base.py
>> @@ -215,6 +215,25 @@ class ConsoleBase(object):
>> self.log.action('Sending Ctrl-C')
>> self.run_command(chr(3), wait_for_echo=False, send_nl=False)
>>
>> + def wait_for(self, text):
>> + '''Wait for a pattern to be emitted by U-Boot.
>
> I meant to say we should use """ for function comments to keep it
> consistent with the rest of U-Boot. Maybe could adjust this in a
> follow-on patch?
That feels inconsistent with using ' for strings everywhere else. I
don't see a good reason why the docstrings should use a different quote
character. Should the existing Python code be made consistent instead?
>> +
>> + This is useful when a long-running command such as "dfu" is executing,
>> + and it periodically emits some text that should show up at a specific
>> + location in the log file.
>> +
>> + Args:
>> + text: The text to wait for; either a string (containing raw text,
>> + not a regular expression) or an re object.
>> +
>> + Returns:
>> + Nothing.
>> + '''
>> +
>> + if type(text) == type(''):
>> + text = re.escape(text)
>> + self.p.expect([text])
>
> Does this potentially wait forever?
The expect() function throws a Timeout exception if none of the
strings/regexs passed to it match within the defined timeout (which is
stored in self.p.timeout).
next prev parent reply other threads:[~2016-01-22 16:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 22:15 [U-Boot] [PATCH 1/8] test/py: fix timeout to be absolute Stephen Warren
2016-01-20 22:15 ` [U-Boot] [PATCH 2/8] test/py: move U-Boot respawn trigger to the test core Stephen Warren
2016-01-22 3:35 ` Simon Glass
2016-01-20 22:15 ` [U-Boot] [PATCH 3/8] test/py: drain console log at the end of any failed test Stephen Warren
2016-01-22 3:36 ` Simon Glass
2016-01-20 22:15 ` [U-Boot] [PATCH 4/8] test/py: log when tests send CTRL-C Stephen Warren
2016-01-22 3:36 ` Simon Glass
2016-01-20 22:15 ` [U-Boot] [PATCH 5/8] test/py: optionally ignore errors from shell commands Stephen Warren
2016-01-22 3:36 ` Simon Glass
2016-01-20 22:15 ` [U-Boot] [PATCH 6/8] test/py: add various utility code Stephen Warren
2016-01-22 3:36 ` Simon Glass
2016-01-22 16:45 ` Stephen Warren [this message]
2016-01-22 16:49 ` Stephen Warren
2016-01-20 22:15 ` [U-Boot] [PATCH 7/8] test/py: ums: add filesystem-based testing Stephen Warren
2016-01-21 11:26 ` Lukasz Majewski
2016-01-22 3:36 ` Simon Glass
2016-01-20 22:15 ` [U-Boot] [PATCH 8/8] test/py: add DFU test Stephen Warren
2016-01-21 10:50 ` Lukasz Majewski
2016-01-21 18:17 ` Stephen Warren
2016-01-22 3:36 ` Simon Glass
2016-01-21 9:40 ` [U-Boot] [PATCH 1/8] test/py: fix timeout to be absolute Lukasz Majewski
2016-01-22 3:35 ` Simon Glass
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=56A25C99.2080902@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