From patchwork Mon May 9 20:08:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1628795 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=F4gcXA+S; dkim-atps=neutral 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=) 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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kxsgy3ccvz9sR4 for ; Tue, 10 May 2022 06:09:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C62883F35; Mon, 9 May 2022 22:08:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="F4gcXA+S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2E0E283F35; Mon, 9 May 2022 22:08:47 +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=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCC4383E14 for ; Mon, 9 May 2022 22:08:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-062-143-094-109.um16.pools.vodafone-ip.de [62.143.94.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id BFD703F1C4; Mon, 9 May 2022 20:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1652126919; bh=Z2gUk4hALbHT8JRGvVq8KIch/gvDaEKD7Nti4QbZl8o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=F4gcXA+S4C3u1SbR7f9yu364xTxa4ffKhMxKUQ7j7TBEx6hs2Oa8YPJxZGIoKn8y+ vpTGEGbwjGktexZcFBTgFnXRyCJdG4UcmAF4kwP8yAbBLWoDgCeHKV9d9IOML0SbTc GZXolszOTztGSU4G89plwbPqr5p3N9rmkwAIfVf5jZTkku+WlEO6cQZMTqEzUi4NTO Iv2Q8LJz17QWSgcNW/BfJc//dP0GspnZfBn8BlUzYrZQfH5UDLK9nPYd0brVlvFbl6 4oDLE1734Npfsv4dtxYzRaZF9CPXX4DP6d40KqCCx1Z+58Y1rizZzSugh7q/M0wiqd XCdv/zPIWIXdw== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Masahisa Kojima , Heinrich Schuchardt Subject: [PATCH 1/2] test: restore timeout after bootmenu unit test Date: Mon, 9 May 2022 22:08:31 +0200 Message-Id: <20220509200831.176107-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean In the bootmenu unit test the console timeout is set to 500 ms. Other tests rely on the original timeout. Ensure that the original value is restored. Signed-off-by: Heinrich Schuchardt --- test/py/tests/test_bootmenu.py | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/test/py/tests/test_bootmenu.py b/test/py/tests/test_bootmenu.py index b4baa534aa..70f51de699 100644 --- a/test/py/tests/test_bootmenu.py +++ b/test/py/tests/test_bootmenu.py @@ -11,36 +11,36 @@ def test_bootmenu(u_boot_console): u_boot_console -- U-Boot console """ - u_boot_console.p.timeout = 500 - u_boot_console.run_command('setenv bootmenu_default 1') - u_boot_console.run_command('setenv bootmenu_0 test 1=echo ok 1') - u_boot_console.run_command('setenv bootmenu_1 test 2=echo ok 2') - u_boot_console.run_command('setenv bootmenu_2 test 3=echo ok 3') - u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) - for i in ('U-Boot Boot Menu', 'test 1', 'test 2', 'test 3', 'autoboot'): - u_boot_console.p.expect([i]) - # Press enter key to execute default entry - response = u_boot_console.run_command(cmd='\x0d', wait_for_echo=False, send_nl=False) - assert 'ok 2' in response - u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) - u_boot_console.p.expect(['autoboot']) - # Press up key to select prior entry followed by the enter key - response = u_boot_console.run_command(cmd='\x1b\x5b\x41\x0d', wait_for_echo=False, - send_nl=False) - assert 'ok 1' in response - u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) - u_boot_console.p.expect(['autoboot']) - # Press down key to select next entry followed by the enter key - response = u_boot_console.run_command(cmd='\x1b\x5b\x42\x0d', wait_for_echo=False, - send_nl=False) - assert 'ok 3' in response - u_boot_console.run_command('bootmenu 2; echo rc:$?', wait_for_prompt=False) - u_boot_console.p.expect(['autoboot']) - # Press the escape key - response = u_boot_console.run_command(cmd='\x1b', wait_for_echo=False, send_nl=False) - assert 'ok' not in response - assert 'rc:0' in response - u_boot_console.run_command('setenv bootmenu_default') - u_boot_console.run_command('setenv bootmenu_0') - u_boot_console.run_command('setenv bootmenu_1') - u_boot_console.run_command('setenv bootmenu_2') + with u_boot_console.temporary_timeout(500): + u_boot_console.run_command('setenv bootmenu_default 1') + u_boot_console.run_command('setenv bootmenu_0 test 1=echo ok 1') + u_boot_console.run_command('setenv bootmenu_1 test 2=echo ok 2') + u_boot_console.run_command('setenv bootmenu_2 test 3=echo ok 3') + u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) + for i in ('U-Boot Boot Menu', 'test 1', 'test 2', 'test 3', 'autoboot'): + u_boot_console.p.expect([i]) + # Press enter key to execute default entry + response = u_boot_console.run_command(cmd='\x0d', wait_for_echo=False, send_nl=False) + assert 'ok 2' in response + u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) + u_boot_console.p.expect(['autoboot']) + # Press up key to select prior entry followed by the enter key + response = u_boot_console.run_command(cmd='\x1b\x5b\x41\x0d', wait_for_echo=False, + send_nl=False) + assert 'ok 1' in response + u_boot_console.run_command('bootmenu 2', wait_for_prompt=False) + u_boot_console.p.expect(['autoboot']) + # Press down key to select next entry followed by the enter key + response = u_boot_console.run_command(cmd='\x1b\x5b\x42\x0d', wait_for_echo=False, + send_nl=False) + assert 'ok 3' in response + u_boot_console.run_command('bootmenu 2; echo rc:$?', wait_for_prompt=False) + u_boot_console.p.expect(['autoboot']) + # Press the escape key + response = u_boot_console.run_command(cmd='\x1b', wait_for_echo=False, send_nl=False) + assert 'ok' not in response + assert 'rc:0' in response + u_boot_console.run_command('setenv bootmenu_default') + u_boot_console.run_command('setenv bootmenu_0') + u_boot_console.run_command('setenv bootmenu_1') + u_boot_console.run_command('setenv bootmenu_2')