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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 89B37C433FF for ; Tue, 13 Aug 2019 09:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C4C020679 for ; Tue, 13 Aug 2019 09:13:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W2oxF32q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbfHMJNK (ORCPT ); Tue, 13 Aug 2019 05:13:10 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:36758 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbfHMJNJ (ORCPT ); Tue, 13 Aug 2019 05:13:09 -0400 Received: by mail-lf1-f66.google.com with SMTP id j17so22236309lfp.3 for ; Tue, 13 Aug 2019 02:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b9ILhd2aCjQh4oMSFsJoowCjN4C8D/s8MJgq4YAEBLc=; b=W2oxF32qcEgwvRN+TzYXAddY5GIfE0TU07ZZEMjsnTdZHws8iAZ2t8Ultvl9YT7B9l FcqQcsJALGn/N6C5ZuExhftHA8ZS8MNOrSUeIrQu3gBXXLe4ixyR8Oo5hmg4UUGyabxo uWv09COtEGpqAdax3WCg5P2ubO3WE1ftRGYMB38Ed3fgj3xpruF/YDRjA5s4U1SsywTz raOTZO3u1j8iOcpslIka2xJ8bkvq+QSToLsxoCLDTz8ppRJhCuL8ltvK/wB/IXN51+OA Tmzcrff2zT5F1o2XfVqbtXnT9QaUbGOA7cZQ4WzLX6NEXNn++uTMldyauztGbKy/kIWW PdfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b9ILhd2aCjQh4oMSFsJoowCjN4C8D/s8MJgq4YAEBLc=; b=EqItSK90klpsJL7AQFG6JvCPXj5jb1ECtmsufN6oNhEbOHj6V6A71t8gNFHIp7/i6Y w4kc4IBtw9/Wfw4LRLTbAfuSSAms89IYcCuqy2qtBBGpg9muSpPY09oc51fiCEvy0zgO Ol4vTlazawuc4Hh14jm/JIr03/IPnYHCSzZ5aWdV9R6MImxRg3X/Z+wmInhKnLOXR76p unzUBSM+m//F/mPte82iLhZASj21gnHDHDIqTxACQZEdFZ4kHtObP4rypRQwhuUuaNSg dgBAUyZMZ9Pj1ooAUzFGpRTly8gJdVoopxNHdsq+GEEwpMQszGxSFHp+/FoZTAVJfbmA r/yg== X-Gm-Message-State: APjAAAWNglIL1CiljjlK0Pd8MRhG2SqEoJQh9bZXzsRqOFYN1Muf5NqF H9qaZV/zjjbwAjIwnjN458ujXucPbA01Pg3qeJB/VA== X-Google-Smtp-Source: APXvYqwLnkbduPeN9fnl3i+lRRTsMYZatTj1IuJmhpqxnMiio1q0JfaKumMLZmtQt11+bQEG/iQwBN5AGKfhGyCW+Rs= X-Received: by 2002:ac2:5dd6:: with SMTP id x22mr21614482lfq.92.1565687586809; Tue, 13 Aug 2019 02:13:06 -0700 (PDT) MIME-Version: 1.0 References: <20190812182421.141150-1-brendanhiggins@google.com> <20190812182421.141150-4-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> In-Reply-To: From: Brendan Higgins Date: Tue, 13 Aug 2019 02:12:54 -0700 Message-ID: Subject: Re: [PATCH v12 03/18] kunit: test: add string_stream a std::stream like string builder To: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) > > > On Mon, Aug 12, 2019 at 9:56 PM Stephen Boyd wrote: > > > > > > > > Quoting Brendan Higgins (2019-08-12 17:41:05) > > > > > On Mon, Aug 12, 2019 at 4:59 PM Stephen Boyd wrote: > > > > > > > > > > > > > kunit_resource_destroy (respective equivalents to devm_kfree, and > > > > > > > devres_destroy) and use kunit_kfree here? > > > > > > > > > > > > > > > > > > > Yes, or drop the API entirely? Does anything need this functionality? > > > > > > > > > > Drop the kunit_resource API? I would strongly prefer not to. > > > > > > > > No. I mean this API, string_stream_clear(). Does anything use it? > > > > > > Oh, right. No. > > > > > > 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. Oops, sorry fat fingered: s/doing/done