Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7398127rwr; Tue, 25 Apr 2023 12:20:28 -0700 (PDT) X-Google-Smtp-Source: AKy350br4HjvcyGzHJUlmpVhplvsnSPKMdGGbi17yzxd4gKMKcG1THzfiatn/lkeDFkiDT/bQgI3 X-Received: by 2002:a05:6a00:2d89:b0:63f:1600:e711 with SMTP id fb9-20020a056a002d8900b0063f1600e711mr22180100pfb.29.1682450428090; Tue, 25 Apr 2023 12:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682450428; cv=none; d=google.com; s=arc-20160816; b=s7HCxLh/W2PHJiWLd9kA4QIH9/fO1yduMNA5Sm3z2kytS41fyS8MEhmw/rX+v4lVI7 QTtUz7Jz+zFPFEDMKP+I4mjkWF3QtfBDMEuLE8/Xlo8uY5Y3bQW85RPi7Gv3X5LUmofk 3mBcabfEAkpezOHwOP0KgD8h+U3AZTF1Bw3x5oEjqYbsaOG6wN2mYuMbT8gy+7W2WR3b q+JkMkq5HtyFAOEOo2AbCcFC9MPtTAwpKhde5ysHocsvxHmDfMhVaRyW1ysiac8ppnpP EPnD5l1YJK8iK7NGoK6kh6HrpZ00jgnZINfL+0tZNcM5q1d0d0mQN0agjnDFlm56/cYf TJHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+el9HnAEkjAwcIZXHJipWv7CnhoGdX3eWtO34Q1+csc=; b=C51g+3nElv42AIcbyKDzswShIHKtNKbOpdbP0FqlY72XuRYWYJZsJhknfRJIQw7IUh UN6QXtqnNlcG2Zg6+2wp81XUVdTFxJNmIor1yIoytHccakw52ivcjD44YeumUol+e7jF cW4zVsT7G6BVX8FiSm9vise5Q0k/+mRYlOM+Au/1KehroUJ1P7v9LkiUsaAKOpHhTki1 4gwfzPZTgBTlOYnDbQ07madqOzSj25KaHedV9G7XjuvNPTz77x4QxP48GnkaGkhyjgIi i9P7JMFnfxcS6xuhJhd3kCCwOXK3sec7KrlfItIhsif/We3nnNznlvAOBnmv+F2pmrXo skBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=wl+vbZqU; 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 bs125-20020a632883000000b0051393805cd1si10738013pgb.461.2023.04.25.12.20.13; Tue, 25 Apr 2023 12:20:28 -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=20221208 header.b=wl+vbZqU; 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 S234572AbjDYTLV (ORCPT + 99 others); Tue, 25 Apr 2023 15:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234513AbjDYTLU (ORCPT ); Tue, 25 Apr 2023 15:11:20 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D87BD83D0 for ; Tue, 25 Apr 2023 12:11:17 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-3ef36d814a5so196781cf.0 for ; Tue, 25 Apr 2023 12:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682449877; x=1685041877; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+el9HnAEkjAwcIZXHJipWv7CnhoGdX3eWtO34Q1+csc=; b=wl+vbZqUf4Yzyu94qIYHS4scGC2UaPSsAE+Cqii5fIizO2OMMc1SWJ43+ZAxE2swGJ EZ1gZf6yYAvLPReAH8Pb5Y3ySeOatOMV5reJCTVgW5KnV/5SbZObLyc0DqR0MHiFg5+W 5jr9+hcp7BzWyw/wQOOhfKI6k8ni81GLy7HYKR8XOI49+39Ss0WhyFdXGVVAVCIP46/l QC5kXL46bjn2Ngu8ulJ7t5D7G5L0Kh2ThOx7N2z0pEP1++SLjPiycvmjSOofZZ9dSx05 /Qp6bK4njzmgztK9/o1nJrLlroHVAspinRKFceiinQJSpWOdWJhMYYpcK4rgZjsTqSe1 /1ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682449877; x=1685041877; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+el9HnAEkjAwcIZXHJipWv7CnhoGdX3eWtO34Q1+csc=; b=RhK0dLyid3GZny1+Ki+yarozZuHNS5h5E1qOoBD1bP1NaSMz9EDI1UWM1li3sOjZcf 5ZbE2JLMaE+AyMVXlwTedXOOWIgX25qahukKCo3mZVWenky3zE/Fc3FAYrFu7tVZ6mCE TZUyCYquv0+0jSLgerbFoT8rkRxx6+QGfdpvqWXIWQeN6lkaY0YxXPJrzGXuOD4YtzRM o+Rva3BLxNkbEAY3v2Fa0lX7r75VPIilEzt3nb8DiFn5cMtnACcI1ewYTZkfc+n0N6O4 rPSekRHFosVwla0pJHW+jGILsaVUxsZf9XelNldiyGqN0xIAUIdRjVqinBd4OvX5GlAC ivcQ== X-Gm-Message-State: AC+VfDx51UBMMJuCtVPBiz/gCF2jL7JWZT7oKWgPHz76IX2F4PhrmJqm vPGvesT0Ayi5Nab2kI0cnAvkZsFl/41ART3mPjdnyboS6AtQy0SVs7Y= X-Received: by 2002:ac8:4e89:0:b0:3de:b0b0:557c with SMTP id 9-20020ac84e89000000b003deb0b0557cmr44534qtp.18.1682449876862; Tue, 25 Apr 2023 12:11:16 -0700 (PDT) MIME-Version: 1.0 References: <20230421040218.2156548-1-davidgow@google.com> <20230421040218.2156548-4-davidgow@google.com> In-Reply-To: <20230421040218.2156548-4-davidgow@google.com> From: Rae Moar Date: Tue, 25 Apr 2023 15:11:04 -0400 Message-ID: Subject: Re: [PATCH v3 4/4] kunit: example: Provide example exit functions To: David Gow Cc: Benjamin Berg , Brendan Higgins , Shuah Khan , Daniel Latypov , maxime@cerno.tech, Stephen Boyd , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Sadiya Kazi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, T_SCC_BODY_TEXT_LINE,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 Fri, Apr 21, 2023 at 12:02=E2=80=AFAM David Gow wr= ote: > > Add an example .exit and .suite_exit function to the KUnit example > suite. Given exit functions are a bit more subtle than init functions > (due to running in a different kthread, and running even after tests or > test init functions fail), providing an easy place to experiment with > them is useful. > > Signed-off-by: David Gow Hi David! I have reviewed this patch and the overall changes to the cleanup structure. It looks good to me (other than that kernel test robot error). Nice to see an example of how to use exit functions in our example test. Thanks! -Rae Reviewed-by: Rae Moar > --- > > This patch was introduced in v3. > > --- > lib/kunit/kunit-example-test.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/lib/kunit/kunit-example-test.c b/lib/kunit/kunit-example-tes= t.c > index cd8b7e51d02b..24315c882b31 100644 > --- a/lib/kunit/kunit-example-test.c > +++ b/lib/kunit/kunit-example-test.c > @@ -41,6 +41,16 @@ static int example_test_init(struct kunit *test) > return 0; > } > > +/* > + * This is run once after each test case, see the comment on > + * example_test_suite for more information. > + */ > +static void example_test_exit(struct kunit *test) > +{ > + kunit_info(test, "cleaning up\n"); > +} > + > + > /* > * This is run once before all test cases in the suite. > * See the comment on example_test_suite for more information. > @@ -52,6 +62,16 @@ static int example_test_init_suite(struct kunit_suite = *suite) > return 0; > } > > +/* > + * This is run once after all test cases in the suite. > + * See the comment on example_test_suite for more information. > + */ > +static void example_test_exit_suite(struct kunit_suite *suite) > +{ > + kunit_info(suite, "exiting suite\n"); > +} > + > + > /* > * This test should always be skipped. > */ > @@ -211,7 +231,9 @@ static struct kunit_case example_test_cases[] =3D { > static struct kunit_suite example_test_suite =3D { > .name =3D "example", > .init =3D example_test_init, > + .exit =3D example_test_exit, > .suite_init =3D example_test_init_suite, > + .suite_exit =3D example_test_exit_suite, > .test_cases =3D example_test_cases, > }; > > -- > 2.40.0.634.g4ca3ef3211-goog >