From patchwork Fri Feb 9 14:30:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13551423 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 AADC6C4828F for ; Fri, 9 Feb 2024 14:32:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19D7F6B00A3; Fri, 9 Feb 2024 09:32:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14EA66B00A4; Fri, 9 Feb 2024 09:32:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F31F36B00A5; Fri, 9 Feb 2024 09:32:36 -0500 (EST) 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 D675D6B00A3 for ; Fri, 9 Feb 2024 09:32:36 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id AEBCF410FC for ; Fri, 9 Feb 2024 14:32:36 +0000 (UTC) X-FDA: 81772506312.06.0E9FBE8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id D9BF220015 for ; Fri, 9 Feb 2024 14:32:34 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Py2oq7OI; spf=pass (imf13.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707489155; 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=VpdtrfYwERXZyrF0lVFzXyZyYmGof7PY9FJH8B/V6S0=; b=Elsrl9RmkQxw7wDCmPcRnMXY5qcvHrn97F9M7emX8EKgycdWwbsGr437GzoYTdRnLWaev3 SE3m3H7dTOmxgGjQx8x7wW50nTolfF6WMFI45ze9AT+j5zNCbsh/FSRt1zN39iaADO+A6o UzmqWoheaMFZ11Qh+fqoyMkp27E/njk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707489155; a=rsa-sha256; cv=none; b=6L376rsF9YjBEoR0CtaER4+e+L/LdBJHYFPOKYzDm46Atqehrimt/gSPZ5SW6SLfZZzdvI PYomdl3QhMmk3+lbH09q7qm9qby++OZ4OIHhx6Vp8iW+W6x0RVYpQhhSK+pstOpNQo/QKy iFAhyh7Pnx7bkwPF4HJQkMFZYDtJArk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Py2oq7OI; spf=pass (imf13.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0DECB61D06; Fri, 9 Feb 2024 14:32:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBEFAC433C7; Fri, 9 Feb 2024 14:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707489153; bh=n2TkytHIU4mJGTYx0ffPU1nCUw4lDwT3it9P2hgZMPQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Py2oq7OIoqGE1rDSbcY4ohm7stPtta09azzXhVmXoVzbO/0KaU7eC/gGaa5B2uJya ghfwSgvu1WyV3AssZpBArKxQ+NDKA/FkPwQvRLA33obpvD//AicUslTMbDNKPdwq/7 3pSxLNPShKyL2QxN8mYrPjn3R1lPMGA5WQtFU3k5y3hsBmtb/zWUPtAlYtmo7OwXaw JqG6H1X3af1LE34qRQrwvFYTyzxlZPAvFngqjXCuvVBtzSAF8Hm7Fa1f9h78yRmHj+ QXZM6J/xZVntBQ2Sj2l4MtSYTOFd9Elk7ZC5ZpculubiLP4Pl0A5AeXzXhy12MtCNY ZSO7PdsEOP+oA== From: Mark Brown Date: Fri, 09 Feb 2024 14:30:04 +0000 Subject: [PATCH 2/2] selftests/mm: Log a consistent test name for check_compaction MIME-Version: 1.0 Message-Id: <20240209-kselftest-mm-cleanup-v1-2-a3c0386496b5@kernel.org> References: <20240209-kselftest-mm-cleanup-v1-0-a3c0386496b5@kernel.org> In-Reply-To: <20240209-kselftest-mm-cleanup-v1-0-a3c0386496b5@kernel.org> To: Andrew Morton , Shuah Khan Cc: Muhammad Usama Anjum , Ryan Roberts , linux-mm@kvack.org, 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=4141; i=broonie@kernel.org; h=from:subject:message-id; bh=n2TkytHIU4mJGTYx0ffPU1nCUw4lDwT3it9P2hgZMPQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlxjd2eHrNdRwA/quROZ5aC1w1CkozU3y7OQRiA QsCxUdoBAWJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcY3dgAKCRAk1otyXVSH 0DfUB/95u6qaCHLmx6YhkYZFy0UOyUJinhJLQsXirmJrQvvovBbB+oDXMGLdYsHMTg7Li2TMAgS s9uH/dAJDcoVtf0eEPwd+ztweDP26Q9sz6YzdJee6nPykOnyult75zLJnVo5KKEf0QWOyCwWMIy MZkfeqsEkVfnsKnsrHIhM/y0iLAN/4mBO6IyPqFgDGHsmebtxKqR1AikuvhFWufo5KGG+9IxCh3 N5qgNq9ClC9mYgUoSc1eWSiK3bXEYPNilDhvNBJL+6y8GxPQEnMrp0hfSkWUx/1Uzx1ClkjOvYU kpSQ9jSaMDI5CrpuDlvw5E3MutDaeJHBIC+Avx/EqSx5H9FA X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: D9BF220015 X-Rspam-User: X-Stat-Signature: 37ym7xjiuh1h8zcg5t34u9g6pkaegqsi X-Rspamd-Server: rspam03 X-HE-Tag: 1707489154-240802 X-HE-Meta: U2FsdGVkX1/VrdSsqmVVJg7/LxzxlPcYbRGwxS4o705wgp6EHvIsvvxNZuEqMSUniwxN0YqbPtoCz/WxhiDwvAvhemPkc3tb1/bY+/5rmEhxnxRuRLjJGbOwMfaVN0hI60Q1pEzDDTU2rlYKex74Athmcn6KqnTVAEaUvBmEYnYRu7j8YjqUZPzu3bXQVibUT2N1f+bk3KqKIXqepKmjhjnv8J+KAzwuhismpW1cZcRlqWPKu4DGHnxG1CeDf12q7sXbUkmA2iWGGKEjoMrklcVUrGV0lqNidM4SzfsON4OZCnNdx3Aof6sJ2mXXjfP0m8HbgDK/dV6bY6y/MP6kJUrdvU5pDxF7TDERVKNAc5Bo97ulHeWYw/pWaq6zcP+uCOGL14R3y3SKbTz0Ks87VnZ/GMD/bwl19bFHhTe9/U+9aPh1O2ircrUPMBG1qWy50QiB3Rx6beC/Hk8lieDGLtejHuin1CvvbvaqhY7vU5E1fnTSD15TAhm6Z4V0ub0As/HkzqopPWewROS94vl0j7Ztsw5txeIoTwGFyPFrgHEKnqTu5W1tDc13UDVxaBcWvDMJgCDZQz4ob+ibmVjN/AAkPM0K4BcWQmmE2z/mHOOdg34awNUi4qyl3lWaAHsVy4PEdcbICSCNnsqYFbFnpxx/T46qIwATv88iaSYerTv0Q8qQ/DCp0sZZKXyxumxLfIntKioLh2d9iDdxo1duAFfc9m9sBZAuhzO9mDUockcXCZW69WyHmTYPy3CxgaFHxlFxthDXIE6sbWw9mJySg2Zzlaxa27UvCYJuRApDbwVyMeBlViEtgVWCCPemS/wODc6cr4ArlEiGYOXOsHY6Ii89boJDsgswKhJ15o8xxflzXHX7/cUUM44GnfxB7/hzjmpkJXlE+qaPgPu/hsZIq4uhWzKW8WHq9V2UrnSp2NzsyW+KUFdGkgoldy+MKpjUuq+oJxBnJrPUulsMpP4 Ab/QyjPD k3i6Oft/YToK5p1yCPJ1cvigTEYuDHH1/Rkbf6cFbiGWo2hhC+5Uf6nh4Imj793tEP9oALLTh4qMEJ6a5qrsfpK85Hgx8aDE+cTHCxZBRzBzWbrpWG/3f9UWz695cRdVWl0NiG06fc63WY+8qRLGkny0fbHzOs2McDs3kiHZh9wSiFfJ6mVy7TFEvHvmWkXXENXiqEdBxh7pXnMtO4vWIZJTQi1oialla/mEWWgbDuJDohMovKIK4wdxZCCRG+PckPDRbYLYHmjncMA4IlcsiY03YJvniRea4zNpyPrHPzGBFeHc= 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: Every test result report in the compaction test prints a distinct log messae, and some of the reports print a name that varies at runtime. This causes problems for automation since a lot of automation software uses the printed string as the name of the test, if the name varies from run to run and from pass to fail then the automation software can't identify that a test changed result or that the same tests are being run. Refactor the logging to use a consistent name when printing the result of the test, printing the existing messages as diagnostic information instead so they are still available for people trying to interpret the results. Signed-off-by: Mark Brown --- tools/testing/selftests/mm/compaction_test.c | 35 +++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 30150929c8c5..533999b6c284 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -95,21 +95,22 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) fd = open("/proc/sys/vm/nr_hugepages", O_RDWR | O_NONBLOCK); if (fd < 0) { - ksft_test_result_fail("Failed to open /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); - return -1; + ksft_print_msg("Failed to open /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); + ret = -1; + goto out; } if (read(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) <= 0) { - ksft_test_result_fail("Failed to read from /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); + ksft_print_msg("Failed to read from /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); goto close_fd; } /* Start with the initial condition of 0 huge pages*/ if (write(fd, "0", sizeof(char)) != sizeof(char)) { - ksft_test_result_fail("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); + ksft_print_msg("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); goto close_fd; } @@ -118,16 +119,16 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) /* Request a large number of huge pages. The Kernel will allocate as much as it can */ if (write(fd, "100000", (6*sizeof(char))) != (6*sizeof(char))) { - ksft_test_result_fail("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); + ksft_print_msg("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); goto close_fd; } lseek(fd, 0, SEEK_SET); if (read(fd, nr_hugepages, sizeof(nr_hugepages)) <= 0) { - ksft_test_result_fail("Failed to re-read from /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); + ksft_print_msg("Failed to re-read from /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); goto close_fd; } @@ -139,24 +140,26 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages)) != strlen(initial_nr_hugepages)) { - ksft_test_result_fail("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n", - strerror(errno)); + ksft_print_msg("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n", + strerror(errno)); goto close_fd; } + ksft_print_msg("Number of huge pages allocated = %d\n", + atoi(nr_hugepages)); + if (compaction_index > 3) { ksft_print_msg("ERROR: Less that 1/%d of memory is available\n" "as huge pages\n", compaction_index); - ksft_test_result_fail("No of huge pages allocated = %d\n", (atoi(nr_hugepages))); goto close_fd; } - ksft_test_result_pass("Memory compaction succeeded. No of huge pages allocated = %d\n", - (atoi(nr_hugepages))); ret = 0; close_fd: close(fd); + out: + ksft_test_result(ret == 0, "check_compaction\n"); return ret; }