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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7DB0C32750 for ; Tue, 13 Aug 2019 16:48:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC19620844 for ; Tue, 13 Aug 2019 16:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565714904; bh=+ClQXQZYMO3oD0vJh2iCm8rSEOKMIpNSMDMOjbE3t+k=; h=In-Reply-To:References:Subject:From:Cc:To:Date:List-ID:From; b=uXKBO9nNRY0Fe2SgE+8BdlyUEHZrAhszufinbc1t6OVkB71/EtnL+yvz6EIaGkUHC 7jvCn1P8J7gWesn5Ood8pVvE25E3LSIklPjMwTcet6kScvq17FoP5NHYmKSCr0r3KF FkH9NGHH21ObjNKVg5xou12xsHaAFqIvF+dEVP10= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727806AbfHMQsT (ORCPT ); Tue, 13 Aug 2019 12:48:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:35070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbfHMQsT (ORCPT ); Tue, 13 Aug 2019 12:48:19 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06A2D20842; Tue, 13 Aug 2019 16:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565714898; bh=+ClQXQZYMO3oD0vJh2iCm8rSEOKMIpNSMDMOjbE3t+k=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=pjR7+sDpG5QV8mqVLOqQHM+8vC+tRobkv0ngA4hd4MBaO/KrG4XqTeZ1bpn5bn1bq KhfBsT1su6Wd2h61ArrsWNQlNeGWtPTPht9QXac/YRw1heGospZwGZg3FIXZ4HQ+Nu vKsI/4s3VfFW3biZ3Mbn7FIY6xfwnAsdy1fw46EY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190812182421.141150-1-brendanhiggins@google.com> <20190812225520.5A67C206A2@mail.kernel.org> <20190812233336.GA224410@google.com> <20190812235940.100842063F@mail.kernel.org> <20190813045623.F3D9520842@mail.kernel.org> <20190813053023.CC86120651@mail.kernel.org> Subject: Re: [PATCH v12 03/18] kunit: test: add string_stream a std::stream like string builder From: Stephen Boyd Cc: Frank Rowand , Greg KH , Josh Poimboeuf , Kees Cook , Kieran Bingham , Luis Chamberlain , Peter Zijlstra , Rob Herring , shuah , Theodore Ts'o , Masahiro Yamada , devicetree , dri-devel , kunit-dev@googlegroups.com, "open list:DOCUMENTATION" , linux-fsdevel@vger.kernel.org, linux-kbuild , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-nvdimm , linux-um@lists.infradead.org, Sasha Levin , "Bird, Timothy" , Amir Goldstein , Dan Carpenter , Daniel Vetter , Jeff Dike , Joel Stanley , Julia Lawall , Kevin Hilman , Knut Omang , Logan Gunthorpe , Michael Ellerman , Petr Mladek , Randy Dunlap , Richard Weinberger , David Rientjes , Steven Rostedt , wfg@linux.intel.com To: Brendan Higgins User-Agent: alot/0.8.1 Date: Tue, 13 Aug 2019 09:48:17 -0700 Message-Id: <20190813164818.06A2D20842@mail.kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Quoting Brendan Higgins (2019-08-13 02:12:54) > On Tue, Aug 13, 2019 at 2:04 AM Brendan Higgins > wrote: > > > > On Mon, Aug 12, 2019 at 10:30 PM Stephen Boyd wrote: > > > > > > Quoting Brendan Higgins (2019-08-12 22:02:59) > > > > However, now that I added the kunit_resource_destroy, I thought it > > > > might be good to free the string_stream after I use it in each call= to > > > > kunit_assert->format(...) in which case I will be using this logic. > > > > > > > > So I think the right thing to do is to expose string_stream_destroy= so > > > > kunit_do_assert can clean up when it's done, and then demote > > > > string_stream_clear to static. Sound good? > > > > > > Ok, sure. I don't really see how clearing it explicitly when the > > > assertion prints vs. never allocating it to begin with is really any > > > different. Maybe I've missed something though. > > > > It's for the case that we *do* print something out. Once we are doing > > printing, we don't want the fragments anymore. >=20 > Oops, sorry fat fingered: s/doing/done Yes, but when we print something out we've run into some sort of problem and then the test is over. So freeing the memory when it fails vs. when the test is over seems like a minor difference. Or is it also used to print other informational messages while the test is running? I'm not particularly worried here, just trying to see if less code is possible.