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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79801C54F30 for ; Tue, 27 May 2025 16:13:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD8976B00C2; Tue, 27 May 2025 12:13:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B3A7A6B00C3; Tue, 27 May 2025 12:13:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A02E16B00C4; Tue, 27 May 2025 12:13:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 70F8B6B00C2 for ; Tue, 27 May 2025 12:13:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E8F788108B for ; Tue, 27 May 2025 16:13:24 +0000 (UTC) X-FDA: 83489182728.18.0A619DE Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf03.hostedemail.com (Postfix) with ESMTP id F160E20003 for ; Tue, 27 May 2025 16:13:22 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lcFiSLrc; spf=pass (imf03.hostedemail.com: domain of broonie@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748362403; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vSxE+vO2Q0zgxS1mH2+Ru1cf4OrSpskOTn6Bs5IdoKc=; b=lOpRbdj+H6YKZsUWZlLC9RU2L+SSfDcI0wT2Kh9fkAEOXAfUuJ7dZWqq3tAJ5j5nSY/hbm ztj/xNflD6CgUoQlgMBaflHHD7AKQcgPmQpDf0b0ESEmnbb7myDAKM2VOBlOh+TJSoAFPT N/ZaZ8fnbdMEQQaB5Cavyi1A/LpPrRo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lcFiSLrc; spf=pass (imf03.hostedemail.com: domain of broonie@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748362403; a=rsa-sha256; cv=none; b=JCWvKTliakQ1kudTOwAz/c/g77zaGECXl/SrMnhDWMh2N+02tDkIK79SWURGYzm8E03KYk rd9ouLJtC5byfSQqXI3bVzDh6G+8NOm6d9S9c/ALgCcDbC8hWQ0Ou4cSoqFiqHnCdvjXQ8 jBCTH2mznVMZphH8U8efka31gMs5N04= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id A34044A7DC; Tue, 27 May 2025 16:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EFEFC4CEF1; Tue, 27 May 2025 16:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748362401; bh=BfV3xzhjunrMLDK9cWHpUfmqXZar03TrfugoHRogF2k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lcFiSLrcmPbrIwfvaoSotL1hnrEWYr1MiGfv33PRH6r72Jkw0Xm3Yl3WcqEnbCrZs WiLu0mbK93sTfCaXPfGu5dvL4kPlXBVNAU9jEVC+Cjbex9TIofzC6EV3lz1Fi4++/S BW8ClajFzBbsAiuze4FNoijNLNvAV4yU0i7VEtiUYcIGOy7TkPlv8uS3DMBRhHlVb+ sJoiW/kAxJitsWDQJhE6vD+ESGyjrizJUK1EYAWyaMUH1R9ZRtxpU7QU39g48wM07O GMsJxgEniYwY+gdLy3M4t4cgtIVymFqrav8SNDrgL167IYbHobVhpdW2BzQjjXvUUb 8zoRha2bsReQA== From: Mark Brown Date: Tue, 27 May 2025 17:04:46 +0100 Subject: [PATCH v2 2/4] selftests/mm: Add helper for logging test start and results MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250527-selftests-mm-cow-dedupe-v2-2-ff198df8e38e@kernel.org> References: <20250527-selftests-mm-cow-dedupe-v2-0-ff198df8e38e@kernel.org> In-Reply-To: <20250527-selftests-mm-cow-dedupe-v2-0-ff198df8e38e@kernel.org> To: Andrew Morton , Shuah Khan , David Hildenbrand Cc: Lorenzo Stoakes , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2420; i=broonie@kernel.org; h=from:subject:message-id; bh=BfV3xzhjunrMLDK9cWHpUfmqXZar03TrfugoHRogF2k=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBoNeSZFGgUGRjh/JzAf2Wi1QwwiU+M7NmFk0ydozbq UIbQ8AqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCaDXkmQAKCRAk1otyXVSH0FXSB/ 4lYjWbEISd9ZPjMuF+WeRSYIecmGrqlKUONbk4Kp3kf/KPFd+xUbfklb7NL5mol/5IlkyBKR5nsp2U wdZIrsBsg4SXtnLLt9TmNJBfHnxArL0wiAiff9CGm13MqC/di3oKB65M3wbcoOarE5rmPLe77ahziI 3MRHxI2xvQ04PX9PbFs//2fR9Y5SuEv6+rH9Dswy1cyKv6f4HTSqxrtdsSPLH/+H0LP/zO5bHF5Gkt 83oa9LH1Jme9Ym9ymO6KGpTbp3bvnkMsE0ufC+H8S3X7qn+VbrAiov0KvkndM2uLXAojdWd0s5hck9 dT4NfJC0a5TC0yHu2Lk5JTSIF8fize X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Stat-Signature: nedto81hjj68xs9hcp6fenduawb1ojtr X-Rspamd-Queue-Id: F160E20003 X-Rspamd-Server: rspam11 X-HE-Tag: 1748362402-12824 X-HE-Meta: U2FsdGVkX1+8fX69cGm6ErL7y6tXIUiENqxKfaUJDylBcQCeB/k5bLGY+WBUzd3j7x5G1puNmEe5KBtg0MTZptD6YQd2qjkXXEFByIkREonZrMRJKV4NudzbXK+35h/WjNs1DNCtYQyYyFh0+WdYJGCIPCFbT6YL3ldZ0wFMWCNWldjF6sXpxIXrp4rplNnt21587nog20zoidSsbtkprbvY+PudI2nZRt7kyBUF2kiL7+tmA10QAx7JDQlWaSb4/UTVmJF4r0OGbBPPYK1eMGZU0+qBZpW9RuyF0cjapwazUEtfdOGxX/RzWe9brnszD4TCvNg++CM8g14CnAiu6N1gFJ3FXlcbIfFey7t5a18nVv6ZjBqHwGGLhi0z8mznW+RXU2bqEvHiIqUxRWxoDpryvqw3hSgkGfguw5WSt3SFaCFCWZjAxrix+EwOQelA1d++UBX2z9p4r0FRcpYyMA6J4vOxAvJkDgIsGF99aHdO5YbPIaqeosG6FWhoIS6t0kKbe4yZkQyz40D26JtjZhrfzkp+oWU+cPDEeqmOPlYydNRSwZ6K2YdGBlAXNuHvR8kX5iadhlB7ly6UWPSTBPULAN+5aJCCSEB6z6mRE0MQBqazQPeiFEpokHmjPL1BN1UEXA7tMXGkzIg2qsQab0kraflx2jU4Pz/skgQrOEL1lx9rrxjH+qpLtku1Ht/Uzp7qTutwmtqJ80Bl63YGpYfGeeR4j1Gbzf5niRxpQDJ7LHQ0EkKmh72BrKa2bntcY2meVM7SjUl1MyP+TjZ63DIG6vuRx9dd5vRZIOlbtHvk8p8WSQuuRwbrwKlKbozWrPRGjbMzIvTaQGOGR6qVRx6F5ihZpAhPCAfJWT8sQ2JiK88C7t69/JhbWwJOnFFTNAj41YHjm0y/P249ptPY4RmkuKlGNhmvt5m2Df8y1UoF05FUaLbClHQU4PpxyoQOgOfH3hAKr6ItCmpLgqg MoOJkaGG Zjkoe6BvHsTskExl2RxiHGplaaHWbdJZlfxfrw8RnJLhSMKZOgqDtuL5HzGp3yi6irOnW5vaBvVSiktnli9P/GX0b2LVIgQkjvsWUCXaz4L3VHzgrXt0VX/fkbgQBYm7Yy1O6zs1vBQPiykPReJ7z565T9+xdLpEf1/WY0o5Q6zH8DPwZrnkM8kuk6VNh3Imh6EO8go6uEe8vMTwuGDzpojH6UGdoNqfe/Ils5T5drd8Rd+z3/OxoPywAxjTs3jU0GLyISogafe8r6Jmrw1Wm8SCJDA== 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: List-Subscribe: List-Unsubscribe: Several of the MM tests have a pattern of printing a description of the test to be run then reporting the actual TAP result using a generic string not connected to the specific test, often in a shared function used by many tests. The name reported typically varies depending on the specific result rather than the test too. This causes problems for tooling that works with test results, the names reported with the results are used to deduplicate tests and track them between runs so both duplicated names and changing names cause trouble for things like UIs and automated bisection. As a first step towards matching these tests better with the expectations of kselftest provide helpers which record the test name as part of the initial print and then use that as part of reporting a result. This is not added as a generic kselftest helper partly because the use of a variable to store the test name doesn't fit well with the header only implementation of kselftest.h and partly because it's not really an intended pattern. Ideally at some point the mm tests that use it will be updated to not need it. Signed-off-by: Mark Brown --- tools/testing/selftests/mm/vm_util.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 6effafdc4d8a..4944e4c79051 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -3,6 +3,7 @@ #include #include #include +#include #include /* ffsl() */ #include /* _SC_PAGESIZE */ #include "../kselftest.h" @@ -74,6 +75,25 @@ int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, unsigned long get_free_hugepages(void); bool check_vmflag_io(void *addr); +/* These helpers need to be inline to match the kselftest.h idiom. */ +static char test_name[1024]; + +static inline void log_test_start(const char *name, ...) +{ + va_list args; + va_start(args, name); + + vsnprintf(test_name, sizeof(test_name), name, args); + ksft_print_msg("[RUN] %s\n", test_name); + + va_end(args); +} + +static inline void log_test_result(int result) +{ + ksft_test_result_report(result, "%s\n", test_name); +} + /* * On ppc64 this will only work with radix 2M hugepage size */ -- 2.39.5