From patchwork Sun Aug 14 05:53:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12942849 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 EEBDBC25B06 for ; Sun, 14 Aug 2022 05:54:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CD2C8E000A; Sun, 14 Aug 2022 01:54:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DEC18E0001; Sun, 14 Aug 2022 01:54:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60B348E000A; Sun, 14 Aug 2022 01:54:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 52C988E0001 for ; Sun, 14 Aug 2022 01:54:21 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 37721AB29C for ; Sun, 14 Aug 2022 05:54:21 +0000 (UTC) X-FDA: 79797133122.24.CD529AB Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) by imf05.hostedemail.com (Postfix) with ESMTP id DDDE7100197 for ; Sun, 14 Aug 2022 05:54:20 +0000 (UTC) Received: by mail-il1-f196.google.com with SMTP id o14so2494414ilt.2 for ; Sat, 13 Aug 2022 22:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=SnDhYdrAcbvGcTO2vU9jv0bvWt3Yk1v2Rp41yYuWQ5Y=; b=jyJHJXdGgxnJHliMAK+EYrp/qvH6ThciPn+bCSwsOKziwkLyYX6MPGlVUCubMP5P+B NMtPAWl/7nwg8cUg8r65aQI8ncSmX7SyCprI3nRYU3kMd9Tjn4p9tQm6yA9z9nuUWVRR PxOqj7+jJ4gADUE6RYNu/tNkBl1TRNlgnyZ2B5BD67koCOumu4Sz9RSZ9CA81l9mxXdF DlUdLdP52LMVa0G5fWRZChr6PIYHdKelTe/PywwwtkTPJpJZp/xGG3Sl+O1fOUhoh607 AClxX3snucMIc2jFqOEs9np8SalmREVGy4dQuVDKMDygLniWlBpWyWc8grFyeqZs6P23 SwNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=SnDhYdrAcbvGcTO2vU9jv0bvWt3Yk1v2Rp41yYuWQ5Y=; b=FoE+sPUVFmRG4N0YPFBVG69VwnmBNYsSFoV+DNnF4SX09We2g9NZSFTpyTup2swYhy xYl0Lu6vC6Iru+nTqebFJjXYKOmjm8pg2CzVy1azu8OzpHXiO+hNGEdwAQwOmJBBIcmG vOfEWR7XN/w7CyXOsiMQWnAgBkTsUgQBNrMpLfWeAkWl90ZVlTRhkQEUEYaWdLyw7PJ5 MzFLf3hEAUcO0d91HJDAelYBzu15Q+wWuf+62p2mLp4s3xXCKROeghxEQnagJzSbB+vC YrC94ApB1UqD0jyObz+ISIzFo7FQ2FNPrRk2AFLCWFsHqwvFwr9Fy4EV1qA9ht77qbHF l60Q== X-Gm-Message-State: ACgBeo16XrVh+F+giiHUnnOgp9Df1zWuOlJ193qcKJHXIkPoz3WKTL7a o0m/0fnIYH4hHhr0pg+hV7c= X-Google-Smtp-Source: AA6agR5A4fVnZwWVC2PDMrTvzD+FcOYVwxg8Kew9QoZsCBpzm3YWd171CU+xXOYjPP670UvnabnUhw== X-Received: by 2002:a92:c246:0:b0:2de:b25b:e75 with SMTP id k6-20020a92c246000000b002deb25b0e75mr4859257ilo.246.1660456460564; Sat, 13 Aug 2022 22:54:20 -0700 (PDT) Received: from sophie (static-198-54-128-70.cust.tzulo.com. [198.54.128.70]) by smtp.gmail.com with ESMTPSA id d13-20020a92d5cd000000b002dd143ee62esm2648816ilq.14.2022.08.13.22.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 22:54:20 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH 7/8] memblock tests: add tests for memblock_*bottom_up functions Date: Sun, 14 Aug 2022 00:53:59 -0500 Message-Id: <69524966ac92d93b45a8a8e739434d5fb31e3084.1660454730.git.remckee0@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660456460; a=rsa-sha256; cv=none; b=ZoFFPcAcf0GN2t4Zyqq3j3zqN9as5rzO6gUzqI49aKNEosU/bAX+op/0OJFX21WJrc2uLh 3AUXEUWx/cwstZlvTX1+MKJT9EuMf6s0zm3VNijT6wHsyXZ/Q9kDvpkZpzUDMJagL8Lyxu ssPqXjIdsAJRzRg6Xodf1WS3bwaxJG4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jyJHJXdG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of remckee0@gmail.com designates 209.85.166.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660456460; 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=SnDhYdrAcbvGcTO2vU9jv0bvWt3Yk1v2Rp41yYuWQ5Y=; b=FxxWj+rjthEvqjSHw2oIUtzjzeBEW6/N7Xb2qUSXreINdEQyfH6R9/uwechftrVq6r9vCI oWeORTXHq/MJmdijS8z78f4PPNvdUBx1PXKcI+jDhKSUj0riUZleDLlO/ijqHSMBhWLzUm TB07U44kL3jQEAdTbvvVL7kFQ3C+W8c= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: DDDE7100197 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jyJHJXdG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of remckee0@gmail.com designates 209.85.166.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-Stat-Signature: 3wft63npyo491m7njop7bwb98as6hmth X-HE-Tag: 1660456460-850703 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000142, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add simple tests for memblock_set_bottom_up() and memblock_bottom_up(). Reviewed-by: David Hildenbrand Signed-off-by: Rebecca Mckeever Reviewed-by: Shaoqin Huang --- tools/testing/memblock/tests/basic_api.c | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index ef5642d0863b..d7f008e7a12a 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -1679,6 +1679,50 @@ static int memblock_free_checks(void) return 0; } +static int memblock_set_bottom_up_check(void) +{ + prefix_push("memblock_set_bottom_up"); + + memblock_set_bottom_up(false); + ASSERT_EQ(memblock.bottom_up, false); + memblock_set_bottom_up(true); + ASSERT_EQ(memblock.bottom_up, true); + + reset_memblock_attributes(); + test_pass_pop(); + + return 0; +} + +static int memblock_bottom_up_check(void) +{ + prefix_push("memblock_bottom_up"); + + memblock_set_bottom_up(false); + ASSERT_EQ(memblock_bottom_up(), memblock.bottom_up); + ASSERT_EQ(memblock_bottom_up(), false); + memblock_set_bottom_up(true); + ASSERT_EQ(memblock_bottom_up(), memblock.bottom_up); + ASSERT_EQ(memblock_bottom_up(), true); + + reset_memblock_attributes(); + test_pass_pop(); + + return 0; +} + +static int memblock_bottom_up_checks(void) +{ + test_print("Running memblock_*bottom_up tests...\n"); + + prefix_reset(); + memblock_set_bottom_up_check(); + prefix_reset(); + memblock_bottom_up_check(); + + return 0; +} + int memblock_basic_checks(void) { memblock_initialization_check(); @@ -1686,6 +1730,7 @@ int memblock_basic_checks(void) memblock_reserve_checks(); memblock_remove_checks(); memblock_free_checks(); + memblock_bottom_up_checks(); return 0; }