From patchwork Wed Jan 31 14:05:22 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: 13539500 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 31D5EC47DB3 for ; Wed, 31 Jan 2024 14:05:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A92B46B00A2; Wed, 31 Jan 2024 09:05:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F4906B00A3; Wed, 31 Jan 2024 09:05:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 893346B00A4; Wed, 31 Jan 2024 09:05:46 -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 6BBE96B00A2 for ; Wed, 31 Jan 2024 09:05:46 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4509980D20 for ; Wed, 31 Jan 2024 14:05:46 +0000 (UTC) X-FDA: 81739779492.19.609582C Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf22.hostedemail.com (Postfix) with ESMTP id 587B2C002C for ; Wed, 31 Jan 2024 14:05:44 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=NDduIphe; spf=pass (imf22.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=1706709944; 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=asUANzFqAgLjH6ZwJV82sNijZ4nVe9PH98JXMjUtul4=; b=qKbTeL0b6IHix+4RjhtyHT0Lpah8x7HYbLuJ5nhs5ig3ddS117DlVazEOWqbc959schkLx DkMbhAANQVqo++J6r0J55aFTKRIrgvT/3JGppzqTPwiFYydM6riOpjX6uL5o8bBNP9g0z0 VXj8l3x/iK935P9fBLiKf5tQZRcHVVI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706709944; a=rsa-sha256; cv=none; b=KohIXqD3badqF+P6g1kh3vyK6JWHLz9oxr8b/OCSzmmxQBigTQ0I2F7SAql2yNJlyYCy3h vXMdje6SSY0+K7tLMkWh69eLi/W2HuVzscGFw+Iv0OZBROJK6kYVdONG5qEPd1NPyQ3kca eAuvHXs7pJ2oq4pu6sEl0Qt607/SgpM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=NDduIphe; spf=pass (imf22.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=1706709943; bh=2kIkJOhTpv8Q3QiyGfqRKh0McTWdwjht00wQfRsByJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDduIphetMOQtuiPrCjAjVqGhbHMOGChazuerTGytlmJkwljYhUqUgJ4eh2KwUdvL G6QGhqSC6PGhjZRmbzH2RZSat5WaEUBEzUg9bnuze8UHIkUiEdK+7mgLpbWx9Ko+fS qJSmj+0YAqeQwSiesltDdilDr4ZkJ144vQ6jtdn6y1j7pQmKZ1esdyq7U/C9J9dmYT Cp3KbS7/TIlhEVUEv0MhVQ9ojxFJgnnxIjguuYQKKA9SiuhWYOtmfU26SoNc9Zn5cp suHOo24MGltQVnhmARjiYnIg6b6tjm4Uk2B6M2mjNQUJ+JDWVLeZOxnK7XNP4VKk1j Qcs9zRB8H7bzQ== 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 A7DA4378200E; Wed, 31 Jan 2024 14:05: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 12/12] selftests/mm: virtual_address_range: conform to TAP format output Date: Wed, 31 Jan 2024 19:05:22 +0500 Message-ID: <20240131140528.320252-12-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-Rspamd-Queue-Id: 587B2C002C X-Rspam-User: X-Stat-Signature: 6qrnz1knz8rt9wguxati5kpgk74rm4mh X-Rspamd-Server: rspam03 X-HE-Tag: 1706709944-248599 X-HE-Meta: U2FsdGVkX19Gtv+qLthn3EObN8y1hrNzWduWmzSvSioGxOpvgMJl0QSv0cB8tDsN0VbwpJqdRDwQZRhC9i+L8rgLQ5K5pmNI9DJbLoULXX4k/2iuPXFE4x8w+OEXKLC1XBczlYQflIEh379hNrMI+OhGzBnBmhV4esI8QRZ66SYmQ+6WWX+R0qi1DZVFdRCMYjritQtQnM5TckL6FheYyMhzSgQVJAVOTDJ8+g22Ez0ekerT8FZJNwU25gkqR1vSYAYXUThRsEwRf2Co4KsKjjRE+cMsv1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.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 --- .../selftests/mm/virtual_address_range.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index bae0ceaf95b13..7bcf8d48256a6 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -12,6 +12,7 @@ #include #include #include +#include "../kselftest.h" /* * Maximum address range mapped with a single mmap() @@ -68,23 +69,15 @@ static char *hind_addr(void) return (char *) (1UL << bits); } -static int validate_addr(char *ptr, int high_addr) +static void validate_addr(char *ptr, int high_addr) { unsigned long addr = (unsigned long) ptr; - if (high_addr) { - if (addr < HIGH_ADDR_MARK) { - printf("Bad address %lx\n", addr); - return 1; - } - return 0; - } + if (high_addr && addr < HIGH_ADDR_MARK) + ksft_exit_fail_msg("Bad address %lx\n", addr); - if (addr > HIGH_ADDR_MARK) { - printf("Bad address %lx\n", addr); - return 1; - } - return 0; + if (addr > HIGH_ADDR_MARK) + ksft_exit_fail_msg("Bad address %lx\n", addr); } static int validate_lower_address_hint(void) @@ -107,23 +100,29 @@ int main(int argc, char *argv[]) char *hint; unsigned long i, lchunks, hchunks; + ksft_print_header(); + ksft_set_plan(1); + for (i = 0; i < NR_CHUNKS_LOW; i++) { ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr[i] == MAP_FAILED) { - if (validate_lower_address_hint()) - return 1; + if (validate_lower_address_hint()) { + ksft_test_result_skip("Memory constraint not fulfilled\n"); + ksft_finished(); + } break; } - if (validate_addr(ptr[i], 0)) - return 1; + validate_addr(ptr[i], 0); } lchunks = i; hptr = (char **) calloc(NR_CHUNKS_HIGH, sizeof(char *)); - if (hptr == NULL) - return 1; + if (hptr == NULL) { + ksft_test_result_skip("Memory constraint not fulfilled\n"); + ksft_finished(); + } for (i = 0; i < NR_CHUNKS_HIGH; i++) { hint = hind_addr(); @@ -133,8 +132,7 @@ int main(int argc, char *argv[]) if (hptr[i] == MAP_FAILED) break; - if (validate_addr(hptr[i], 1)) - return 1; + validate_addr(hptr[i], 1); } hchunks = i; @@ -145,5 +143,7 @@ int main(int argc, char *argv[]) munmap(hptr[i], MAP_CHUNK_SIZE); free(hptr); - return 0; + + ksft_test_result_pass("Test\n"); + ksft_finished(); }