From patchwork Wed Jan 31 14:05:17 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: 13539495 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 8DC00C47258 for ; Wed, 31 Jan 2024 14:05:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B0A76B009A; Wed, 31 Jan 2024 09:05:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5570D6B009B; Wed, 31 Jan 2024 09:05:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33E2A6B009C; Wed, 31 Jan 2024 09:05:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 11EC66B009A for ; Wed, 31 Jan 2024 09:05:34 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E49A6401F5 for ; Wed, 31 Jan 2024 14:05:33 +0000 (UTC) X-FDA: 81739778946.26.6DD3820 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf03.hostedemail.com (Postfix) with ESMTP id 017722001B for ; Wed, 31 Jan 2024 14:05:31 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=wPNX67SU; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706709932; a=rsa-sha256; cv=none; b=3PusSXygpC/QR6vxCKCOzYZ8wf/h2/mUzJZkwW/Say8NND7v5pF9SYhJ2iItwESlIPY7IL +tNHFkgY7touXx04lExNwbO/0NvFGBZnIbJHD2x2WEGmzN6YVBq7/k//zx3RKlOfCqL2CA qN6c63r4K0on+ZfkyYggJ8ehLqE+RHk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=wPNX67SU; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706709932; 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:in-reply-to:references:references:dkim-signature; bh=Uk8uTo2TIUryKtMLHhHC26r2ctIxy/ilY9lo8z8D1nc=; b=xxQip4ldsu96qDT32tlvW5HVFm9Hbkxy3GnFc9rVmLuPB5YfVhxVRXREeSPxOzs+M5CF79 wTYNlhX6uacjdleIILiII/DQJDu85zUNNvxLyF4wt6kPoCdRyND0FNZBTRSTTMMUURdYuT Ha+ECC3S0aLOjWcyOciuNRybaJ5A2+w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706709930; bh=SKE8pMm9wj80+Eluj9OfOxnVYjWtsY8duRngXOEJh3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPNX67SUgEQLlZYrDr/wsFSlH2sQMpKUAAIRr9G3b8rq+a+FnMRWIbkXpYE0dec8w OCJ6rjTSn3Qv0BcCVx2GiSHbGl9B356zAqlDkgn8hCeAagZEatvImz3P9JFv1f61JV Z4t4VdwkAQanripUhgj7f42vjYCXsjA3u1vMrz9ZAdHn1pvHwvb2h66pIkyqvbfyWM YfM3iLrHOV4U/RXAKUFFsrvlqh8eWd3lpbac8DVkKOKoMaQwY6YnjTpgC3pUBiJ+f0 JDkQeAuzTmshNFYaErn0KJl3L9/o3yDG5Zj9RSmVk9W26bPwnQ/IS6zVVF6KEnfoIw 50B3VnnGMUaUw== 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 2BAE73782084; Wed, 31 Jan 2024 14:05:29 +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 07/12] selftests/mm: mremap_dontunmap: conform test to TAP format output Date: Wed, 31 Jan 2024 19:05:17 +0500 Message-ID: <20240131140528.320252-7-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240131140528.320252-1-usama.anjum@collabora.com> References: <20240131140528.320252-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 017722001B X-Stat-Signature: sco53eop8jru6rgmwnseorsyckq6fwc4 X-HE-Tag: 1706709931-19305 X-HE-Meta: U2FsdGVkX1/2YwgTBamukfF625WfnuRd/lUWUSCCXtiZz43SueXxzQQLZ+ahnL6XWmE83fn+3fJlGt+0XvPceXK5B8u3xBssYDKDNSd7FyvIhWN+041NeLBLNKUwtYsCCfY/lrlMn4jHMJSWxxAGjRxGpj0uHF6VnoAHO7J/lETUdGMu9hbLgqAuY6nQtPRbM80SHazwQRMTxFPQwNmZmq+EVJ6Q8sTBacIZcWUbUzyaxgfm/+5UUetmF1OX/5AmJvHAQc0dGv5xIBB8QlU8d9L++LMBNOkO3GscfQgydQ+hYAC6GClJxkTcjxBbX/J8a5QBl/mWsEQbUGtEcuYZORuUQ33WMLQNokQ3OJwn/mIL6L2B/TiMzgiIomz7YmPtBjONSRxnLZYSxvsdKbFXMmVEk8zXbf48AeUYRMri0bmQF5fcSpDyVu+ZIx4sG3s2ldygrUpDF6ImcATjyiv8Aunc2Kzj02OFnTDkLoGtCnCrORiCf+FJ19qMyiLKkF85YjPg450SpKC+uerAp/zwIE3KsTT7UZuKOSbDN/zbhBa3qrYSx5Bo1MyypzQbIx0K+CEoOzfZ2JcYLPDFoGmkcjNYZseSQshAnUYo0vIGiz2w/s6m89P4YClV5oMlJ5NuJ1PRRp+1g0C5PL/odE6u6mauBB7ryDZl6p8d8SM1C1foJ2dGTvAbutHzZkQtKzpOf3Ys4UZq32Vgwgs7rxhGL+OPFnd9H87jxgwOg3GmsxPco2b31bKRJZ3Im3yBMJsSFrJf0LDTOApIwAp/cj7rdoWz1YVepRsvomq84TVrEsUdxFldWDqgAIGD94cUIvd1flUUzT7CB73080qa2lLFcwpdTBME2h5h0/+rXIPh4t6mbECNIK0DtHaaiVkA4g2iGbvJGtETIbgM+R0ulO1UqDkOWkndYibaibm+IJ0JEU8+CVc87Pw6TXU3U/kzxXaJey31KCJY3FDuwzHcIto ZT7fNmuR DXmrIEAohTxA5ZbUj/ofk5a4AeVYlKdIQsQJ84+/gBRQwAcnZYedZQccMqUIxbPec23bcs09ugAUCXdbfhHmly2CDWbBu7vzuoZ9c1Ghr/4b5ZTJse433zxJ4/KngHGSRDrB7uuH//wyxkBe3YbJ7JdU2rofnrGj72pGmMdan24E4wKXFY8t6fGHrAvaJG90Og1p+mU0riDy5jrfHzjY69+x4DifIxeAOZz8CnpbdYYWMAt2/LC3Z05esIRbKlyMVkn0BKCJGwhndkXJxpjWIaac7t98M/TaJ/63XBGBcUK6qvKg= 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. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/mremap_dontunmap.c | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/mm/mremap_dontunmap.c b/tools/testing/selftests/mm/mremap_dontunmap.c index a06e73ec85682..1d75084b9ca56 100644 --- a/tools/testing/selftests/mm/mremap_dontunmap.c +++ b/tools/testing/selftests/mm/mremap_dontunmap.c @@ -27,14 +27,14 @@ static void dump_maps(void) system(cmd); } -#define BUG_ON(condition, description) \ - do { \ - if (condition) { \ - fprintf(stderr, "[FAIL]\t%s():%d\t%s:%s\n", __func__, \ - __LINE__, (description), strerror(errno)); \ - dump_maps(); \ - exit(1); \ - } \ +#define BUG_ON(condition, description) \ + do { \ + if (condition) { \ + dump_maps(); \ + ksft_exit_fail_msg("[FAIL]\t%s:%d\t%s:%s\n", \ + __func__, __LINE__, (description), \ + strerror(errno)); \ + } \ } while (0) // Try a simple operation for to "test" for kernel support this prevents @@ -122,6 +122,7 @@ static void mremap_dontunmap_simple() "unable to unmap destination mapping"); BUG_ON(munmap(source_mapping, num_pages * page_size) == -1, "unable to unmap source mapping"); + ksft_test_result_pass("%s\n", __func__); } // This test validates that MREMAP_DONTUNMAP on a shared mapping works as expected. @@ -173,6 +174,7 @@ static void mremap_dontunmap_simple_shmem() "unable to unmap destination mapping"); BUG_ON(munmap(source_mapping, num_pages * page_size) == -1, "unable to unmap source mapping"); + ksft_test_result_pass("%s\n", __func__); } // This test validates MREMAP_DONTUNMAP will move page tables to a specific @@ -219,6 +221,7 @@ static void mremap_dontunmap_simple_fixed() "unable to unmap destination mapping"); BUG_ON(munmap(source_mapping, num_pages * page_size) == -1, "unable to unmap source mapping"); + ksft_test_result_pass("%s\n", __func__); } // This test validates that we can MREMAP_DONTUNMAP for a portion of an @@ -269,6 +272,7 @@ static void mremap_dontunmap_partial_mapping() "unable to unmap destination mapping"); BUG_ON(munmap(source_mapping, num_pages * page_size) == -1, "unable to unmap source mapping"); + ksft_test_result_pass("%s\n", __func__); } // This test validates that we can remap over only a portion of a mapping. @@ -328,19 +332,24 @@ static void mremap_dontunmap_partial_mapping_overwrite(void) "unable to unmap destination mapping"); BUG_ON(munmap(source_mapping, 5 * page_size) == -1, "unable to unmap source mapping"); + ksft_test_result_pass("%s\n", __func__); } int main(void) { + ksft_print_header(); + page_size = sysconf(_SC_PAGE_SIZE); // test for kernel support for MREMAP_DONTUNMAP skipping the test if // not. if (kernel_support_for_mremap_dontunmap() != 0) { - printf("No kernel support for MREMAP_DONTUNMAP\n"); - return KSFT_SKIP; + ksft_print_msg("No kernel support for MREMAP_DONTUNMAP\n"); + ksft_finished(); } + ksft_set_plan(5); + // Keep a page sized buffer around for when we need it. page_buffer = mmap(NULL, page_size, PROT_READ | PROT_WRITE, @@ -356,6 +365,5 @@ int main(void) BUG_ON(munmap(page_buffer, page_size) == -1, "unable to unmap page buffer"); - printf("OK\n"); - return 0; + ksft_finished(); }