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 69ABDC4332F for ; Thu, 13 Oct 2022 12:32:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A67E984F5D; Thu, 13 Oct 2022 14:30:59 +0200 (CEST) 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="QCY3yFl+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C47E84F36; Thu, 13 Oct 2022 14:30:27 +0200 (CEST) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 419D484F3D for ; Thu, 13 Oct 2022 14:30:20 +0200 (CEST) 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-io1-xd2a.google.com with SMTP id d142so1169329iof.7 for ; Thu, 13 Oct 2022 05:30:20 -0700 (PDT) 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=Ig7w3oW/tsBx0/wwux6W18Exyih85pXJx30xe5qcNic=; b=QCY3yFl+ayXNWPRr+RQ16+EdD7RwJ2sNC/LiADmkHQQdG8pRKcGhR/8So2z9CYUrBq J2WKKI5v98A2XU1YEPUJoHAfFPNuzRvyOy6ilhuF4uXGcekuYHXyEHWrudNs2Q4TtHHA dVMRO1IIhKK3RFLiFldc6JPgqZUiikgNIhV8M= 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=Ig7w3oW/tsBx0/wwux6W18Exyih85pXJx30xe5qcNic=; b=K4kD3UKFTqqOBOynhbg87jjGZCCl3FIPrH8TNv6jvhpV13J4YnimlQWnB5D0Z9PC3o iY9tHxymcLyaI+MddCM+LbrRIaKeoDqjz7nWlzbiYXF3ENyEZA+nUWoOUnWNLoTLIfum IhitnZ7Cj/gBjcSJUUr2gdhvifjNr11hTYnDdD3SCzNDkI7FWBzxS0mwpmksJNFMQwNJ CyFXSV1Dzgl5DaBgJB3NCM7qSDMKsOIR4ayyc01MlWpF5x20kd9Zbs1QbjGYj2pDxTMt EIRuJsYG7fsZJhFpn95eSgxn/jQcpWMQWhtDMuZPdXci8jChtcHUYRHcYs7jBkOakZKr T/Gw== X-Gm-Message-State: ACrzQf2F63TpAG0pFoZgIjzBSzC2184WutMGaTJ758wT/9J2w9h2y0Fq a4UdZvDAet3Je7LlV1V4Cib1GMopvVn3LA== X-Google-Smtp-Source: AMsMyM5Yu349QWZZUN9Ih5iY1icw8pgBwOEe4xhO3HbQBjHAxcCGfMafIzFfWP4+4eC2S/aTjDq8sQ== X-Received: by 2002:a05:6602:15d2:b0:6bc:7aaf:8e1c with SMTP id f18-20020a05660215d200b006bc7aaf8e1cmr6153368iow.14.1665664219483; Thu, 13 Oct 2022 05:30:19 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id a9-20020a027a09000000b003635ab4a7b7sm7321626jac.3.2022.10.13.05.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 05:30:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Sean Anderson , Stefan Roese Subject: [PATCH v2 12/45] test: Report skippped tests Date: Thu, 13 Oct 2022 06:28:54 -0600 Message-Id: <20221013122927.636867-13-sjg@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221013122927.636867-1-sjg@chromium.org> References: <20221013122927.636867-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 At present it is possible for a test to skip itself by returning -EAGAIN but this is not recorded. Keep a track of skipped tests and report the total at the end. Signed-off-by: Simon Glass --- (no changes since v1) include/test/test.h | 2 ++ test/test-main.c | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/test/test.h b/include/test/test.h index 3bbd77c38b5..c1853ce471b 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -13,6 +13,7 @@ * struct unit_test_state - Entire state of test system * * @fail_count: Number of tests that failed + * @skip_count: Number of tests that were skipped * @start: Store the starting mallinfo when doing leak test * @of_live: true to use livetree if available, false to use flattree * @of_root: Record of the livetree root node (used for setting up tests) @@ -32,6 +33,7 @@ */ struct unit_test_state { int fail_count; + int skip_count; struct mallinfo start; struct device_node *of_root; bool of_live; diff --git a/test/test-main.c b/test/test-main.c index d74df297c43..312fa1a6a19 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -365,6 +365,19 @@ static int test_post_run(struct unit_test_state *uts, struct unit_test *test) return 0; } +/** + * skip_test() - Handle skipping a test + * + * @uts: Test state to update + * @return -EAGAIN (always) + */ +static int skip_test(struct unit_test_state *uts) +{ + uts->skip_count++; + + return -EAGAIN; +} + /** * ut_run_test() - Run a single test * @@ -395,11 +408,13 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test, ret = test_pre_run(uts, test); if (ret == -EAGAIN) - return -EAGAIN; + return skip_test(uts); if (ret) return ret; - test->func(uts); + ret = test->func(uts); + if (ret == -EAGAIN) + skip_test(uts); ret = test_post_run(uts, test); if (ret) @@ -433,7 +448,7 @@ static int ut_run_test_live_flat(struct unit_test_state *uts, int runs; if ((test->flags & UT_TESTF_OTHER_FDT) && !IS_ENABLED(CONFIG_SANDBOX)) - return -EAGAIN; + return skip_test(uts); /* Run with the live tree if possible */ runs = 0; @@ -567,6 +582,8 @@ int ut_run_list(const char *category, const char *prefix, os_free(uts.other_fdt); } + if (uts.skip_count) + printf("Skipped: %d, ", uts.skip_count); if (ret == -ENOENT) printf("Test '%s' not found\n", select_name); else -- 2.38.0.rc1.362.ged0d419d3c-goog