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: 198925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp896519dyd; Fri, 9 Feb 2024 06:38:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUt638cyczj4SqXxX+4SQhHrAA2YXAvLn6tgf/AfTfdeFcGm2urNQGe2EaoDvwGo+hddkR/ytAbP9Dh1NBiiS6PcPqL2g== X-Google-Smtp-Source: AGHT+IFQrXTAc3XPpYBvFuT1pwEAuQD08og9ZIfCD9RQ+mc4jTkuAE4MoSRHcApOXlgcaA+GsqWb X-Received: by 2002:a05:6102:4413:b0:46d:5ecf:bc2c with SMTP id df19-20020a056102441300b0046d5ecfbc2cmr2333862vsb.3.1707489511403; Fri, 09 Feb 2024 06:38:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489511; cv=pass; d=google.com; s=arc-20160816; b=mI/n13vy6TAUL4NzMiL2nTMa/xF6I3fiIG0x25bSzZEe0J+c1a+LsQabfcgvkY09gj W5x7M4Nk2T1muig8Svmbyc0TqDl/lPg+vLMK6bknI6HsQRkFsJv7EIY1sna0yBuUNP23 m+FzXtGp1HkAnh/6EzMxriKLHkDk1NuA+jKVG4kXvafy1genF3IBiNI5hNEUVSOwT33x kGMRt9UoP7+Z7gIAseE00w+l4PdImc430H1TUV7htS5PYSIwJrS/aHDl+dwCZWg1RljU j/X92CEq00IS/Mb2FnrGsJyfpr9JjslwvRcI24zi7gAoNL3mac1xKUErk06yfISsLb8u sl8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=VpdtrfYwERXZyrF0lVFzXyZyYmGof7PY9FJH8B/V6S0=; fh=j3P9zGfnjefkXGxNddILc+dSm8gN9Xkm/le6kFwId7M=; b=FZK7h3W0qYBzCngz/a9PuBJUHecO8+GCaz9oV2Ptcm/Z7FaHxGztJOuBy/obXNQTcw DGZ32fAVjzKz9R/E2OFeGCLxfjudwLejl2rSB7YPm4Ggipf9/zWiQu7QWCFzvM51Mv6I oCStmWdjFsm901hOLMMMIWvAUF5kn0iLaEP6zsQrATiKwPv1cebM331HfUk3sH7MLR0X W8mt1C6zWT+o1uxqf+cPgpsjJH7nDfd9HhS0tXVYeHrHsQ64/M+GuEvwhxvvniGdulwr N9/jhrrDSFn+lSMfeb834QNB+duRBPCL44q+eNlNYr7tBG56P2dtnSEiYAK2U79+1Ibz W3SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Py2oq7OI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59478-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUKkxfzDLQHlB+K9ujR70xIhfg30jLUPrp+9g1Xe6B4VFXFhW9S2J4pSX785Ak08PWyNC7dAhVmjmNn6Kb2jL8QWXOlHw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b13-20020a0561023a0d00b0046c9eb5c7fasi262726vsu.680.2024.02.09.06.38.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:38:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Py2oq7OI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59478-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 22A031C2210C for ; Fri, 9 Feb 2024 14:38:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60ECC12837F; Fri, 9 Feb 2024 14:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Py2oq7OI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59A17128372; Fri, 9 Feb 2024 14:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707489154; cv=none; b=dRDooECvdFxQ8OK6i5iNWwyy3Eyau22f6aEJmPEJJu6am51aEVMgbPQBpu6gAP9s90EXO5KXyAzP7/KihPKQAr9iSypA2avXftA3TvdXZP77ZyySvnFUFjC41pGMp/dsifEpoAjnMsCgL1oXa8OxToCcxT6tn0RgNeVRvP90cu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707489154; c=relaxed/simple; bh=n2TkytHIU4mJGTYx0ffPU1nCUw4lDwT3it9P2hgZMPQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h0oiLhkHQM4OpTWtFywK8FmuR5LnOHNLsdF/YabXnSurqU5TPutCaKJMz3ni6WkxgOEDgqgKiJlsbwRSZ4Cffe3m7GJPBhIKAue+uyOnf7O1rctcA0Je/5soL46Gy6JBXV7g8sU1Vya23p3r03B4AiV3MPku3pIWVvhULRcT7y4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Py2oq7OI; arc=none smtp.client-ip=10.30.226.201 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432521740757618 X-GMAIL-MSGID: 1790432521740757618 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; }