From patchwork Fri Jan 26 11:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13532446 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 69359C47422 for ; Fri, 26 Jan 2024 11:21:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6DBB96B0088; Fri, 26 Jan 2024 06:21:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 665176B0089; Fri, 26 Jan 2024 06:21:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 504DE6B008A; Fri, 26 Jan 2024 06:21:36 -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 3B3FC6B0088 for ; Fri, 26 Jan 2024 06:21:36 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B4F40A2559 for ; Fri, 26 Jan 2024 11:21:35 +0000 (UTC) X-FDA: 81721221750.20.5B1C8F6 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf19.hostedemail.com (Postfix) with ESMTP id 011771A001B for ; Fri, 26 Jan 2024 11:21:33 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Eo4Ds7gZ; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706268094; a=rsa-sha256; cv=none; b=os1DGLTPmHnVMKEecobGspejE8lCgRSUm/jgrGdTJaLdpqu0p3T5/xWx1K9ZXW0+QNG3aV 8mZmH8zso1TH4dsvKfr1R0ypVqK3pP9wer7P5lPEwGMzgqugj60bVX9bRA/ZjNp0dOQLpA 95dKpsMx0qO3wXqlT7zJdkweFs2rg/I= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Eo4Ds7gZ; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706268094; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=yDEIE6dCkV9+bQRhLs15NptmdPtNVbkHi5mI4CUtOR4=; b=DbVrpbWWE1HbBj1RtzW3G54D18ia84BLXvIVMSUC/YGsOuqbqZ9kZlSXczmO8kWlPEkMXn GqkUJ+SBZcqPGZUxZUo2rOVq92RAQV2KyTArt9nBUDKRhZONU9P6r9895ICRsUxhIbVz3J /UR2vDq+CgX0b/7cJXkg6YxO+8QPnxQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706268092; bh=zr0XdrCeozGCHNrEz9eIS0AqUmrXwsL2hLb6jsLfr0Y=; h=From:To:Cc:Subject:Date:From; b=Eo4Ds7gZ0n2T2bHkapPWCIldbMKQXWdm+7CVk8150CPq/ZGvWKp3/E1zTxJas7uvu 83oi/D4WO04eqIYu0a0qVMWLJ4x1xKAdQfxecmV8wSyxID6hrRAiqghTSbaU9ycl// cxknX56Yg42Mu7l4RIFG4ga0CLPx5YjcsjBYctX+nJWWeB/T1Cnmt9gP+OKpURA1Ph JFa8C/KAx/Uce4l6WMkjPpc5guCMqJcVckIloWKp0zD1PsFD0OfhPxBu2+jeBvVpYl yceXbDGg25Mk2bttqkiggQGRjAuPWPLqBemd8A51ApZ6O+4VpxmiMpJ2JFWDf8JLM7 uzElHOGqwpxhA== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 4B6ED3782072; Fri, 26 Jan 2024 11:21:30 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan Cc: Muhammad Usama Anjum , kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/7] selftests/mm: hugepage-shm: conform test to TAP format output Date: Fri, 26 Jan 2024 16:21:20 +0500 Message-ID: <20240126112129.1480265-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 011771A001B X-Stat-Signature: h5knrza11crj8563wi5j9n7q3usxahuf X-Rspam-User: X-HE-Tag: 1706268093-123772 X-HE-Meta: U2FsdGVkX1/SYpAHxE85N0+MF7l1AwoARtUFn30rT0+AC5Jp5l7KSau97XdSF58E6XCFDZVWPN8pMSHj0aYfJM6XN7q5XDB2oEAGJimEbkCtqI9VXWJV9yqs4cD02mUPfphMSq+SNqMt/VpGlL5skmef+08ueiE/DY37NWNNCDvQVehGywEWhjV6itFBXA+hP7Ei2Imlvj/EFbFsbWZUKPEVkFKMvod7oDUwfwX3r8XmzlXjoO+D/nUdmfrFwnvt0T4ZKzZkxjR9FKJIt53SljDS2fOKypZquAC3YsI9lOdI+FnTF96/9xQ2RrWJQFH8e+L6ufEDLU5BOTjTGrWZkawtJp+xb35de5rZyiMFWVIFwqsYA6+JmI+P8Uox3UhhDQV2qMakkOEGZLltNYAbhwRGDL8W52cpjMp/Ga/fqm4bRUp3QDVVShCZPKY9uJnyqhFFRyrdeBajgyNrnoBuLu7geVukInEnYvlQZj2J7gJI8skrn+5GEk6WbEC3xVG1UZVhNOjzk9vUEeLNxDXQwyxbBEp5bfpvFcGZb9fk8h7FevaKnhgV8EI62+gTG3cUSKxXJ534C+iVdyPynBxO0RpFL2+0VbLuFa13nZZjZvM/OeFmku8jPYen5dYp6fzHd6VJPESxOllnfwuc1rrf5ilCXHBEIr/vToJXoHWcEGbPo+zxGWNSxz9p/jQZ1ahSYAx0YmQVyCS99elk9p1/Nv1iX1t9qccdJ/T9MN+d/EH46nlE6pwLo9raYannLTx2LibxCmos0g3cpelgSQ6zrYRJ8HdU8BhNVvjwBfgzJA/WKKYXMq/YFRfaNBeikt327tZOxPI6DZbL//ZlS5FQfF9TAATitjYrmPnaSB0Vv6GdfSu62L9UpdUJr9jq2rwNE5HJP/4H5uVXJOtgNP2pDf35jzhlnip/5HDOaU1at93UZ7EBcEyWC2DJMsROBe1Rl0gF8HPDgznbbzG2tJa DnI9i7RQ RtpuHj7zPSNdsRG4482zrmDzbUvlnbGAkjDQWnrT8b9w37A6nD+Z63Z2hQUnrr9xaP56/iFmF7TEUxu7vMFE6Xaw4AJeGHy5S/F1ZT2KYeeDMGpEvChmHCAemePkli63As96IEHZ6x3DEuejHOkcKgnDxRQhsOcd+CReXO+bDehVSlyUkHzoSlDlyTANNOAvCO6dARrG1ldZYRJ98muR32CGcxB7P2QQ0dhYtMsxUuLIu8iqd6ox+Sgx19g== 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: Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. The "." was being printed inside for loop to indicate the writes progress. This was extraneous and hence removed in the patch. Signed-off-by: Muhammad Usama Anjum --- Changes since v3: - Rebased on top of next-20230125 --- tools/testing/selftests/mm/hugepage-shm.c | 47 +++++++++++------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/mm/hugepage-shm.c b/tools/testing/selftests/mm/hugepage-shm.c index 478bb1e989e9f..f949dbbc34540 100644 --- a/tools/testing/selftests/mm/hugepage-shm.c +++ b/tools/testing/selftests/mm/hugepage-shm.c @@ -34,11 +34,10 @@ #include #include #include +#include "../kselftest.h" #define LENGTH (256UL*1024*1024) -#define dprintf(x) printf(x) - /* Only ia64 requires this */ #ifdef __ia64__ #define ADDR (void *)(0x8000000000000000UL) @@ -54,44 +53,42 @@ int main(void) unsigned long i; char *shmaddr; + ksft_print_header(); + ksft_set_plan(1); + shmid = shmget(2, LENGTH, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W); - if (shmid < 0) { - perror("shmget"); - exit(1); - } - printf("shmid: 0x%x\n", shmid); + if (shmid < 0) + ksft_exit_fail_msg("shmget: %s\n", strerror(errno)); + + ksft_print_msg("shmid: 0x%x\n", shmid); shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS); if (shmaddr == (char *)-1) { - perror("Shared memory attach failure"); shmctl(shmid, IPC_RMID, NULL); - exit(2); + ksft_exit_fail_msg("Shared memory attach failure: %s\n", strerror(errno)); } - printf("shmaddr: %p\n", shmaddr); - dprintf("Starting the writes:\n"); - for (i = 0; i < LENGTH; i++) { + ksft_print_msg("shmaddr: %p\n", shmaddr); + + ksft_print_msg("Starting the writes:"); + for (i = 0; i < LENGTH; i++) shmaddr[i] = (char)(i); - if (!(i % (1024 * 1024))) - dprintf("."); - } - dprintf("\n"); + ksft_print_msg("Done.\n"); - dprintf("Starting the Check..."); + ksft_print_msg("Starting the Check..."); for (i = 0; i < LENGTH; i++) - if (shmaddr[i] != (char)i) { - printf("\nIndex %lu mismatched\n", i); - exit(3); - } - dprintf("Done.\n"); + if (shmaddr[i] != (char)i) + ksft_exit_fail_msg("\nIndex %lu mismatched\n", i); + ksft_print_msg("Done.\n"); if (shmdt((const void *)shmaddr) != 0) { - perror("Detach failure"); shmctl(shmid, IPC_RMID, NULL); - exit(4); + ksft_exit_fail_msg("Detach failure: %s\n", strerror(errno)); } shmctl(shmid, IPC_RMID, NULL); - return 0; + ksft_test_result_pass("Completed test\n"); + + ksft_finished(); }