lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+GJov4+-u3fnqDWCgsp8EjGkm2efbqtaqMFq+_0pWpTnfkurw@mail.gmail.com>
Date:   Tue, 25 Apr 2023 15:11:04 -0400
From:   Rae Moar <rmoar@...gle.com>
To:     David Gow <davidgow@...gle.com>
Cc:     Benjamin Berg <benjamin@...solutions.net>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Daniel Latypov <dlatypov@...gle.com>, maxime@...no.tech,
        Stephen Boyd <sboyd@...nel.org>, kunit-dev@...glegroups.com,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        Sadiya Kazi <sadiyakazi@...gle.com>
Subject: Re: [PATCH v3 4/4] kunit: example: Provide example exit functions

On Fri, Apr 21, 2023 at 12:02 AM David Gow <davidgow@...gle.com> wrote:
>
> 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 <davidgow@...gle.com>

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 <rmoar@...gle.com>

> ---
>
> 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-test.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[] = {
>  static struct kunit_suite example_test_suite = {
>         .name = "example",
>         .init = example_test_init,
> +       .exit = example_test_exit,
>         .suite_init = example_test_init_suite,
> +       .suite_exit = example_test_exit_suite,
>         .test_cases = example_test_cases,
>  };
>
> --
> 2.40.0.634.g4ca3ef3211-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ