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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 5CB55C433E0 for ; Sun, 14 Feb 2021 16:15:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2955A64E26 for ; Sun, 14 Feb 2021 16:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbhBNQOm (ORCPT ); Sun, 14 Feb 2021 11:14:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:39026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbhBNQOh (ORCPT ); Sun, 14 Feb 2021 11:14:37 -0500 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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/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) \ { \ -- 2.25.1