From patchwork Wed Feb 3 12:44:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1435285 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=Gi5FweGk; 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 4DW1kB65dXz9tlW for ; Wed, 3 Feb 2021 23:50:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C118082843; Wed, 3 Feb 2021 13:47:29 +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="Gi5FweGk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11F2382829; Wed, 3 Feb 2021 13:46:29 +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.4 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-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (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 101C5827DE for ; Wed, 3 Feb 2021 13:46: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=sjg@chromium.org Received: by mail-qk1-x733.google.com with SMTP id x81so23152398qkb.0 for ; Wed, 03 Feb 2021 04:46:22 -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=SsJWV2as4rp+MoG6YzZRDL3JVi3cTUnwKbVK0o2wsSI=; b=Gi5FweGkfSe5Za8GaLoD29EoNTl4TIOZFjUfzh6XidZoC+ifOUKWL//KHILZL77q3Z 3pfYeu8cyAiDJAbDM4/keNMRsoekl7tT2VBHGehDtnbhG0jYZAKFyp9NIefbUNw7Y3Ag rdJYZKpYCWS0/VEenacODL8yi1qi+5FRADf2A= 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=SsJWV2as4rp+MoG6YzZRDL3JVi3cTUnwKbVK0o2wsSI=; b=riFrDaiSNn4DzaSO79mU+bhRE0mxAO8H86thvZdt9JhnsXfCbq9/fmCXRoHyB4vjqv 4P6owp1t7zc0S37/o1itKEJ8oaECyV8TuWxmnLxB2IFW2tP0JxKM3fyY89j+ANOZydPC i6E5X2bi1rmyWundExqajyuS+ll1ccXI9hbcewhwrjdhk9kHR2mwLgBEc+J0n2YwfaxY 2puPhOCyWyhkWQKA37GjGvq18mYA0sFV01OggitO/TwMgJ8UrVCW23YnfUG61Q3RJNUD 0tKWHSwNCUDhbVFSIv1HJCNBGRIArEMLc38PspRPSK1q/xhDMctG9s5X9aUOr2IuH1X1 Of/w== X-Gm-Message-State: AOAM5325SJuIYHkJNGMwgzkj+Jq4MpSQN+TsqTUaU3fKWqMw+PmbNFEd ZBuwfcQkuk66gpybYy+UWN8wt/v7Zh9V2+QC X-Google-Smtp-Source: ABdhPJy4GvZC0RbBK9UDTtyZpUnWcjEXIsgJV5tLAd48giYq26jDp500Bb6vmapuoQ19vePtBwqykA== X-Received: by 2002:a37:345:: with SMTP id 66mr2228993qkd.358.1612356380689; Wed, 03 Feb 2021 04:46:20 -0800 (PST) Received: from sjg1.roam.corp.google.com ([50.225.158.38]) by smtp.gmail.com with ESMTPSA id p26sm1560903qkk.6.2021.02.03.04.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 04:46:20 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Stephen Warren , Stephen Warren , Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH v3 22/41] test: Move dm_test_destroy() into test-main.c Date: Wed, 3 Feb 2021 05:44:28 -0700 Message-Id: <20210203124447.2458527-22-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog In-Reply-To: <20210203124447.2458527-1-sjg@chromium.org> References: <20210203124447.2458527-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 Move this function into the common test runner and rename it to dm_test_post_run() so that its purpose is clear. Signed-off-by: Simon Glass --- (no changes since v1) test/dm/test-dm.c | 22 ---------------------- test/test-main.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c index 378c6506303..90da143bc51 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -21,26 +21,6 @@ DECLARE_GLOBAL_DATA_PTR; struct unit_test_state global_dm_test_state; -static int dm_test_destroy(struct unit_test_state *uts) -{ - int id; - - for (id = 0; id < UCLASS_COUNT; id++) { - struct uclass *uc; - - /* - * If the uclass doesn't exist we don't want to create it. So - * check that here before we call uclass_find_device(). - */ - uc = uclass_find(id); - if (!uc) - continue; - ut_assertok(uclass_destroy(uc)); - } - - return 0; -} - static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, bool of_live) { @@ -56,8 +36,6 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, ut_assertok(test_post_run(uts, test)); - ut_assertok(dm_test_destroy(uts)); - return 0; } diff --git a/test/test-main.c b/test/test-main.c index 8b0121bdcec..3806c2ad89c 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,26 @@ static int dm_test_pre_run(struct unit_test_state *uts) return 0; } +static int dm_test_post_run(struct unit_test_state *uts) +{ + int id; + + for (id = 0; id < UCLASS_COUNT; id++) { + struct uclass *uc; + + /* + * If the uclass doesn't exist we don't want to create it. So + * check that here before we call uclass_find_device(). + */ + uc = uclass_find(id); + if (!uc) + continue; + ut_assertok(uclass_destroy(uc)); + } + + return 0; +} + /* Ensure all the test devices are probed */ static int do_autoprobe(struct unit_test_state *uts) { @@ -94,6 +115,8 @@ int test_pre_run(struct unit_test_state *uts, struct unit_test *test) int test_post_run(struct unit_test_state *uts, struct unit_test *test) { ut_unsilence_console(uts); + if (test->flags & UT_TESTF_DM) + ut_assertok(dm_test_post_run(uts)); return 0; }