Skip to content

Commit 4b18cb3

Browse files
sulixPeter Zijlstra
authored andcommitted
perf/hw_breakpoint: test: Skip the test if dependencies unmet
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Daniel Latypov <[email protected]> Acked-by: Marco Elver <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 30a0b95 commit 4b18cb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/events/hw_breakpoint_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ static int test_init(struct kunit *test)
295295
{
296296
/* Most test cases want 2 distinct CPUs. */
297297
if (num_online_cpus() < 2)
298-
return -EINVAL;
298+
kunit_skip(test, "not enough cpus");
299299

300300
/* Want the system to not use breakpoints elsewhere. */
301301
if (hw_breakpoint_is_used())
302-
return -EBUSY;
302+
kunit_skip(test, "hw breakpoint already in use");
303303

304304
return 0;
305305
}

0 commit comments

Comments
 (0)