From patchwork Thu Jan 28 15:12:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1432864 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=85.214.62.61; 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=aFjABsqE; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DRPGp3jlDz9sT6 for ; Fri, 29 Jan 2021 02:17:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1FCD782896; Thu, 28 Jan 2021 16:13:46 +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="aFjABsqE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76B8582833; Thu, 28 Jan 2021 16:12:56 +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.3 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-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 5295382800 for ; Thu, 28 Jan 2021 16:12:53 +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-x131.google.com with SMTP id d6so5510844ilo.6 for ; Thu, 28 Jan 2021 07:12:53 -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=S5cHZht0mayTt9O25dskTLV7Nv/fhKFEts0vnKKI/v8=; b=aFjABsqECVTw4ggaenIqdEchISTkJUGQ68+LON2+R9VbdPvxiYmEHVjy297ntE2MFe ydqKBZmPl3QTeV3vfsuDpoMiu6R786wMJn4XFT5fjN4a/YUFluukf+8Rz37RV+2SizKE u4DRefdEAvmqlov8JptjMU8Yp5SJZyWw69HLc= 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=S5cHZht0mayTt9O25dskTLV7Nv/fhKFEts0vnKKI/v8=; b=B0RTtFeGVjOOrPwf7ClQl7ilO78cKWO9W0EU7k2ND4KPhHsWMMVYsy+aavaAGNLrdd Ufmx6BfBRagT6d5uKCoeQBsJnhPSFC/PPceC0C8G0oE6MDrcKiYiFo5SIKvK0MFWMtwf G6JqYugFnTbLHhk+U/xuykE1M3pVABBf/Lh55hv82nuRHYmBn3ZswGwEkqJ7POzASEdt K3UFJwTKl42or6mgWvuLpv1RKiI7PysuOZJDtcMUeQMT5jVD0t5IZY7TjhU10Q2obgnx CLg18HMfKNa78AFwJFsFB5vu+JR2ZsP3gQ6UQ9wQmzO8u35pUzXJEWH9L/IjbRsTaeeN IrxQ== X-Gm-Message-State: AOAM533nNe9wXN41uA8sCOfpJsNtJN0lC8O03tzQyF1nxxfHfjdUXZ0y GhRBjFiGCd27EHFrN4f5tAldm8kXOboyzrLq X-Google-Smtp-Source: ABdhPJzDQS588lG+0rsqXUp6Iuaq4Htr8qu6MiQDDDUTEmW5fYr57lD0V2K/w1aeL4+DaZ8o4tQ6pQ== X-Received: by 2002:a92:bbcb:: with SMTP id x72mr12642116ilk.104.1611846771909; Thu, 28 Jan 2021 07:12:51 -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 k19sm2649134iog.28.2021.01.28.07.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 07:12:51 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH 28/30] test: Use return values in dm_test_run() Date: Thu, 28 Jan 2021 08:12:09 -0700 Message-Id: <20210128151211.879830-29-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog In-Reply-To: <20210128151211.879830-1-sjg@chromium.org> References: <20210128151211.879830-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 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 --- 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 252c3e88328..1df0676915f 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -19,16 +19,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)) { /* @@ -38,22 +35,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[])