From patchwork Fri Feb 9 14:30:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13551422 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 C3089C48297 for ; Fri, 9 Feb 2024 14:32:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45C346B00A1; Fri, 9 Feb 2024 09:32:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E3FC6B00A2; Fri, 9 Feb 2024 09:32:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25E166B00A3; Fri, 9 Feb 2024 09:32:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1A2ED6B00A1 for ; Fri, 9 Feb 2024 09:32:35 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B9D45A10DC for ; Fri, 9 Feb 2024 14:32:34 +0000 (UTC) X-FDA: 81772506228.05.859FA5D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 12D1B1A0003 for ; Fri, 9 Feb 2024 14:32:31 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VKE8eD3s; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707489152; 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=aKzTDahlVj8xRK0vIE1wscgclUuMUEExT5K2RbizY8k=; b=AZuOZ89AKU5L2aQ/YIJxnGUNlMWtkQCXOTe5AOiS3nyYL85deH2oM9vVnoQ/8kY7hkh+e2 q3gxvMa+0fMmuBAB8uNpe+0ra1KMPuX6O5xSUFHs7ozxmW5yWEKlH5Ot3iPi0gkWL2KvBA 8QGutDh/Q2pKOPNKw1v3sTP/o3WmM4U= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VKE8eD3s; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707489152; a=rsa-sha256; cv=none; b=qiGl8cyXgeT9gQ0HvKTO/LU5hqMr1DSQmJ8cjNV2vSWYBDUZWzXQ1rlwJCC8y5DCz+KEhz 1v2asFz+LkNCNLQmajlkXAWsKruKNgXRhOJNB26mVwkr/S3TZoCrODlv7TgZsqEIWoO1nr XlE4qdzlsQhotFY+00B8hmzIQitOWHc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 16B1B61D0E; Fri, 9 Feb 2024 14:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CD0BC43390; Fri, 9 Feb 2024 14:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707489150; bh=SNdpuBCpO0JSkOWXvK3leOkPlkJ8pkETSJ0EjQBtI1E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VKE8eD3sZWW5fEQtWPkCRBNkQo3ehVIXsOA9fELaVSi3m9F+Vd0l32uyrCJX7/rkP Mod0j110Xyn45qDVbqHYvHZZ+2Q13WAbCjHuubA1INaigCrg+lNEzxm59Q174XvRqn Ot1IkZcWh1jHJaH2i2jaWhn3wi3Lrt6+C313F11LHm6Bz+O0jST3KdcV05uivd6LZ1 vGg0REiPgMH/tigU2ahFd/9XG8Ib4pMGtMVPIrPr++s09K4zvF7dh5wpayHnFPXLn5 AurgQWPdsp73phvU2MRxKY4oZ5a2eZvmV4T3/QkYw/LVwCyeb/O/eH/Id+gfxOmL3Y 3mubJ3UyNBKUg== From: Mark Brown Date: Fri, 09 Feb 2024 14:30:03 +0000 Subject: [PATCH 1/2] selftests/mm: Log skipped compaction test as a skip MIME-Version: 1.0 Message-Id: <20240209-kselftest-mm-cleanup-v1-1-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=940; i=broonie@kernel.org; h=from:subject:message-id; bh=SNdpuBCpO0JSkOWXvK3leOkPlkJ8pkETSJ0EjQBtI1E=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlxjd2aWt1MZeqGP+Sjwd45kcKirLj+wtx0YjNP /5BRSewS8+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcY3dgAKCRAk1otyXVSH 0Lr4B/4mqYsi2Lo6QA241MmfSg0cwBXmgg2LOHFVMA62X1zAB/NMIQYNAhSVIFZTrGaZg1+/KX5 u7pVXzG8Y5C2XmrXHeMCoeuUAkWeaVV+tojvjmG4WUTO+cWJuqPJi7K4V5HP+p7i8YcPyqp1sUB rWkO4mJC6DQ9QVk6Oho2B1IGG9BBEYNwxEJqsUzB4/6VAenIJj/unbUI/thLu8zUFCTFQqRMjjB zXDCW0PlErz9/y7xG/p3G3CNYRekFr+mMLtYNfIposkiQ8NtFiUeE2HCaOXMYwyrhDM0AcAwjGo w2LwNXEUk4eEeARHxe3VeOud4S6J5gVREjwhJdtSPy93sbMl X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: 12D1B1A0003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: bw5cgfymgcisx54tcfc5yhgfa96gre47 X-HE-Tag: 1707489151-515722 X-HE-Meta: U2FsdGVkX19e6xKHFDIhkKEdj8Tfh7ThuS1j/QzlnQ/CfL5KDvGPvu7YLLzZdH4BHRrD3zxPYFpkt/ONcMy4lW4oyQG1xA0Xff0aNZnlRsDhClKfk0kvOPg5JUnEhaH9V2vnd3Py2FvHHCgoQrKf4t+b/Rz0S6dNtVtbUjipUxehWhCrKJU8gPEhs/FaMV2SlNXLDy1ugKBHIot6/jd0zoH1CsMKLS2kn6slps2A++tPWgMh1OK/edNOPCIES2deWhXmEyWjQFjQSwUxoD3TufKJKrg4yvjXBlruCdUJ6hcLeccW/LYHuoTCmnIN2AzKOG+NcUX1B1rLLLe/5YKzXaJh3WZXdDgggC8kiljtxESNfQFqgFdu/WucmCn4VGKPVx9Wl+oU5aZ8kLSmsxgufTEm0heRpk7yChV2Eq0q56ndp1MLmxXGNka+I+vcSdTcaPfz+otxuKLhvl9ZrBAdAtbETEvZ/ZKJnkcV/wTVlNuBjaXxwpw7U1JhBUrDBuRezfycmItL+t7INlCP+fe/GWD4CXZCHBk/6vbX3onVQjVHGt7XfBMS42Y3m/upUiNIieGJRzngdEkX2jhBrUxzIWUQUHPpWyAxxGKJZSAs0pJdDDBx61tZvFMGy58f9jr0ts6zo39FO+zz2xYkbNpkZyTOp0bRt0Ajb8uzbPdo5oWsHN8ECPxY4LIqxheSjV4GSUcgxyiTUJLDu+DNuLkiZO+xLAOpnmyEgI6Z2qIGP0hnIUOKgdvn4ioaFqXf+VD4Ua9FjCPkNKWl7YiKglBh5PqYzuiJTtmmFtYWoHuHCOmPhxa0cgMux3XNUVJU1uMamhNzSZ7RP4dkm1n9uURBh9A/kqBcBZXZsINKAhbx2uaqm43dJrdXEoAYDuHfjaTiIKYvb7e5zlI= 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: When the compaction test is run it checks to make sure that prerequistives the test requires are available and skips the tests if not. When this happens we log the test as a pass rather than a skip, log as a skip so that the distinction is clear and automation can see unexpected skips. Signed-off-by: Mark Brown --- tools/testing/selftests/mm/compaction_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 656afba02dbc..30150929c8c5 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -174,7 +174,7 @@ int main(int argc, char **argv) ksft_print_header(); if (prereq() || geteuid()) - return ksft_exit_pass(); + return ksft_exit_skip("Prerequisites unsatisfied\n"); ksft_set_plan(1); 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; }