From mboxrd@z Thu Jan 1 00:00:00 1970 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 75CB3C43334 for ; Thu, 23 Jun 2022 04:56:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0E678E0124; Thu, 23 Jun 2022 00:56:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBF4F8E0115; Thu, 23 Jun 2022 00:56:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C85E18E0124; Thu, 23 Jun 2022 00:56:32 -0400 (EDT) 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 B54C48E0115 for ; Thu, 23 Jun 2022 00:56:32 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7DF043568C for ; Thu, 23 Jun 2022 04:56:32 +0000 (UTC) X-FDA: 79608289824.09.5FCBBBE Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf28.hostedemail.com (Postfix) with ESMTP id 29FA3C0017 for ; Thu, 23 Jun 2022 04:56:32 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id s20-20020a056830439400b0060c3e43b548so14631348otv.7 for ; Wed, 22 Jun 2022 21:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WnUFtf8gRIUJdZWQiDSTROqEf9Dm/04GkQLOBBLX/W0=; b=mLYN2k91EY0HnDmHRuowvOPijbgBSlF6oVnCCJj43YLFy8P5v4fqlqXeVp5D6qRBc9 PC0jjbFcy+MbotqA2QxWAen7+H3DQ8phYvzAqYy/wlRN3w2OBBSPebR7WmIVGebw4Stl CjAqsCctdyY7iZZORXh3dTPoCfkb+fclrI4BrgHFFE95klYMfKjP0dAzUj5FGFqKAxvq UtV/vKD3KLQIPz5taNidhpLbm4Coizf3O0rxJeWFjYyceePFa1g6Nh4Ogt8Zwyl1SGTG ih4362BjjEFFVznZOeRbr7WWw8lrKVL2wvis+w+Ki9zCjS0dmhb5LfK5oVPIyVbdSHT7 JdXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WnUFtf8gRIUJdZWQiDSTROqEf9Dm/04GkQLOBBLX/W0=; b=puSx5uaT1iNiZVmLSBfGHFSaWhez00OA8AKqDDzoO2B4fr4yC9bnitFqINo46TQj4o eBAW0Su+7nsWsxGeMBflnFhzAOeo/CF6HPnieksE7ouPgYKJQjOTdIk5jSyPL8S+TMa9 XSmxIptvqNK7QIWdnQNzTW1mDRxUOBidTpTLCrlTGRbmBfgMqlnXKIvSJV+npGOBO0zr hIPK7kUr9tnJdu5M+nQglclrGvlNmnfSRes/VDED0zu2JpNVeRMMuWBJkd3WrcM048SP 9EyeOicdD9uXvFrdHMOiwckGzogtiSYc9Hzso7NizFM4qVgmrVT3s2RHMkx3EE7Xn3e6 J0JA== X-Gm-Message-State: AJIora+j/T8zrAxDxdT2LRjYGThwdFGK++b84Xv4+sG+1+5STi/GpTPB M/DkB3la3FIFPdo3ytgBwpo= X-Google-Smtp-Source: AGRyM1tGSijN8TRH9ApBIewTplW5vaQsotF8T0mCpLteedkyaH0qAWygxVEjTmNs5jYvZ0xeXFw0yg== X-Received: by 2002:a9d:6b13:0:b0:60c:16aa:9ddc with SMTP id g19-20020a9d6b13000000b0060c16aa9ddcmr3062891otp.114.1655960191428; Wed, 22 Jun 2022 21:56:31 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id r204-20020acaf3d5000000b0032e3ffc5513sm12283028oih.4.2022.06.22.21.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 21:56:31 -0700 (PDT) Date: Wed, 22 Jun 2022 23:56:30 -0500 From: Rebecca Mckeever To: Mike Rapoport Cc: "Huang, Shaoqin" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH v3 2/4] memblock tests: add verbose output to memblock tests Message-ID: References: <004e021cc3cb7be8749361b3b1cb324459b9cb9f.1655889641.git.remckee0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655960192; a=rsa-sha256; cv=none; b=ihTGxQfpSnkvoyx6oKFBQMjmiH7EimiwSL3pzLRSLxHtIYEP8fX9z1BsGBqgbzqOl2P92e yuigZ0XYOdxlj1xO6H5p5VmkC5Z8/sOK2/Ja47Jec744kAMAQL2y389D6nI6YQxH0Wec6n 0yWMxYIRWqvDXACmy4qTzvLp+fkiBSk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mLYN2k91; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of remckee0@gmail.com designates 209.85.210.65 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=1655960192; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WnUFtf8gRIUJdZWQiDSTROqEf9Dm/04GkQLOBBLX/W0=; b=cC1cxexSTHTlkebQ4ycKgZk7IME0oqrNlKL0rGIZLNQL6pTzpCTr0Bm82E4U0aMnOHN9BJ 8FMRVn+4GUbGNQuaO/5yjOawl0oAeyGMInTi1Q3Ri5q1Pnpz/DYH/JUo0gmkIefgKl+XzP HtIkBOfLqdAyhfSZ1zrStlRaQ10go6c= X-Rspamd-Queue-Id: 29FA3C0017 X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mLYN2k91; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of remckee0@gmail.com designates 209.85.210.65 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspamd-Server: rspam03 X-Stat-Signature: p6xupxcqciexdfhorertkeccgmt9wc16 X-HE-Tag: 1655960192-139701 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 22, 2022 at 11:05:27PM -0500, Mike Rapoport wrote: > On Thu, Jun 23, 2022 at 09:29:05AM +0800, Huang, Shaoqin wrote: > > > > > > On 6/23/2022 8:45 AM, Rebecca Mckeever wrote: > > > On Wed, Jun 22, 2022 at 06:32:04PM +0800, Huang, Shaoqin wrote: > > > > Just test it and everything works fine. And I think there are some thing can > > > > improve: > > > > > > > > The prefix_push() and prefix_pop() are used in so many functions and > > > > almost of them just put the prefix_push(__func__) begin in the head and the > > > > prefix_pop() in the end. > > > > May be you can define some macro that when you output something and > > > > automatically push the __func__ as prefix. And when leave the function, > > > > automatically pop it. And only in some special place, you call it manually. > > > > > > > Thank you for your review. I'm not sure how you would automatically push > > > __func__ since you have to be inside the function to access that > > > variable. Let me know if you have any suggestions. I am thinking about > > > adding another function in common.c that just calls test_pass() followed > > > by prefix_pop() since those are called together so often. > > > > Just like: > > #define test_pass_macro() \ > > do { \ > > prefix_push(__func__); \ > > test_pass(); \ > > prefix_pop(); \ > > } while (0) > > This will not print the name of the failing test, e.g. instead of > > not ok 28 : memblock_alloc: alloc_bottom_up_disjoint_check: failed > > with Rebecca's implementation it'll print > > not ok 28 : memblock_alloc: failed > Oh yeah, prefix_push() needs to be called before the asserts. > How about > > #define PREFIX_PUSH() prefix_push(__func__)? > Good idea. What about #define TEST_PASS() do { \ test_pass(); \ prefix_pop(); \ } while (0) ? Or would it be better to make a function? > > This macro will automatically push the __fun__ as prefix when you call > > test_pass_macro(). And then pop it after test_pass() output. > > > > And use this macro() to hidden most of the paired prefix_* functions. > > > > And I think that's the simplist way. May be someone has a better solution. > > > > -- > Sincerely yours, > Mike. Thanks, Rebecca