[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNMLuep71fz2P=9ZrYSaD_GwE6XDf69+auf=2G7FYqu4sw@mail.gmail.com>
Date: Wed, 26 Oct 2022 09:21:22 -0700
From: Marco Elver <elver@...gle.com>
To: David Gow <davidgow@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
kunit-dev@...glegroups.com,
Brendan Higgins <brendanhiggins@...gle.com>,
Daniel Latypov <dlatypov@...gle.com>,
kasan-dev@...glegroups.com
Subject: Re: [PATCH] perf/hw_breakpoint: test: Skip the test if dependencies unmet
On Wed, 26 Oct 2022 at 07:10, David Gow <davidgow@...gle.com> wrote:
>
> Running the test currently fails on non-SMP systems, despite being
> enabled by default. This means that running the test with:
>
> ./tools/testing/kunit/kunit.py run --arch x86_64 hw_breakpoint
>
> results in every hw_breakpoint test failing with:
>
> # test_one_cpu: failed to initialize: -22
> not ok 1 - test_one_cpu
>
> Instead, use kunit_skip(), which will mark the test as skipped, and give
> a more comprehensible message:
>
> ok 1 - test_one_cpu # SKIP not enough cpus
>
> This makes it more obvious that the test is not suited to the test
> environment, and so wasn't run, rather than having run and failed.
>
> Signed-off-by: David Gow <davidgow@...gle.com>
Acked-by: Marco Elver <elver@...gle.com>
Although I still get confused by the fact that skipped tests say "ok"
and then need to double check the log that tests weren't skipped.
> ---
> kernel/events/hw_breakpoint_test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/events/hw_breakpoint_test.c b/kernel/events/hw_breakpoint_test.c
> index 5ced822df788..c57610f52bb4 100644
> --- a/kernel/events/hw_breakpoint_test.c
> +++ b/kernel/events/hw_breakpoint_test.c
> @@ -295,11 +295,11 @@ static int test_init(struct kunit *test)
> {
> /* Most test cases want 2 distinct CPUs. */
> if (num_online_cpus() < 2)
> - return -EINVAL;
> + kunit_skip(test, "not enough cpus");
>
> /* Want the system to not use breakpoints elsewhere. */
> if (hw_breakpoint_is_used())
> - return -EBUSY;
> + kunit_skip(test, "hw breakpoint already in use");
>
> return 0;
> }
> --
> 2.38.0.135.g90850a2211-goog
>
Powered by blists - more mailing lists