Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp178844iob; Mon, 2 May 2022 16:24:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuXp3LqD8C3g+snR0vWM57iAvcIfyrpz3UK+/Bh0TuSZLEMvfCiZWPmPbcqNKqtwnc8IZq X-Received: by 2002:a63:1c0d:0:b0:3ab:1a76:953f with SMTP id c13-20020a631c0d000000b003ab1a76953fmr11500970pgc.73.1651533842415; Mon, 02 May 2022 16:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651533842; cv=none; d=google.com; s=arc-20160816; b=gI2AcbFGBLnp4IwSybwd2SgE1zImUavbxDS3s3JuXSh1sJC/yifKgDtQoude+R1qvT lsOAO/9aOcKkjM/oOliaUIXZLtHpcldCsYNXRz1bkHJ6WCO1vQEfsGHZabuWMNHONw+/ CktHb+G3oJxQov1TzhobGiy1RRmzpousJX4P0MutrlW3gKf7as+ujFSfNGA2hgTh9ag5 ZZRIoP7ffVLdS36yPodzrUatr+Yl5cD6OBiHJ7yzc7CxbPyLtJaKt35Rmq7+tfuqk5d3 st6NGFSyc1cvRA3Eg6EFwfpZ/o9Hk1xJkKpOe1GBujGSv/UWjUC8gigj+yc47ElHCetl h3Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ohaQRt+I1XeCpnE3EiyqpTvMxPt5XexVM3H7FwMAdFU=; b=HXJSXwxonIfU6W7aXr/r8eJXQA4sFIGF50Ov2SxCU/5HHIuXsdWwAmp5pZNUIJPyJn pQxkwa8EhqFckvNJp3PqgImdfcPul50ugH/ZyGlNeykVOrfH0z9QsLJVek0vI73xbcqJ 2VE0DtdIdPMpK+vIYFZHup9eCuc2DYwEc8ZumymFWZ+2USy4NcuWCJW+vo9nj6LP+/V7 ih+tG45ZDiHcX9gWrJvRlJr+5tWCsHraCatFDg23BvOYYMCP0B60XNYBjsFKNZ3NxbO+ mf97RHitJq3PGm7lYs2rJF/iMjb1HAo9BYQ/QS5Vz1Cfv4ONyeu44p071tg+DfABnD3n MImw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tJz5t1Ic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c9-20020a170902724900b00158e8967916si14649300pll.219.2022.05.02.16.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:24:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tJz5t1Ic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E23C2C10C; Mon, 2 May 2022 16:23:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379605AbiD2STx (ORCPT + 99 others); Fri, 29 Apr 2022 14:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354648AbiD2STw (ORCPT ); Fri, 29 Apr 2022 14:19:52 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CABF83019 for ; Fri, 29 Apr 2022 11:16:33 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id a21so9974997edb.1 for ; Fri, 29 Apr 2022 11:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ohaQRt+I1XeCpnE3EiyqpTvMxPt5XexVM3H7FwMAdFU=; b=tJz5t1IcyaN8zpMztE+5rV8GEb1T2YPxEdNhP6bbaY4sVNLePDXwwQ+evAOZ/JInBp RtGfNgX3L9L2j2Gy4F8LwqcW6Nb3EzQ9MaG/EJqSl+mRQM+8WVhtEU4XfkkO//Uaj67Q nnkJlcxlGyCwPGyEH2Cj27cysYQSto8jOxaKqIkyWEvuRLQSYXLKBqvHgJJDpZA9pmDw 7laMzclRTSviwaeZgbxxcqzj84LK1SiIJGJLftbIM78IhA7anCmnOfb9+EHlLvNaVpxr 3IsaGCKIzNOjUfZms74qXgqk6ojmBLFqkr8TJcXN+U58d49VqQvSKI+Uo0aSULhC2zXG j3lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ohaQRt+I1XeCpnE3EiyqpTvMxPt5XexVM3H7FwMAdFU=; b=31+V5dDieVceVPLEo0FX2lXXcfsNn3Gq+I7opd5w3SlQr3GTidNtUrekyWtUMmk/zV nug5vZvjR4QIGHNZHLnxXIYQTOXWgMlDucwqwL7Xy3fhyF+OoCjSonJbgG71ny1BcbiH gU1kXFpKZyh+hsNCYjSxns9PmhbNoqMSmnzAXMnWYZWdE/Ls8DxnHO8poamJaICp51ve o6iENinl4BirxjTNRVF/FhdKBkNbPZpePDsSWUuoieBrSD13dF6+r2hj9aCJlbUScFg4 p7qfQ9z+bfPxAVYZ2GZVXN24RQvIGi1B8Er3Mjr1cxCBWbHj6RXoccV0L3gdCZZSGT7q ni3Q== X-Gm-Message-State: AOAM5323EkTPKHm9G6Au7CsYSggGrlfJ/C+OS938+6xalCLJbCViJy41 2NdHEazX7mD4hjCWn2Y1xH+ZhQcQP/5ZmuHkQMGvUg== X-Received: by 2002:a05:6402:3492:b0:426:19be:bf36 with SMTP id v18-20020a056402349200b0042619bebf36mr549149edc.36.1651256191598; Fri, 29 Apr 2022 11:16:31 -0700 (PDT) MIME-Version: 1.0 References: <20220426181925.3940286-1-dlatypov@google.com> <20220426181925.3940286-2-dlatypov@google.com> In-Reply-To: From: Daniel Latypov Date: Fri, 29 Apr 2022 13:16:20 -0500 Message-ID: Subject: Re: [PATCH 2/3] kunit: add ability to specify suite-level init and exit functions To: David Gow Cc: Brendan Higgins , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 29, 2022 at 1:01 AM David Gow wrote: > > On Wed, Apr 27, 2022 at 11:06 AM Daniel Latypov wrote: > > > > On Tue, Apr 26, 2022 at 8:56 PM David Gow wrote: > > > > > > > > static size_t kunit_suite_counter = 1; > > > > > > > > -static void kunit_print_suite_end(struct kunit_suite *suite) > > > > +static void kunit_print_suite_end(struct kunit_suite *suite, int init_err) > > > > > > A part of me feels that it'd be nicer to have the init_err be part of > > > struct kunit_suite, and have kunit_suite_has_succeeded() take it into > > > account. It could go either way, though -- WDYT? > > > > Yeah, passing it around as a parameter felt a bit icky. > > But I think adding it in as a field feels worse. > > Personally, I don't have a problem with having it as a field (other > than the memory usage, which shouldn't be so much as to cause > problems). It seems that the suite result is logically part of the > suite, and given that status_comment is in struct kunit_suite and > there's a kunit_status field in kunit_case, having it as a field in > the suite seems the most logically consistent thing to do. > > > > > Another thought: perhaps have this function take a `kunit_status` > > parameter instead? > > Moving the ?: expression below out into the caller isn't that bad, imo. > > It still doesn't solve the fact that kunit_suite_has_succeeded() no > longer tells you if a suite has succeeded or not. If we stick with I forgot kunit_suite_has_succeeded() is called in the debugfs code. So it looks like we need to track the init error in struct kunit_suite, as you said. It might be cleaner to just store a status in the suite eventually, but I'll just add the int for now. Sending a v2 series here: https://lore.kernel.org/linux-kselftest/20220429181259.622060-1-dlatypov@google.com I also added on a new patch to fix the type confusion in the debugfs code (using bool instead of enum kunit_status).