From patchwork Wed Feb 10 21:34:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 12081813 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,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 18AB4C433DB for ; Wed, 10 Feb 2021 21:35:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB91E64E63 for ; Wed, 10 Feb 2021 21:35:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB91E64E63 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 4FF026B006C; Wed, 10 Feb 2021 16:35:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B0396B006E; Wed, 10 Feb 2021 16:35:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 356CB6B0070; Wed, 10 Feb 2021 16:35:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 16F8B6B006C for ; Wed, 10 Feb 2021 16:35:13 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D7E9017AB4 for ; Wed, 10 Feb 2021 21:35:12 +0000 (UTC) X-FDA: 77803664064.11.print50_180936627613 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id B84C1184AAA9B for ; Wed, 10 Feb 2021 21:35:12 +0000 (UTC) X-HE-Tag: print50_180936627613 X-Filterd-Recvd-Size: 3922 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 21:35:12 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 41FF264ED3; Wed, 10 Feb 2021 21:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612992911; bh=8tTiZffCqSEw+dTBl5CcepjBXZXAYDtz8KWxX7o0+y4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AikDPLi4WSINbPezxSalvn6mcvi2m6Xxzo1rfd5guS8dsdL/HvGGaxn/7/rJJAdGN GwSd8o7ijbE55ZL/sUNt6Yi93pJMTWsXjpPChSk4scKwuKSPZjiovXlXgK9h+YsHY3 7Tadr93jV7QK2s6S2EldXgjnsL6TGN+SQuXqKKUBOejSTBvKtBueLcePfXcIYCwGj8 q6CET1EfJlx+5ZGPhWf+PZLj+i11GEh8oqbzPCbzQIFgswGVrNIm/w4do62I7AvCE8 m4LHfOCpIBElI/Gq1kNjUVPU/gCUS9Kqv44pwz1sOb9mKJ25G0dpnC2imf5TrN+OQh daCPDe73qtBJg== 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] [v3] kselftest: add support for skipped tests Date: Wed, 10 Feb 2021 15:34:52 -0600 Message-Id: <20210210213453.1504219-3-timur@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210210213453.1504219-1-timur@kernel.org> References: <20210210213453.1504219-1-timur@kernel.org> MIME-Version: 1.0 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 --- 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/selftests/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 @@ #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 #define KSTM_CHECK_ZERO(x) do { \ total_tests++; \ @@ -21,11 +22,16 @@ static unsigned int failed_tests __initdata } \ } while (0) -static inline int kstm_report(unsigned int total_tests, unsigned int failed_tests) +static inline int kstm_report(unsigned int total_tests, unsigned int failed_tests, + unsigned int skipped_tests) { - if (failed_tests == 0) - pr_info("all %u tests passed\n", total_tests); - else + if (failed_tests == 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); 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) \ { \