Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp383236rdb; Sun, 14 Jan 2024 23:33:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNHjrMBSnLRR5sSnvAYPJ10rhnh0DBWz/zWuInbWLpDqYml8xiMVY6OzWz4l8xaJFG80qc X-Received: by 2002:a05:6512:b95:b0:50e:7b04:7bc9 with SMTP id b21-20020a0565120b9500b0050e7b047bc9mr3129198lfv.23.1705303996417; Sun, 14 Jan 2024 23:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705303996; cv=none; d=google.com; s=arc-20160816; b=ROIP36oHzk6ppNnBCrOqEI7Yer9FvW8DhtzXox3XgSKStyOEiH8ECnJMRfEZwvaQFQ Rca9CYbJa1BLOUMZa97ZSbow4yRWDo+ZLLD6xUyIk3XBuraSwZ1NAvLSxsBcb0cpWvpt Oh9whsgD2HuUMaLtJRu5OCbt5IfOvx88cSfYsoZ2nx3aKIBqh3npdI1g5892CTu9cDj4 BUuqQkdhOMlnlE+SVLkG/pAT8VvpXW/ij9Ur1eLwyPhxfqHUOsz8eFrYqHAJaMfe6W4Z 5g9ZSMwFMJPSauIvRxS6GDS7Q1UgqkvNfvEG9g5DoSP9G+FGZsPjrcswbA1j5s1McnjK N8iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=KEdkNivyIg3PurhJ3VjHntzXTr+Tal6Xval7en+bt2s=; fh=mVBrUHkdhr4FdAuGFuDLONjpBFXQ76Q1/p1ghTG2QxI=; b=j3HTd4vRofMGgULskUwk277y8KdXuRKFsCT0ShRjqxZHrChPJICw5wk+Kf0nAsZjUZ pHsJie/Tu40B1mtZbs3Zu9dQYj83g5qBrWGSqpCLWRa3sBGw8oOZ8WgAfz4+of8r1edl Yrbs4FYcArstYEeqKM39nGnkW8pwUytbDQ8q25JCD3XYx+62FzZkHYqKZPjal2nY6Hen 0eNhm9o8Tb4roMm8XB/SOqwJVhSYo2aZo6WuZdbiCMQM/ABDHF8PIuIQn9b7zIYCX+ni 2XQk+t/yJKjrknUaCcvGwhqwckZs779pYeVCkwrWC9D6lWe8ospN3QNptKbWL1Bclf1Y vqDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GXO9YEPS; spf=pass (google.com: domain of linux-kernel+bounces-25686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lv5-20020a170906bc8500b00a2d57d891f2si1355691ejb.416.2024.01.14.23.33.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 23:33:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GXO9YEPS; spf=pass (google.com: domain of linux-kernel+bounces-25686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2955B1F217DF for ; Mon, 15 Jan 2024 07:33:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9314440D; Mon, 15 Jan 2024 07:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="GXO9YEPS" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 9541663AA; Mon, 15 Jan 2024 07:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1705303984; bh=rRQZLwAtR4o/VCOAcxTzVSxdZ70bLgI9faWJJSJCsAc=; h=From:To:Cc:Subject:Date:From; b=GXO9YEPS9ah8KzQBBmYq2zTQ8EXx61CYFKebrzMonKYCXxDbjWZTjw7hHmB00Irk4 qG4tgLvhIH/RZlwBB/Us60q5DJWpt+EgCDQiD6mj3stX0zVEiIBZPXAXOkz1OebYVi SWvpwFyk+zxxpuufBiddr/mgfEpmFBKEhnhpB5H+LjpQm9rGth+Nqnlsem98XSw+84 edi3gQdsTxJwMcFw71BUCVdkhtPOunql0K3TLyAnOmek8pRNGhSqpvSMW9b6zyC0YA sHvs+MzaU9+NKaVOM/0ZAwvcaaygPhcB24md/WrHWhslctzLv4F51+qv6Iiq8Efqrr 8jtdxvayhgIIA== 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 DFFA737813DD; Mon, 15 Jan 2024 07:33:02 +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 v3 1/7] selftests/mm: hugepage-shm: conform test to TAP format output Date: Mon, 15 Jan 2024 12:32:37 +0500 Message-ID: <20240115073247.1280266-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(); } -- 2.42.0