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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <166742778877.6127.16460958693964479938.tip-bot2@tip-bot2>
Date:   Wed, 02 Nov 2022 22:23:08 -0000
From:   "tip-bot2 for David Gow" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     David Gow <davidgow@...gle.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Daniel Latypov <dlatypov@...gle.com>,
        Marco Elver <elver@...gle.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: perf/urgent] perf/hw_breakpoint: test: Skip the test if
 dependencies unmet

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     4b18cb3f74dcfc183c2434e17bfce09ce6302e37
Gitweb:        https://git.kernel.org/tip/4b18cb3f74dcfc183c2434e17bfce09ce6302e37
Author:        David Gow <davidgow@...gle.com>
AuthorDate:    Wed, 26 Oct 2022 22:10:40 +08:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 02 Nov 2022 12:22:05 +01:00

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 <davidgow@...gle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Daniel Latypov <dlatypov@...gle.com>
Acked-by: Marco Elver <elver@...gle.com>
Link: https://lore.kernel.org/r/20221026141040.1609203-1-davidgow@google.com
---
 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 5ced822..c57610f 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;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ