From patchwork Fri Feb 2 11:31:14 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: 13542774 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 571FBC47DB3 for ; Fri, 2 Feb 2024 11:31:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB9F46B0095; Fri, 2 Feb 2024 06:31:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3CD06B0096; Fri, 2 Feb 2024 06:31:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859FF6B0098; Fri, 2 Feb 2024 06:31:46 -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 65C9F6B0095 for ; Fri, 2 Feb 2024 06:31:46 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 42399A1D96 for ; Fri, 2 Feb 2024 11:31:46 +0000 (UTC) X-FDA: 81746649012.03.E252257 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf29.hostedemail.com (Postfix) with ESMTP id 88E42120035 for ; Fri, 2 Feb 2024 11:31:44 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=XDgeClVE; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf29.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=1706873504; 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=Du4lXxOk489s1uOUhdz2+BlXwLk0cqyyOQ2NSh6N/Nheo5LXJteFys/oLOSOutcs1VVpua ZeqjUmWrkkm0ITvVpjNe/PLgNuBC+U7Vqrr1WfP7SIxCV/yEVMW0JqglURc+jXg5NaYlhA poNfYWFnGCWyXhib2AHHyHf6UdZYJ3Q= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=XDgeClVE; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf29.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=1706873504; a=rsa-sha256; cv=none; b=56GqErvxWFBkFfKMPZ6OIzYnZcjN1PUpMznBfNKNeYbHs/anaSPdZoWPgai9qjtBjMVMDA oRN3vnjUagOGLIJhzgZsgHwjuerPn36pXs5lqS39Hv4Jrr0Z77vMVO2TyYd6eGFmuKd3Q1 JECLGjEhZgJrgKudA17BNzSSQoccIlo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706873503; bh=SKE8pMm9wj80+Eluj9OfOxnVYjWtsY8duRngXOEJh3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XDgeClVEVe8aFmyX6ZG0LNsjD6DIm4Co1wCBY44huyVlp8Z8IOoz7PHJG94tXpyrs ojEFVkVSg2Z8We2lMlYANwczm7K4D3D775Qorey38Xdd+i7LGcJK11xpFsC2CuL/PH 3Uw7HERuRZ2Y0g5cC+w1iLRE0oYbmwyIgOBgcAGzLioPyO1uJzIqt/YnDo//B2jtWK lpBVV6iwTGzmZHilpC4eAxIzqyoBqT6E2uO9C3TKGwW7tFZgQOq4anua7SZYU5La0R WDhcXlAhtK34YdgQC9+ORwoCgn4XbfPJcGyGwX8jZwKVdpuMUTa2VHRlIAflCIuNFw p1E4k/bv/R07Q== 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 A4D383782098; Fri, 2 Feb 2024 11:31:41 +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 v2 07/12] selftests/mm: mremap_dontunmap: conform test to TAP format output Date: Fri, 2 Feb 2024 16:31:14 +0500 Message-ID: <20240202113119.2047740-8-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202113119.2047740-1-usama.anjum@collabora.com> References: <20240202113119.2047740-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 88E42120035 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ngywtgt6yhwuyp96ajfq986nzqdzahkr X-HE-Tag: 1706873504-376410 X-HE-Meta: U2FsdGVkX18xWMKCMEL0/R0CYXJasP+/MElfikihwoOaJfOqP8gFh7KU96/ip/7YpLWbcVn5+7oOI83jUCS9Mcqa2y/ScmMYHE9wg34Lt/B9jt9uzDDCG/AkoQ/S/B/XwC/IKJdZbiJHgCvGxfhQUnz5Le1wRYEOHkGOpiTdlze48HRwrXqgjxQahifkbwhjRcrv1ZHFUR2Nyr8xje/XQQuNFjTl9+S+7wAV7yxDSGVlBRsT/JPZhk/ITeGXzr0Tw3cbmqL7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ux-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(); }