Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07EF4C19F28 for ; Sat, 30 Jul 2022 21:55:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 544048448A; Sat, 30 Jul 2022 23:53:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fvD77l9O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4EE73841F5; Sat, 30 Jul 2022 23:53:23 +0200 (CEST) Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1EB77841B1 for ; Sat, 30 Jul 2022 23:53:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x332.google.com with SMTP id g19-20020a9d1293000000b0061c7bfda5dfso5678548otg.1 for ; Sat, 30 Jul 2022 14:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=GexklCf8iGJqXMVKVedTezFWny2Q49HqTwJVCqt7HV0=; b=fvD77l9OmcetXIai2kCPOiFF4nyBAmFLDld3+r7aF8DTsywBVdwkQPKoFfkAEFD3uk w33/VOJfE7gUmjhQKPcpck9BjtA3hA86b2RMFbtRhuIHHcDcnxdnaH8UA0GllgCCOJ3X x1mExMLjIKRJk1sM+nbV7rNqeGoYMl/cK1wG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=GexklCf8iGJqXMVKVedTezFWny2Q49HqTwJVCqt7HV0=; b=OBD/buqGG/4u7ChELfydiVifKhO3JP65y/yexkMfLP6kcv008MHymGeJRrUdK0DKRw gDvs0dFuLge8Yxzeop5X+5ONlTNaXyx+r5ss1JlAUtRUD7FpNnDFlXs7iBp0zxMAFTZq qltCZtWQE2GEqj+e+R5fatDkIezNXEb1uzFXQOHFFWy8bw9EGYjn903GxMXUUz60cKae AjT1vPQTKveAeRt0o8oRKAJfnop+zE3NiOjXcQ4VlI3gk9DNnShDD9ymLaM5wYidMbJW 3SGl2jw4+VMLHZIlgnsnBfLejyVP2UR7vzzLqzmPkl1CMq95ugpa54k/ptnPE/qhj2xP iyZw== X-Gm-Message-State: AJIora/a13+hfGPLf10/RzrRHaF4XIrn8A6x+7wXwfNSjX1pRBSrBmmg b2ro3uKyYIWEQi7xoZMXxJBPykg+F1dGJj7Y X-Google-Smtp-Source: AGRyM1vr9nBFrO4knL2LHMtb3UBpehvKxIntbTrXDS1jfdkZU7k2eiwqK7tmSlE5fqtjIcbsIquHWA== X-Received: by 2002:a05:6830:6388:b0:61c:80a9:d5b6 with SMTP id ch8-20020a056830638800b0061c80a9d5b6mr3697004otb.124.1659217998569; Sat, 30 Jul 2022 14:53:18 -0700 (PDT) Received: from sjg1.lan (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id 19-20020a544193000000b0032f75714af1sm1699656oiy.18.2022.07.30.14.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 14:53:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Bin Meng , Simon Glass Subject: [PATCH v2 14/35] bootstd: Drop delays in the tests Date: Sat, 30 Jul 2022 15:52:16 -0600 Message-Id: <20220730215237.818368-11-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog In-Reply-To: <20220730215237.818368-1-sjg@chromium.org> References: <20220730215237.818368-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Some tests go as far as booting a distribution. In this case a menu is presented to the user, with a two-second timeout. This adds a total of 12 seconds to the test runs at present. Avoid this by inserting a response using the console-recording feature. Signed-off-by: Simon Glass --- (no changes since v1) test/boot/bootflow.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 1ebb789e97b..a2ed8ac774f 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -16,6 +16,22 @@ #include #include "bootstd_common.h" +static int inject_response(struct unit_test_state *uts) +{ + /* + * The image being booted presents a menu of options: + * + * Fedora-Workstation-armhfp-31-1.9 Boot Options. + * 1: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) + * Enter choice: + * + * Provide input for this, to avoid waiting two seconds for a timeout. + */ + ut_asserteq(2, console_in_puts("1\n")); + + return 0; +} + /* Check 'bootflow scan/list' commands */ static int bootflow_cmd(struct unit_test_state *uts) { @@ -188,6 +204,7 @@ BOOTSTD_TEST(bootflow_cmd_info, UT_TESTF_DM | UT_TESTF_SCAN_FDT); static int bootflow_scan_boot(struct unit_test_state *uts) { console_record_reset_enable(); + ut_assertok(inject_response(uts)); ut_assertok(run_command("bootflow scan -b", 0)); ut_assert_nextline( "** Booting bootflow 'mmc1.bootdev.part_1' with syslinux"); @@ -351,6 +368,8 @@ static int bootflow_iter_disable(struct unit_test_state *uts) ut_assertok(bootstd_test_drop_bootdev_order(uts)); bootstd_clear_glob(); + console_record_reset_enable(); + ut_assertok(inject_response(uts)); ut_assertok(run_command("bootflow scan -lb", 0)); /* Try to boot the bootmgr flow, which will fail */ @@ -358,6 +377,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts) ut_assertok(bootflow_scan_first(&iter, 0, &bflow)); ut_asserteq(3, iter.num_methods); ut_asserteq_str("sandbox", iter.method->name); + ut_assertok(inject_response(uts)); ut_asserteq(-ENOTSUPP, bootflow_run_boot(&iter, &bflow)); ut_assert_skip_to_line("Boot method 'sandbox' failed and will not be retried"); @@ -382,6 +402,8 @@ static int bootflow_cmd_boot(struct unit_test_state *uts) ut_assert_console_end(); ut_assertok(run_command("bootflow select 0", 0)); ut_assert_console_end(); + + ut_assertok(inject_response(uts)); ut_asserteq(1, run_command("bootflow boot", 0)); ut_assert_nextline( "** Booting bootflow 'mmc1.bootdev.part_1' with syslinux"); -- 2.37.1.455.g008518b4e5-goog