From patchwork Thu Jan 11 11:56:30 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: 13517285 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 7D232C47077 for ; Thu, 11 Jan 2024 11:57:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2E0D6B0087; Thu, 11 Jan 2024 06:57:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB8496B008A; Thu, 11 Jan 2024 06:57:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C57766B0092; Thu, 11 Jan 2024 06:57:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B09166B0087 for ; Thu, 11 Jan 2024 06:57:38 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 827434045E for ; Thu, 11 Jan 2024 11:57:38 +0000 (UTC) X-FDA: 81666880596.22.3D3A570 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf17.hostedemail.com (Postfix) with ESMTP id B2F8D40008 for ; Thu, 11 Jan 2024 11:57:36 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ZSa9qy7T; spf=pass (imf17.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=1704974257; 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=KEdkNivyIg3PurhJ3VjHntzXTr+Tal6Xval7en+bt2s=; b=t8AUcGY6A/LWM/d9U783jOVygzpAlvZ59XPGfIZcexyI7hE3mWDm2ZRquWvpiR/Sx7w3Rb SaHVL4meK8NfTuaeAt8ec8VENJpaQjACAUttjvH/MlIkgiYd+lTp3i3RcgHUYtz2kUPyRM qEueTdzDrDO3Igx06FXscZEBCJWUKs8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704974257; a=rsa-sha256; cv=none; b=Xuuics0+FONAyxRHs5mWqBcNMiMAx9/e8FbPrdY/2LxZM0LOdvdhZughmZdtuAicgriv/7 +D0LB/ecKBf/EseyD7e2nj9zBZcr7P7WdncFdFqb6wzSukS9dpdGSZo5xGjL9Wr4+ICVu9 DjWSoVLr7DM+KG7fhL9Nkvi3j5cm/bQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ZSa9qy7T; spf=pass (imf17.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704974255; bh=rRQZLwAtR4o/VCOAcxTzVSxdZ70bLgI9faWJJSJCsAc=; h=From:To:Cc:Subject:Date:From; b=ZSa9qy7Tl9zR64Qk9SDK6NPPOQBrzuuwsbhm3ASkRxLSEX697ewBw5gAVzlmlRKPT GOysylcxC/VF0/iodKdVsdSwxKl10VbKYgjyh95ntez4wUTALdQgndOCTgoo8MX2Wy 7mEHqSeuw59iX+8bFLDK6Meh50irC3QYn5AaPZVbMXs5Ey1+/LWwHQ66snbhCZgLA5 VBzcW08jGuJFn0SjoUXr/T3OMXil63gF9e0K2dNOg7LgLs8ik2OBVww6D/G+Mnn3XC figD78k9CAo2SC4FXRj5LNOotc1bojTHrP5AutXeI2mLokdmkKD2xWyTo5zIpOWylE wCDITlgc9Bp6w== 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 A519A3781182; Thu, 11 Jan 2024 11:57:32 +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 1/7] selftests/mm: hugepage-shm: conform test to TAP format output Date: Thu, 11 Jan 2024 16:56:30 +0500 Message-ID: <20240111115639.3981970-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Stat-Signature: mc3s65nit4o6zrcdkrac5u6etjpnqez3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B2F8D40008 X-Rspam-User: X-HE-Tag: 1704974256-546192 X-HE-Meta: U2FsdGVkX1/ck2HccMW++v0expYNE//xMrmg50pTQVGv56D7jFaNwuA4OFTxP559F20DlW5zzOGZuuYgnYamU3JFvyWwkbI5izntPCXahuAMnZ2XAabyP7acURQKA2gTLLnihvnJhdmLxIia/1Z/meNGFK3f/EL4+2VUMydbo4cdrEuWXwoBgqhIwqlrYzm1FvRjnfe27kmHN/oXQ+ppZwn3Gi7mSRl2FhWvYMjMW0XgDW9dxluGJkqy4PJ7E4BW6nDJ4IhyxAlc4BBV2MOrF/kPuEQ8tawq7R1M/MLzqS46Pt+N4yPHDo6r9m3ruBNxPWAJfeduy34EPKyQnezN0K9FmBSwvQ7GwjWmciKqFlR8kxyIe9ULgJfxZoYn7DRC6Vq4wu30On7ckOZC53Xb59rJ3Q0jDt2qCI12EWJGkyvZLDb4ojDWs06BT9xgTMYaOs9AGcur4+Y2GgGgpww3dPWxVwfGbpIMgmmMjZNu0q4QehcGX7twfJcwdFb6SM0CU2wnfNHeTmUqyYMmRC6lPha/XF+e/2afYPfqnUQGU4dbNGDCjLNvf+hn8LQGIr2Na9jY/aHOgIYg2aNAjfuW+IjoBLnDkGokv9tphjPxa1iGGwXXknJBD4wavN8k5eNHMBYVTUKQiagyaGb4eAhPyPwHUM6nR2BxyLq9WVs1HmmulfX/mjxhnZ/peEubUv2LpKtYBEGug442YnSnUpC1V6ub+GXb3gQbQt3COQJvIDLUgpNFMEUFL56eEgqsU/TpvjerLpWNIJoC/X2hlxeFBMSxDKcqVshlMv3eK9YGr+rlbxvhcXNS2bZtzh8cbgInaKSHby9YR8Bp2Ek42uPSJEJ+95SqiwSV1Pw0FmicnYngH1ofPbnxWrcz0vQSbeWIsqTP/0XDNyteAmiJQYAZ3s6bwvEQEYAlyi4xigs1osABDaXk3LT1pnXP4wSkgtuVIRc/+TcXazFwirC4r6k pyISNvEi sj7zznOybtwVdmWivOgdX7/W79d4TCfOUlAyXVTiIb/3+v5EtNWbxaWlxfTcJuLLdLeyBlstp5ffxO2JoT6RiSfK81TOF2GWfhQ8G5sr2rXF0a0CoYuhtSXhIZVcNClArrf8BorN/7kTSfj2PMG1lIWsYVPCi7qbgH8G20yAq3keYgQ/bLrmV51bfoI0g/UkKUScTRpkMJ3EEwXRWp15nntsV/iPW2ZRS92A7ZbDLX5QHNOsGFQhdpnvkIQ== 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 --- 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 478bb1e989e9..f949dbbc3454 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(); }