From patchwork Thu Jun 4 15:24:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 1303616 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=UelfZeKO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49d8qK1BqSz9sSc for ; Fri, 5 Jun 2020 01:30:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 51CD781E1E; Thu, 4 Jun 2020 17:24:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1591284251; bh=+jfJCRFy2sdLozCghC4hPST9+655ae9qYLyi9wLU058=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=UelfZeKOa9wDJqLDH0nqo6UmT+3s981ZqHPAd+shpIJ97Q8j9WSam/h+IuOX4BT9e uuNUhH5yVmC0ZZevFTOMyF1G7aDmGNdIqFGuK1H47mi5av0afb/WqWUxbh4+Ftmdtl Ws1UzLSWkRrw8vGcUcLogRJwUHd0lMWblrfP9KauhQ2YEA9y9OU1qIe2orgIqSXKId 1OHt9LXEirn+1SzqKxYl4hGbkBPQiMQLFRk22hbb2SWNQCql6TwgQ3UjA48r2vJ9t0 dNmRMAbQy08Yhwi2CNWvR8A/92wpfVwQCOqYywdPtJwgEGnLhEIkf78i8UAdTWDQ6x 1YWiQcg2/tgLg== Received: by phobos.denx.de (Postfix, from userid 109) id 812AC81E1E; Thu, 4 Jun 2020 17:24:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 031E881E17 for ; Thu, 4 Jun 2020 17:24:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=hs@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49d8h52jLnz1rrLR; Thu, 4 Jun 2020 17:24:05 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49d8h52TP5z1r56P; Thu, 4 Jun 2020 17:24:05 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id tDiz5zWxeYS0; Thu, 4 Jun 2020 17:24:04 +0200 (CEST) X-Auth-Info: rdGDF9boW8Rl/DhOC8HvppXJUeYNtVZNrsAdRnP6NpE= Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 4 Jun 2020 17:24:04 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id B1F9C186D8E; Thu, 4 Jun 2020 17:24:02 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 932251A006E; Thu, 4 Jun 2020 17:24:02 +0200 (CEST) From: Heiko Schocher To: U-Boot Mailing List Cc: Heiko Schocher , Simon Glass , Stephen Warren Subject: [PATCH] test_sleep.py: make sleep time and margin configurable Date: Thu, 4 Jun 2020 17:24:00 +0200 Message-Id: <20200604152401.3086020-1-hs@denx.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean make the sleep time and the margin configurable. Signed-off-by: Heiko Schocher Reviewed-by: Simon Glass Reviewed-by: Stephen Warren --- travis build: https://travis-ci.org/github/hsdenx/u-boot-test/builds/694545225 This patch is needed as I start test/py now within tbot [1]. On some configurations U-Boot is compiled on a build machine for example in munich, while the board under test is in my lab in hungary. So the 0.25 seconds default margin is often to low because of latencies on the net. See as an example configuration (within tbot): https://github.com/EmbLux-Kft/tbot-tbot2go/blob/devel/boards/aristainetos.py#L29 [1] http://tbot.tools/modules/tc.html#u-boot-test-py test/py/tests/test_sleep.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py index b69edf26ef..392af29db2 100644 --- a/test/py/tests/test_sleep.py +++ b/test/py/tests/test_sleep.py @@ -11,6 +11,12 @@ change test behavior. # Setup env__sleep_accurate to False if time is not accurate on your platform env__sleep_accurate = False +# Setup env__sleep_time time in seconds board is set to sleep +env__sleep_time = 3 + +# Setup env__sleep_margin set a margin for any system overhead +env__sleep_margin = 0.25 + """ def test_sleep(u_boot_console): @@ -23,13 +29,15 @@ def test_sleep(u_boot_console): if u_boot_console.config.buildconfig.get('config_cmd_misc', 'n') != 'y': pytest.skip('sleep command not supported') + # 3s isn't too long, but is enough to cross a few second boundaries. - sleep_time = 3 + sleep_time = u_boot_console.config.env.get('env__sleep_time', 3) + sleep_margin = u_boot_console.config.env.get('env__sleep_margin', 0.25) tstart = time.time() u_boot_console.run_command('sleep %d' % sleep_time) tend = time.time() elapsed = tend - tstart assert elapsed >= (sleep_time - 0.01) if not u_boot_console.config.gdbserver: - # 0.25s margin is hopefully enough to account for any system overhead. - assert elapsed < (sleep_time + 0.25) + # margin is hopefully enough to account for any system overhead. + assert elapsed < (sleep_time + sleep_margin)