Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5409771pxv; Wed, 21 Jul 2021 04:57:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzm4RcZX68pcuDpuhwQGmcvDZQSbl+R72Lr7KT1yIWnYWckaO1VaU5mr42kkioqzTeC7LLh X-Received: by 2002:a17:906:a18b:: with SMTP id s11mr38759030ejy.8.1626868621562; Wed, 21 Jul 2021 04:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626868621; cv=none; d=google.com; s=arc-20160816; b=TqIPQ6LzmovncWnevpYdFDoVRTpwihNnQnQcCV7df6dhR1Caxf6ppbGXB09kGKR8b/ Ryq9JGIEP/ChBbgiQWuLv5VBEwDOIblOedbFn4kILOf03SDdIKG2IbpI97fMMZEgl+Mc +QqBUvRG/ZF+AB42zmLtgQueXwr78F/JL3cowSypuXCBJPn/8EIkeYSS0h3G+CDaHq9G F7WTU0lWXJFrVuG8ufZUxjHlv3d01KNmNBdNJrK6qwlgMtriir7gs9EDTv+zf5kGlKcX vbtfD19FBfwsnQ+9BUmPBpoZe9EzsXjokhVTbSYG0wBOEhqZ8W80S7SCANJhd3btoeoQ ybJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/yVNqBmxnuBC05FSkP/+akzCnOnL62YyG3CGZpkvMBI=; b=qMHD+l0YNq1FKBmo4Q323EK/AcxdRRXUI4F4Wm3qzAe7ba+t4CsUi6qx6sz6WoGSRP gviiAoEpR7S6XVjm/vYkOF84lKOfhEf07/cB7+YFi/EO2PfOh1OfIsPRmLFsrcHCw5ej jIhirWH7LqLj2QZ8m0/C7Fi9NoUB9wkdQzNZbKZgNuPS8cezGXzrDpwK4KjTIqYTtyvG LjXAkzgvZdr/mN+6SfHoFmbAerLpAXEsiGlQiuJsdfJjwAjAlNaAZrM1QPltrrJRIOsp NNYI1kG8gFm39B6yWCuVG951HhHEV1CWZtA8gx7L86O749VTgA8o+UdR8JDN4WVjhLAo v9zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OVO7/0xB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k26si20389620eds.397.2021.07.21.04.56.38; Wed, 21 Jul 2021 04:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OVO7/0xB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238626AbhGULO1 (ORCPT + 99 others); Wed, 21 Jul 2021 07:14:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:50548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238785AbhGULAG (ORCPT ); Wed, 21 Jul 2021 07:00:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B0AF61001; Wed, 21 Jul 2021 11:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626867639; bh=+i4sQ0y2P0tlzbuuPjWOutDrZUTehFe9PgKvtCPlu98=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OVO7/0xBDgfW/YMs98tYB94z/iMm8bVEEivg7gl105cTWUmdyQOAGtVHD3emJW90a 7ePzo0mlSzQX/Bk1GX4Xc3ppqLkJZCa8L7+rdAOtj5Wa4/VO7GV2lWGqN1olEdQDDB Fw+TS1CyR8EyitevuKdPuR3lYxniTgnYqoj8h77k= Date: Wed, 21 Jul 2021 13:40:36 +0200 From: Greg Kroah-Hartman To: Yury Norov Cc: Andy Shevchenko , Andy Shevchenko , Barry Song , Andrew Morton , Linux Kernel Mailing List , Dave Hansen , Rasmus Villemoes , "Rafael J. Wysocki" , Randy Dunlap , Alexander Gordeev , Stefano Brivio , "Ma, Jianpeng" , Valentin Schneider , "Peter Zijlstra (Intel)" , Daniel Bristot de Oliveira , Guodong Xu , tangchengchang@huawei.com, "Zengtao (B)" , yangyicong , tim.c.chen@linux.intel.com, Linuxarm Subject: Re: [PATCH v7 4/4] lib: test_bitmap: add bitmap_print_to_buf test cases Message-ID: References: <20210715115856.11304-1-song.bao.hua@hisilicon.com> <20210715115856.11304-5-song.bao.hua@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 04:23:32PM -0700, Yury Norov wrote: > On Fri, Jul 16, 2021 at 12:32:45AM +0300, Andy Shevchenko wrote: > > On Thu, Jul 15, 2021 at 11:48 PM Yury Norov wrote: > > > On Thu, Jul 15, 2021 at 03:09:39PM +0300, Andy Shevchenko wrote: > > > > On Thu, Jul 15, 2021 at 11:58:56PM +1200, Barry Song wrote: > > > > > The added test items cover both cases where bitmap buf of the printed > > > > > result is greater than and less than 4KB. > > > > > And it also covers the case where offset for bitmap_print_to_buf is > > > > > non-zero which will happen when printed buf is larger than one page > > > > > in sysfs bin_attribute. > > > > > > > > More test cases is always a good thing, thanks! > > > > > > Generally yes. But in this case... I believe, Barry didn't write that > > > huge line below by himself. Most probably he copy-pasted the output of > > > his bitmap_print_buf() into the test. If so, this code tests nothing, > > > and just enforces current behavior of snprintf. > > > > I'm not sure I got what you are telling me. The big line is to test > > strings that are bigger than 4k. > > I'm trying to say that human are not able to verify correctness of > this line. The test is supposed to check bitmap_print_to_buf(), but > reference output itself is generated by bitmap_print_to_buf(). This > test will always pass by design, even if there's an error somewhere > in the middle, isn't it? Then please manually check it to verify it is correct or not. Once we have it verified, that's fine, it will remain static in this test for always going forward. That's what "oracles" are for, there is nothing wrong with this test case or "proof" that I can see. > > > > ... > > > > > > > +static const char large_list[] __initconst = /* more than 4KB */ > > > > > + "0,4,8,12,16,20,24,28,32-33,36-37,40-41,44-45,48-49,52-53,56-57,60-61,64,68,72,76,80,84,88,92,96-97,100-101,104-1" > > > > > + "05,108-109,112-113,116-117,120-121,124-125,128,132,136,140,144,148,152,156,160-161,164-165,168-169,172-173,176-1" > > > > > + "77,180-181,184-185,188-189,192,196,200,204,208,212,216,220,224-225,228-229,232-233,236-237,240-241,244-245,248-2" > > > > > > I don't like this behavior of the code: each individual line is not a > > > valid bitmap_list. I would prefer to split original bitmap and print > > > list representation of parts in a compatible format; considering a > > > receiving part of this splitting machinery. > > > > I agree that split is not the best here, but after all it's only 1 > > line and this is on purpose. > > What I see is that bitmap_print_to_buf() is called many times, That is not what the above list shows at all, it's one long string all together, only split up to make it easier for us to work with. > and > each time it returns something that is not a valid bitmap list string. > If the caller was be able to concatenate all the lines returned by > bitmap_print_to_buf(), he'd probably get correct result. But in such > case, why don't he use scnprintf("pbl") directly? I do not understand the objection here at all. This series is fixing a real problem that people are having and your complaining about test strings is _VERY_ odd. If you have an alternate solution, please propose it, otherwise I will be taking this series in the next few days. thanks, greg k-h