From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D36C433E6 for ; Sun, 14 Feb 2021 16:13:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 025D064E68 for ; Sun, 14 Feb 2021 16:13:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 025D064E68 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7F8B08D00D4; Sun, 14 Feb 2021 11:13:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A9FC8D0060; Sun, 14 Feb 2021 11:13:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55F3D8D00D4; Sun, 14 Feb 2021 11:13:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 3DD018D0060 for ; Sun, 14 Feb 2021 11:13:58 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 089A783E2 for ; Sun, 14 Feb 2021 16:13:58 +0000 (UTC) X-FDA: 77817369756.24.air35_621560d27633 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id E582A1A4A0 for ; Sun, 14 Feb 2021 16:13:57 +0000 (UTC) X-HE-Tag: air35_621560d27633 X-Filterd-Recvd-Size: 4049 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Sun, 14 Feb 2021 16:13:57 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 0946164E26; Sun, 14 Feb 2021 16:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613319236; bh=oSyjZa2a4h87NAToicu1dy0qMSEHnj0M7GR63ZNQ+E8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZkBThNlPOPEtl8kX1tZogyGdXuRa0Km2PQ1ClqVDszxdGZadyG4WgaqZmOJl52Svx qsK77WOzTZbGOm2qxWLP7BW0Nxb/OqXqGVe/SWSFhcFrticzPCXlc5HS+L4FjNKbVQ aEbsJ0aVr+IgpWtgyzlkIhruS/9w6/4+JOhlEWnUKfAKN7GtIq3hyg+xIwNZJfEKOM V7oS1prRWkqWcTehIDjnH9tF9B3zcrmvphbD0YO7UqU89Gt0LRGgWsyPFBxWU3J++S 7OMo3UbxLGMeWkA6MFXz6i9ngZ20GcdlgqYfdckRsSDXn0FJLfnL6PjJ/kXdbuBNOO KWJ/rQclpGDwg== From: Timur Tabi To: Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Vlastimil Babka , Andy Shevchenko , Matthew Wilcox , akpm@linux-foundation.org, Linus Torvalds , roman.fietze@magna.com, Kees Cook , John Ogness , akinobu.mita@gmail.com, glider@google.com, Andrey Konovalov , Marco Elver , Rasmus Villemoes , Pavel Machek , Tetsuo Handa , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/3] [v4] kselftest: add support for skipped tests Date: Sun, 14 Feb 2021 10:13:47 -0600 Message-Id: <20210214161348.369023-3-timur@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214161348.369023-1-timur@kernel.org> References: <20210214161348.369023-1-timur@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update the kselftest framework to allow client drivers to specify that some tests were skipped. Signed-off-by: Timur Tabi Reviewed-by: Petr Mladek Tested-by: Petr Mladek Acked-by: Marco Elver --- tools/testing/selftests/kselftest_module.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/kselftest_module.h b/tools/testing/s= elftests/kselftest_module.h index e8eafaf0941a..e2ea41de3f35 100644 --- a/tools/testing/selftests/kselftest_module.h +++ b/tools/testing/selftests/kselftest_module.h @@ -11,7 +11,8 @@ =20 #define KSTM_MODULE_GLOBALS() \ static unsigned int total_tests __initdata; \ -static unsigned int failed_tests __initdata +static unsigned int failed_tests __initdata; \ +static unsigned int skipped_tests __initdata =20 #define KSTM_CHECK_ZERO(x) do { \ total_tests++; \ @@ -21,11 +22,16 @@ static unsigned int failed_tests __initdata } \ } while (0) =20 -static inline int kstm_report(unsigned int total_tests, unsigned int fai= led_tests) +static inline int kstm_report(unsigned int total_tests, unsigned int fai= led_tests, + unsigned int skipped_tests) { - if (failed_tests =3D=3D 0) - pr_info("all %u tests passed\n", total_tests); - else + if (failed_tests =3D=3D 0) { + if (skipped_tests) { + pr_info("skipped %u tests\n", skipped_tests); + pr_info("remaining %u tests passed\n", total_tests); + } else + pr_info("all %u tests passed\n", total_tests); + } else pr_warn("failed %u out of %u tests\n", failed_tests, total_tests); =20 return failed_tests ? -EINVAL : 0; @@ -36,7 +42,7 @@ static int __init __module##_init(void) \ { \ pr_info("loaded.\n"); \ selftest(); \ - return kstm_report(total_tests, failed_tests); \ + return kstm_report(total_tests, failed_tests, skipped_tests); \ } \ static void __exit __module##_exit(void) \ { \ --=20 2.25.1