Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp241467rdh; Thu, 23 Nov 2023 02:46:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0oUeJWCS4lOlp4wFbnvhMMK7o2gpKHh2JATu1ttTQyoYb2AMcQsgNGNwh56Z2y/Pp7bOm X-Received: by 2002:a17:902:b905:b0:1ca:8252:a91 with SMTP id bf5-20020a170902b90500b001ca82520a91mr4523899plb.41.1700736390958; Thu, 23 Nov 2023 02:46:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700736390; cv=none; d=google.com; s=arc-20160816; b=Mue6cAB7yuVkalt+w2RwfEBhw+uPZj8oV40xT2xg2EUZAt4veBY7FngDwU5W0uL6mq JDafIaheJBE+HHR6qcBXuk23VEPTVTPngxd55E34O4sFCcerIoP+6uLDyrrnHCzRhyUt 5P9fWzwXqMWI/oFRDV4WTrmIQE8b58LHUlvihLr6Ewe+yS2HV3XRQjKp73MaXAbPGH7M dChtTNgCSvMbpHoYh+TSorkdLMv3wBFLgSSD/MTIg2a5qc76+jor6cQ7+2GR2j0P9IjR mPe1/+BJOE37j5G0emIU1/deY0LViLJSUaAoHNSRW+rJO9I5QO7/QZR9otPoXLMVb6K6 gcsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=EEOEwqzPMFgLH8090jvwTkFiMXDZbP/t7cilio45EME=; fh=xTLXRGx4c4TfWcKwHqVnB5TIoYG9Q9s1pGUshP+bk2Q=; b=MQU4f1LRCfb5KUjlAPLc1Jbdt1K5sJD28L0BbcrzAu5+NMcc/Y6x/cFH55KFz0NFzr vmTqjnQRm85Dpyuunk7xaNlQUsb9wUCbf0tD7IWbbt/8ow4xoHRKrhBifMdXiu6YYsfm uikG+vg41YTSICbh/CWe4fQCDPz6RQT85ywwYvEMEVAOfFJ9NrBdewgFAwxQv8ZnOKLl 6ZgbRUR2N2e/e91bKkbvkE4b8BEtFIIWUhbauqMk3BCs0/JDZM/fpbRLDOoyXvhRjR9f Iy2lnYvRQfjW/n3bAjtnpbWdS+Fu+onhBDB0nxEf71eRrWe7iZW0uo4m9YFUYDjMPrJw nMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="eI/Xmvpd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id q15-20020a170902788f00b001cf5cae80e5si882247pll.114.2023.11.23.02.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 02:46:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="eI/Xmvpd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4CB108075DE6; Thu, 23 Nov 2023 02:46:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344782AbjKWKp7 (ORCPT + 99 others); Thu, 23 Nov 2023 05:45:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbjKWKpz (ORCPT ); Thu, 23 Nov 2023 05:45:55 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 046C091 for ; Thu, 23 Nov 2023 02:46:02 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84F69C433CA; Thu, 23 Nov 2023 10:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700736361; bh=f9ztNUYk0shaQOX+D23ktWQugMWIRfK4+eA+oTSsXGU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eI/XmvpdUGIKVIljR1uNg7lSHWoUbl5bJR0mHGl4rwF1AP5ZXT1IiNHUrQ5IW3QQO JD0JkR5AwR+gsIoZqo58gzLzD82MCFCTGu9XAUYK6iEnW0QgMeiDc7YmcyTCkeWzE+ XsB8VL3APR8qtSykPR6QKQnGlbNzxnZYwYi97YnwFAgX80ujQYQXGMu3CvhmeiBAqC hlaNy295jJuYyaBKT96rRPtr74mpum6kebrElNJ9Qn0BKLLfyOUwLwnEgO3U0xaGo2 F6D9VUOnsiwh8gv0L1GH+PJa4dQvwsBLDrdarg7Q9KI4uecJS8vj6sOCPC4R26YnCI 8303Qcnf5UGGg== From: Mark Brown Date: Thu, 23 Nov 2023 10:45:47 +0000 Subject: [PATCH 1/3] kselftest/vDSO: Make test name reporting for vdso_abi_test tooling friendly MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231123-kselftest-vdso-test-name-v1-1-1b30441c422b@kernel.org> References: <20231123-kselftest-vdso-test-name-v1-0-1b30441c422b@kernel.org> In-Reply-To: <20231123-kselftest-vdso-test-name-v1-0-1b30441c422b@kernel.org> To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=6296; i=broonie@kernel.org; h=from:subject:message-id; bh=f9ztNUYk0shaQOX+D23ktWQugMWIRfK4+eA+oTSsXGU=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlXy1kG3DQ6TV+c1qw4FsNHIPg58Uw/Cx4iRvul tx/bsQhG5OJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZV8tZAAKCRAk1otyXVSH 0At/B/42TjILXbyY8E1rRvJ5D96OjQqagGrgBmJA7LhtJ3SEGmEyR7QdmSyMubkCEqOHisghGmX CPfEkzAyjE78nHVa94OpZ5x6MVgqQGorCGqvQOoGV8mms+Pat/7Kig44EVGQCv23M/ONtqba9ev sPA4OJkABYAtMHx0KuDgWPdAeUV6vWBYKbFF5Tn6lCvYAA4chN68yvqORYawLDfNk3q8AcIrbv/ a8P+2R9Ed4H6NzSnbumrHLA5UfRipRnF+gCz6LWWnHr7NUlSmVvmLlO+Q2+mnZXR0RGy4oyLfae apnrTghMtWRaNQlqGMEN47nAdAjf1OnlBnT6qCMUJCOCo1V+ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 23 Nov 2023 02:46:22 -0800 (PST) The test results from vdso_abi_test are all formatted using a series of macros: #define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__ #define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x #define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x which don't play nicely with automated KTAP parsers since the actual KTAP lines are in the form ok 1 with no test name and we get an additional log line such as vdso_test_gettimeofday(): PASS with no preceeding # as KTAP requires. The lack of a test name means that many automation systems will have a hard time distinguishing between the different tests or correlating results between runs, the lack of # is less severe but could potentially cause confusion. Fix these issues by rewriting all the result reporting to include both the vDSO function name being tested and (where there is one) the name of the clock being tested in the main KTAP line. Since we have tests both with and without a specific clock we abandon the helper macros and just put the format strings used directly in the ksft_ API calls. When we fail to look up the relevant vDSO symbol we add a separate print statement explaining why the skip is being done. This gives output such as: ok 1 __vdso_gettimeofday # clock_id: CLOCK_REALTIME # The time is 1700673118.58091596 ok 2 __vdso_clock_gettime CLOCK_REALTIME which is much easier for test automation to work with. Signed-off-by: Mark Brown --- tools/testing/selftests/vDSO/vdso_test_abi.c | 66 +++++++++++++++------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c index 883ca85424bc..b304abae6e8f 100644 --- a/tools/testing/selftests/vDSO/vdso_test_abi.c +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c @@ -33,9 +33,20 @@ typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts); typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts); typedef time_t (*vdso_time_t)(time_t *t); -#define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__ -#define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x -#define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x +const char *vdso_clock_name[12] = { + "CLOCK_REALTIME", + "CLOCK_MONOTONIC", + "CLOCK_PROCESS_CPUTIME_ID", + "CLOCK_THREAD_CPUTIME_ID", + "CLOCK_MONOTONIC_RAW", + "CLOCK_REALTIME_COARSE", + "CLOCK_MONOTONIC_COARSE", + "CLOCK_BOOTTIME", + "CLOCK_REALTIME_ALARM", + "CLOCK_BOOTTIME_ALARM", + "CLOCK_SGI_CYCLE", + "CLOCK_TAI", +}; static void vdso_test_gettimeofday(void) { @@ -44,7 +55,8 @@ static void vdso_test_gettimeofday(void) (vdso_gettimeofday_t)vdso_sym(version, name[0]); if (!vdso_gettimeofday) { - ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[0])); + ksft_print_msg("Couldn't find %s\n", name[0]); + ksft_test_result_skip("%s\n", name[0]); return; } @@ -54,9 +66,9 @@ static void vdso_test_gettimeofday(void) if (ret == 0) { ksft_print_msg("The time is %lld.%06lld\n", (long long)tv.tv_sec, (long long)tv.tv_usec); - ksft_test_result_pass(VDSO_TEST_PASS_MSG()); + ksft_test_result_pass("%s\n", name[0]); } else { - ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[0])); + ksft_test_result_fail("%s\n", name[0]); } } @@ -67,7 +79,9 @@ static void vdso_test_clock_gettime(clockid_t clk_id) (vdso_clock_gettime_t)vdso_sym(version, name[1]); if (!vdso_clock_gettime) { - ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[1])); + ksft_print_msg("Couldn't find %s\n", name[1]); + ksft_test_result_skip("%s %s\n", name[1], + vdso_clock_name[clk_id]); return; } @@ -77,9 +91,11 @@ static void vdso_test_clock_gettime(clockid_t clk_id) if (ret == 0) { ksft_print_msg("The time is %lld.%06lld\n", (long long)ts.tv_sec, (long long)ts.tv_nsec); - ksft_test_result_pass(VDSO_TEST_PASS_MSG()); + ksft_test_result_pass("%s %s\n", name[1], + vdso_clock_name[clk_id]); } else { - ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[1])); + ksft_test_result_fail("%s %s\n", name[1], + vdso_clock_name[clk_id]); } } @@ -90,7 +106,8 @@ static void vdso_test_time(void) (vdso_time_t)vdso_sym(version, name[2]); if (!vdso_time) { - ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[2])); + ksft_print_msg("Couldn't find %s\n", name[2]); + ksft_test_result_skip("%s\n", name[2]); return; } @@ -99,9 +116,9 @@ static void vdso_test_time(void) if (ret > 0) { ksft_print_msg("The time in hours since January 1, 1970 is %lld\n", (long long)(ret / 3600)); - ksft_test_result_pass(VDSO_TEST_PASS_MSG()); + ksft_test_result_pass("%s\n", name[2]); } else { - ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[2])); + ksft_test_result_fail("%s\n", name[2]); } } @@ -114,7 +131,9 @@ static void vdso_test_clock_getres(clockid_t clk_id) (vdso_clock_getres_t)vdso_sym(version, name[3]); if (!vdso_clock_getres) { - ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[3])); + ksft_print_msg("Couldn't find %s\n", name[3]); + ksft_test_result_skip("%s %s\n", name[3], + vdso_clock_name[clk_id]); return; } @@ -137,27 +156,14 @@ static void vdso_test_clock_getres(clockid_t clk_id) clock_getres_fail++; if (clock_getres_fail > 0) { - ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[3])); + ksft_test_result_fail("%s %s\n", name[3], + vdso_clock_name[clk_id]); } else { - ksft_test_result_pass(VDSO_TEST_PASS_MSG()); + ksft_test_result_pass("%s %s\n", name[3], + vdso_clock_name[clk_id]); } } -const char *vdso_clock_name[12] = { - "CLOCK_REALTIME", - "CLOCK_MONOTONIC", - "CLOCK_PROCESS_CPUTIME_ID", - "CLOCK_THREAD_CPUTIME_ID", - "CLOCK_MONOTONIC_RAW", - "CLOCK_REALTIME_COARSE", - "CLOCK_MONOTONIC_COARSE", - "CLOCK_BOOTTIME", - "CLOCK_REALTIME_ALARM", - "CLOCK_BOOTTIME_ALARM", - "CLOCK_SGI_CYCLE", - "CLOCK_TAI", -}; - /* * This function calls vdso_test_clock_gettime and vdso_test_clock_getres * with different values for clock_id. -- 2.39.2