From patchwork Mon Nov 30 01:53:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1407933 X-Patchwork-Delegate: sjg@chromium.org 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=iZ5ctRTn; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CkpHY3jhhz9sTc for ; Mon, 30 Nov 2020 12:56:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 630E98278A; Mon, 30 Nov 2020 02:55:57 +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="iZ5ctRTn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8CBE0827A3; Mon, 30 Nov 2020 02:54:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (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 F09E082687 for ; Mon, 30 Nov 2020 02:54:42 +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-il1-x142.google.com with SMTP id v3so9824041ilo.5 for ; Sun, 29 Nov 2020 17:54:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+TK1qUZcU3aTCXRJQ84BURbWHqMB/nTt+BggUdJGoy0=; b=iZ5ctRTnWOOxqvMn9en88HgPExMTwD1t0jOfNPEOe2UNMLXYUDve+mbW+s6MuxnoIm XTKYFVk0fR9NdiimhVuBJTVpZkW9F6X9lA8pNkeur7q37bUoczVhQT8sTW+73c1ekMBc 7Ouq5uYAs/AD2NuZtCYtrFeT/HrlC+uvcD5Pw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+TK1qUZcU3aTCXRJQ84BURbWHqMB/nTt+BggUdJGoy0=; b=kogZS6+P0q/yUGF3iCW8KCECAAyYjm0AkNjFVVebRl9QIfpDWQsxoffOWY+x+r/qGQ wWiupmN+z5T3LJkINjgxZi/T3EhAVF1Gsu0lgar14G0GA7EEwPwde1/HbMK5tM9mknO3 VD0SvpU8E99G1UiL+DZXd1j1gqZpMylzl94FbJ2oPKq3Xk/Pem/Tqt0Jsf/BUq9wyOmF kWhvfeQyhBZV2fHn9+/xotVZo1crHlJ4WsNcTAiiwrtLQiuwK87KaeLtxT7OzkQ994Qc iaIIJ28U0fWqp1ykIoWTYX7wJ3TSp3Bs1tFHErX8DZySkc+s5HC/uhCyb0j+dWB7bQRe bKow== X-Gm-Message-State: AOAM5312+pqCH+fHLApxG9a1uxyC/PCZJBLCqH7pRlhMhRqvn7McUS6g hG117nV+t6VG6c3DVzIGngHG6GnTedTkdg== X-Google-Smtp-Source: ABdhPJwjt5aJiH4KUe/wwsEY+3WLWy1fpaTScV0NfguZCdPTet7W0ZCIhHlDccHLagGx534ov1iW6w== X-Received: by 2002:a92:d205:: with SMTP id y5mr16104480ily.119.1606701281475; Sun, 29 Nov 2020 17:54:41 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id q5sm6543341ilg.62.2020.11.29.17.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 17:54:40 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 06/27] dm: test: Add support for new sequence numbers Date: Sun, 29 Nov 2020 18:53:41 -0700 Message-Id: <20201130015402.2328621-5-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog In-Reply-To: <20201130015402.2328621-1-sjg@chromium.org> References: <20201130015402.2328621-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Tests need to rebuild the driver model data structures to avoid being affected by the operation of an earlier test. Do the same for the new bind-time sequence numbers. Also add a test that the new sequence numbers work as expected. Every device should get one. Signed-off-by: Simon Glass --- test/dm/core.c | 19 +++++++++++++++++++ test/dm/test-main.c | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/test/dm/core.c b/test/dm/core.c index 71ebb36d88b..0514813b817 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -1066,3 +1066,22 @@ static int dm_test_inactive_child(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_inactive_child, UT_TESTF_SCAN_PDATA); + +/* Make sure all bound devices have a sequence number */ +static int dm_test_all_have_seq(struct unit_test_state *uts) +{ + struct udevice *dev; + struct uclass *uc; + + list_for_each_entry(uc, &gd->uclass_root, sibling_node) { + list_for_each_entry(dev, &uc->dev_head, uclass_node) { + if (dev->sqq == -1) + printf("Device '%s' has no seq (%d)\n", + dev->name, dev->sqq); + ut_assert(dev->sqq != -1); + } + } + + return 0; +} +DM_TEST(dm_test_all_have_seq, UT_TESTF_SCAN_PDATA); diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 4814e186cb7..4ff7a01d5aa 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -88,6 +88,7 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, ut_assertok(dm_test_init(uts, of_live)); uts->start = mallinfo(); + gd->flags |= GD_FLG_DM_NO_SEQ; if (test->flags & UT_TESTF_SCAN_PDATA) ut_assertok(dm_scan_platdata(false)); if (test->flags & UT_TESTF_PROBE_TEST) @@ -95,6 +96,8 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, if (!CONFIG_IS_ENABLED(OF_PLATDATA) && (test->flags & UT_TESTF_SCAN_FDT)) ut_assertok(dm_extended_scan(false)); + uclass_alloc_all_seqs(); + gd->flags &= ~GD_FLG_DM_NO_SEQ; /* * Silence the console and rely on console recording to get @@ -208,12 +211,15 @@ int dm_test_main(const char *test_name) printf("Failures: %d\n", uts->fail_count); /* Put everything back to normal so that sandbox works as expected */ + gd->flags |= GD_FLG_DM_NO_SEQ; gd_set_of_root(uts->of_root); gd->dm_root = NULL; ut_assertok(dm_init(CONFIG_IS_ENABLED(OF_LIVE))); dm_scan_platdata(false); if (!CONFIG_IS_ENABLED(OF_PLATDATA)) dm_scan_fdt(false); + uclass_alloc_all_seqs(); + gd->flags &= ~GD_FLG_DM_NO_SEQ; return uts->fail_count ? CMD_RET_FAILURE : 0; }