From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] test/py: fix timeout to be absolute
Date: Thu, 21 Jan 2016 10:40:43 +0100 [thread overview]
Message-ID: <20160121104043.07a1b194@amdc2363> (raw)
In-Reply-To: <1453328158-23818-1-git-send-email-swarren@wwwdotorg.org>
Hi Stephen,
> From: Stephen Warren <swarren@nvidia.com>
>
> Currently, Spawn.expect() imposes its timeout solely upon receipt of
> new data, not on its overall operation. In theory, this could cause
> the timeout not to fire if U-Boot continually generated output that
> did not match the expected patterns.
>
> Fix the code to additionally impose a timeout on overall operation,
> which is the intended mode of operation.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> test/py/u_boot_spawn.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
> index 1baee63df25c..df4c67597cab 100644
> --- a/test/py/u_boot_spawn.py
> +++ b/test/py/u_boot_spawn.py
> @@ -122,6 +122,7 @@ class Spawn(object):
> if type(patterns[pi]) == type(''):
> patterns[pi] = re.compile(patterns[pi])
>
> + tstart_s = time.time()
> try:
> while True:
> earliest_m = None
> @@ -142,7 +143,11 @@ class Spawn(object):
> self.after = self.buf[pos:posafter]
> self.buf = self.buf[posafter:]
> return earliest_pi
> - events = self.poll.poll(self.timeout)
> + tnow_s = time.time()
> + tdelta_ms = (tnow_s - tstart_s) * 1000
> + if tdelta_ms > self.timeout:
> + raise Timeout()
> + events = self.poll.poll(self.timeout - tdelta_ms)
> if not events:
> raise Timeout()
> c = os.read(self.fd, 1024)
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2016-01-21 9:40 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
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 ` Lukasz Majewski [this message]
2016-01-22 3:35 ` [U-Boot] [PATCH 1/8] test/py: fix timeout to be absolute 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=20160121104043.07a1b194@amdc2363 \
--to=l.majewski@samsung.com \
--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