From patchwork Thu Mar 4 13:51:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1447343 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VtR9AIHc; 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 4DrsqS4JW2z9sSC for ; Fri, 5 Mar 2021 00:56:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 762D0828A9; Thu, 4 Mar 2021 14:53:22 +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="VtR9AIHc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DEEE5826A5; Thu, 4 Mar 2021 14:52:24 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 EE2C1826A5 for ; Thu, 4 Mar 2021 14:52:12 +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-oi1-x236.google.com with SMTP id l64so30129570oig.9 for ; Thu, 04 Mar 2021 05:52:12 -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=4u7RTj0kyjgrZpvKKaQ3Suw06lIiUzUMDGL6bkAzumA=; b=VtR9AIHcqt6UQPxys5BMprPYScYzE1Tmi38mJIYJxAVBMcqvCaoYSbj8jV8SGCtTeZ 6ud5ZIcXP4jjZ+TTNGDAShSQDYGbrt4nrI8BSd8A/4vYK1VkgXY2oOU7hQebmsV3cdI9 qVe7KckAjevJdQcI2Suy+YdMUFquBnLKzHm7s= 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=4u7RTj0kyjgrZpvKKaQ3Suw06lIiUzUMDGL6bkAzumA=; b=rmbqZMM+zyn8//e4dt5WJPx7SGVTbDAcg7W56LwItbmd2jZl8kG+C740IVJ7xwiRzK IJmt8zPt3Orno0FPh/6BIwFWqxjk8lVsxIc7sy5O6LTr6XeeViA+9evV4/qTOf5Ry0xP KxxRDfuCyS34pJDroX0rqu4+jmazj1pnwr4Yj0OqMjd/CWpBT+KwRDvZ158PfrJRDDk2 VMoViXi3BGU6fxniDaJgkmDoziiHgM2X2Kh1Js9A08gJdau9VrMPkkPU81TzfqxHBces +cLIrhVMCNUn3q3Kr/7wy00Da7kkhwXGrZXdkRm1R8meGKjXbqPeo+C9FRwugggWd/1m LXZg== X-Gm-Message-State: AOAM533sNGJwbg7LsSqijiBCpVrCDJ/9jN4u0UC3Gc44O9o/sg2A2+XS eRgEgIltk8A5dnVzdQ+22Y1I6mPXwBRiLoRV X-Google-Smtp-Source: ABdhPJzQqfHgS0vvLA8uE5H+Ao+Qr9VEkTDa/wG4j2EbmyIVEySTYgzLmmVgOw8fR/GQ9GK03pj+pg== X-Received: by 2002:aca:d690:: with SMTP id n138mr2895390oig.65.1614865931505; Thu, 04 Mar 2021 05:52:11 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id x10sm4029465otp.19.2021.03.04.05.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 05:52:11 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Stephen Warren , Stephen Warren , Simon Glass Subject: [PATCH v4 30/42] test: Use return values in dm_test_run() Date: Thu, 4 Mar 2021 06:51:06 -0700 Message-Id: <20210304135118.643277-30-sjg@chromium.org> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog In-Reply-To: <20210304135118.643277-1-sjg@chromium.org> References: <20210304135118.643277-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.4 at phobos.denx.de X-Virus-Status: Clean Update this function to use the return value of ut_run_list() to check for success/failure, so that they are in sync. Also return a command success code so that the caller gets what it expects. Signed-off-by: Simon Glass --- (no changes since v1) test/dm/test-dm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c index 20af1c13b3c..54e6577b009 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -20,16 +20,13 @@ DECLARE_GLOBAL_DATA_PTR; -struct unit_test_state global_dm_test_state; - int dm_test_run(const char *test_name) { struct unit_test *tests = ll_entry_start(struct unit_test, dm_test); const int n_ents = ll_entry_count(struct unit_test, dm_test); struct unit_test_state uts_s = { .fail_count = 0 }, *uts = &uts_s; struct device_node *of_root; - - uts->fail_count = 0; + int ret; if (!CONFIG_IS_ENABLED(OF_PLATDATA)) { /* @@ -39,22 +36,23 @@ int dm_test_run(const char *test_name) if (!gd->fdt_blob || fdt_next_node(gd->fdt_blob, 0, NULL) < 0) { puts("Please run with test device tree:\n" " ./u-boot -d arch/sandbox/dts/test.dtb\n"); - ut_assert(gd->fdt_blob); + return CMD_RET_FAILURE; } } of_root = gd_of_root(); - ut_run_list("driver model", "dm_test_", tests, n_ents, test_name); + ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name); /* Put everything back to normal so that sandbox works as expected */ gd_set_of_root(of_root); gd->dm_root = NULL; - ut_assertok(dm_init(CONFIG_IS_ENABLED(OF_LIVE))); + if (dm_init(CONFIG_IS_ENABLED(OF_LIVE))) + return CMD_RET_FAILURE; dm_scan_plat(false); if (!CONFIG_IS_ENABLED(OF_PLATDATA)) dm_scan_fdt(false); - return uts->fail_count ? CMD_RET_FAILURE : 0; + return ret ? CMD_RET_FAILURE : 0; } int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])