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 EF603C352A1 for ; Wed, 7 Dec 2022 08:56:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DD3AD8557D; Wed, 7 Dec 2022 09:54:43 +0100 (CET) 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="mEFEpyeh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5155855BB; Wed, 7 Dec 2022 09:54:40 +0100 (CET) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 2F729855B0 for ; Wed, 7 Dec 2022 09:54:34 +0100 (CET) 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-pj1-x1036.google.com with SMTP id cm20so16960224pjb.1 for ; Wed, 07 Dec 2022 00:54:34 -0800 (PST) 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:subject:date :message-id:reply-to; bh=HGMKGJVZp2OUDpt1RyHWB2JziahFVNPz1xN8Q1BNDH4=; b=mEFEpyehceePvD0QDcRjqPUdV6xDiY59trRtnD0gj96B05Pt3Wlrj3Xjnc2+EQNMXn Xx1ZDBW0bl5l3lvhq0sLqexSf8bjKL03OWWkfs9+TzvzPQ8VAmbd5qkd4o4poxYtL6EC LGY/Ta+VzJjABkMaVpQjtgo5lIGmgYR47lbdg= 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 :subject:date:message-id:reply-to; bh=HGMKGJVZp2OUDpt1RyHWB2JziahFVNPz1xN8Q1BNDH4=; b=N/SJ+8oNbUf0VHILt9TE1pZX9yLK4RTt4GGR8uTh2wbdCTwTgBoavS7g8J7M6QxLyN IwQilpuk8nE/2Jc1Sed8BhvmFTOGGG0vSWX57/GvMRFsxCaVakvX4bPcqBaZrrraQO6R daIfoGLa4UrGJri7hf9ReUsKMMotJeZUVLs3Dp9pUOjNXlO8Jc4SJPOnSQVWM9btcHmc ckvVs7MXti4Rybzw1KjEFG4XGNyC5iQfbn5estdyK/t9YD2tBs/4RzWIxMOouBMg6npA 4ZJktBP2p3IKu+HhOXxgkaBAH13UrBQa78jYCMfybB6NP9ePEkv8+VsXiJxRD8yoixBX 3+bg== X-Gm-Message-State: ANoB5pmuhDCh398f71mBfZvZDWsQTA6vZozwgcEyDn0V1AirhDUkRHFA t0ykK5Nwqcr9aPGM/fJmlsRr4j5D74Gbkgyr X-Google-Smtp-Source: AA0mqf4Rer0Mw2A6N8yrgP/yo2DKwvozRI1pdICGKQiKJoBqKWvZ4Zw8s2KIb96jzJpop1b6/qxvvA== X-Received: by 2002:a17:90a:7444:b0:219:d415:d7cd with SMTP id o4-20020a17090a744400b00219d415d7cdmr14286897pjk.89.1670403272311; Wed, 07 Dec 2022 00:54:32 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:54:32 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Heinrich Schuchardt , Marek Vasut , Michal Suchanek , Pavel Herrmann , Stefan Roese Subject: [PATCH 13/71] dm: test: Correct ordering of DM setup Date: Wed, 7 Dec 2022 21:50:39 +1300 Message-Id: <20221207085137.445249-14-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-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 We must call dm_scan_other() after devices from the device tree have been created, since that function behaves differently if there is no bootstd device. Adjust the logic to achieve this. Also fix the bootflow_system() test which was relying on this broken behaviour. Signed-off-by: Simon Glass --- test/boot/bootflow.c | 11 +++++++---- test/test-main.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index e1e07082105..aac14d30673 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -15,6 +15,7 @@ #ifdef CONFIG_SANDBOX #include #endif +#include #include #include #include @@ -327,12 +328,14 @@ BOOTSTD_TEST(bootflow_iter, UT_TESTF_DM | UT_TESTF_SCAN_FDT); /* Check using the system bootdev */ static int bootflow_system(struct unit_test_state *uts) { - struct udevice *dev; + struct udevice *bootstd, *dev; if (!IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) return -EAGAIN; - ut_assertok(uclass_get_device_by_name(UCLASS_BOOTMETH, "efi_mgr", - &dev)); + ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); + ut_assertok(device_bind(bootstd, DM_DRIVER_GET(bootmeth_efi_mgr), + "efi_mgr", 0, ofnode_null(), &dev)); + ut_assertok(device_probe(dev)); sandbox_set_fake_efi_mgr_dev(dev, true); /* We should get a single 'bootmgr' method right at the end */ @@ -342,7 +345,7 @@ static int bootflow_system(struct unit_test_state *uts) ut_assert_skip_to_line( " 0 efi_mgr ready (none) 0 "); ut_assert_skip_to_line("No more bootdevs"); - ut_assert_skip_to_line("(5 bootflows, 5 valid)"); + ut_assert_skip_to_line("(2 bootflows, 2 valid)"); ut_assert_console_end(); return 0; diff --git a/test/test-main.c b/test/test-main.c index 9ab090b7b33..72aa3a0aa8f 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -296,10 +296,8 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test) uts->start = mallinfo(); - if (test->flags & UT_TESTF_SCAN_PDATA) { + if (test->flags & UT_TESTF_SCAN_PDATA) ut_assertok(dm_scan_plat(false)); - ut_assertok(dm_scan_other(false)); - } if (test->flags & UT_TESTF_PROBE_TEST) ut_assertok(do_autoprobe(uts)); @@ -308,6 +306,13 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test) (test->flags & UT_TESTF_SCAN_FDT)) ut_assertok(dm_extended_scan(false)); + /* + * Do this after FDT scan since dm_scan_other() in bootstd-uclass.c + * checks for the existence of bootstd + */ + if (test->flags & UT_TESTF_SCAN_PDATA) + ut_assertok(dm_scan_other(false)); + if (IS_ENABLED(CONFIG_SANDBOX) && (test->flags & UT_TESTF_OTHER_FDT)) { /* make sure the other FDT is available */ ut_assertok(test_load_other_fdt(uts)); -- 2.39.0.rc0.267.gcb52ba06e7-goog