Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2472495iob; Sat, 30 Apr 2022 09:24:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSV2H6gx/h1gHzS/QxKMAD4CgELpSQivveDE1ZgFzQxP1mT57mQj5U1STGhDjkW+3tYLNR X-Received: by 2002:a63:7e4b:0:b0:3a5:6636:5b94 with SMTP id o11-20020a637e4b000000b003a566365b94mr3664329pgn.173.1651335866073; Sat, 30 Apr 2022 09:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651335866; cv=none; d=google.com; s=arc-20160816; b=in9lqCMT0Bjm8YkqJP61lt/2fhJAYJ03fbURBoUt4jh31N/5aJlr5ihEqX5QYyHHTT n+c/IeippULTcwKhjF52ddmjgrluBDTo1GNjBGZ4bHeuENAVf9hF7BWIMzfn+IytkScM aEGNRiz4iA5gO1fo4h2SpEaNuMva/SwcLkQ3fUb/1gToutgz1ZwmivKgEdVr0em1gJ+u PgJ3S7wnuZDIgTAtyuQGxbMVHy2prLsLM6qm8/kH2FsGMW6Veqk6gSwSVC4OQIbilAv7 3UKjPiW5yEkbzHOy7uALGgRXjyX+Bm8cFMQsR6eBX7kVfBIUr7IepWBsKWmnEBWIzIJ7 2FKg== 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=E6xD3tKo0cs/45brcK1pt0MHgdpX3SLfWxjb+dwLYqc=; b=zQiLkMLqIXWN3e7eRqptdPpcQgpYuVVQpzfYTS5EoBCEhcqLqE3IBpzgHUGUHnhxSs xL6oGwuUJbExoBMmk8E2dRl+lp3/ApJY3wH7Ur59uOtxCqkoVJUJMSfhX+p5H7SoG02+ 4w/v30Coa7PybQXT3AfUcoiu/uIWMOtl+u4H9QLt/+or4mhvavW+SL9XWAhfXhrPKI7A jj2jzNqElD20f4FQceLEcvSJOoWcjdRr70ioX24wYvMSiMSp4ZS5sLoGRJLYpdudD4gA Eyetdl6WzmXvvLmqyLOj8l51GklYo6+qfbfAj/urddmA92lI+rlWkeOYs6AmCEHMDWup lbZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SrVSMXAj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a170902b61600b0015a3e8ea4a0si9089331pls.435.2022.04.30.09.24.08; Sat, 30 Apr 2022 09:24:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SrVSMXAj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354353AbiD2GFO (ORCPT + 99 others); Fri, 29 Apr 2022 02:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354319AbiD2GFM (ORCPT ); Fri, 29 Apr 2022 02:05:12 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E35EB82D8 for ; Thu, 28 Apr 2022 23:01:53 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id bi24-20020a05600c3d9800b00393ff664705so4136881wmb.4 for ; Thu, 28 Apr 2022 23:01:53 -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=E6xD3tKo0cs/45brcK1pt0MHgdpX3SLfWxjb+dwLYqc=; b=SrVSMXAjbWU4fRF6a9/P38sO2D/VuaDnchN0A3N16lOms5q9p1zkdesS9mtKmQFRnG O+ER2In+0cc54vFRvPbo4fGjuA/5mPDghv5/ZXFy1I/p9csUd+bnZq8HZSNMV+mG9ETe 7ROh6dglDXbWmgxcQd62DvNurxj7NpUkIQWgOzLgJvdX/20Hm42wN4+LAXYTXd0kOg5Y hunARS0VWl3N6JejsbSnorCZz90k/MF3OQNWcP3K4YgTNbcwE+bk4z04/xDd7emRJBWq uE7QhN/BjfxyiAeVnNi+25fph9ZIr6969CPv+m0qEKGhjbuSaRVnvbD7kMQlm5ZK6bXW 95Cw== 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=E6xD3tKo0cs/45brcK1pt0MHgdpX3SLfWxjb+dwLYqc=; b=SX1rIPrFZ+QJPQqqvLgJ7NsVrgtmAEsVRtcUjpDsMBuW+Y3Pgq6gkO6dIzzEj7yJAo 8zZaXWzl9c3/xpnxpIec0RXZX8m3ZxpS+qNb+Wzee2Vpy2kIV0pwelXvxcxhY89WeliV L7YE/++G/dbVfWBYtetoc2u+l/O4ZqijsjKNcxg8DViVQD/kxSP3rtcojbfnzlr1pSOm fDWFiX4NU9b/l07NvVKBhSumFgGY/gVrKlEwJhvS59GS32Zc9U31634PkzS3lk5l9Gu+ edL+/Wj/N7MM8NhoBB4RlUbnzOWKpZFiIpVbR2T3bOF4i7ulsa2erl8wl8KWounMYQHO xWfA== X-Gm-Message-State: AOAM531Ln7PnDTcZhlaCEnXqo0PrWrprj1yInG2YzuyQHZHgXkep4Phx xAyHQmXYuCWvSbgvjMULNrhcmEbQ4Wvpr5DMkyZJfQ== X-Received: by 2002:a05:600c:2307:b0:38e:bf05:677c with SMTP id 7-20020a05600c230700b0038ebf05677cmr1596951wmo.44.1651212111689; Thu, 28 Apr 2022 23:01:51 -0700 (PDT) MIME-Version: 1.0 References: <20220426181925.3940286-1-dlatypov@google.com> <20220426181925.3940286-2-dlatypov@google.com> In-Reply-To: From: David Gow Date: Fri, 29 Apr 2022 14:01:40 +0800 Message-ID: Subject: Re: [PATCH 2/3] kunit: add ability to specify suite-level init and exit functions To: Daniel Latypov 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 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 this (with the conditional either here or in the caller), I think we should at least rename kunit_suite_has_succeded() to something like kunit_suite_subtests_status(). That being said, I do prefer passing a 'kunit_status' around to an 'int'. > > > > > > > > { > > > + enum kunit_status status = > > > + init_err ? KUNIT_FAILURE : kunit_suite_has_succeeded(suite); > > > +