From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Thu, 19 May 2016 07:58:18 +0200 Subject: [U-Boot] [PATCH v2] test/py: Support setting up specific timeout In-Reply-To: <573CBBD6.4090804@wwwdotorg.org> References: <24750597429bfd579c2463bb17e2a1f262f02f83.1463590854.git.michal.simek@xilinx.com> <573CBBD6.4090804@wwwdotorg.org> Message-ID: <573D55FA.4010100@xilinx.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 18.5.2016 21:00, Stephen Warren wrote: > On 05/18/2016 11:00 AM, Michal Simek wrote: >> Large file transfers, flash erasing and more complicated tests >> requires more time to finish. Provide a way to setup specific >> timeout directly in test. >> >> For example description for 50s test: >> timeout = 50000 >> with u_boot_console.temporary_timeout(timeout): >> u_boot_console.run_command(...) > >> diff --git a/test/py/u_boot_console_base.py >> b/test/py/u_boot_console_base.py > >> +class ConsoleSetupTimeout(object): > >> + def __init__(self, console, timeout): >> + self.p = console.p >> + self.orig_timeout = self.p.timeout >> + self.p.timeout = timeout > >> + def __exit__(self, extype, value, traceback): >> + if not self.p: >> + return > > That test can't fail, since __init__ already used self.p in a way that > would have triggered an exception during the constructor, which I > believe would cause neither __enter__ nor __exit__ to ever be called > since the object would not exist. > > Still, this does no harm, so either way, > Reviewed-by: Stephen Warren I have tested it without that checking and you are right. I have sent v3 which remove this with your Reviewed-by line. Thanks, Michal