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] [thread-next>] [day] [month] [year] [list]
Date: Tue,  4 Jun 2024 13:32:01 +0100
From: Ivan Orlov <ivan.orlov0322@...il.com>
To: brendan.higgins@...ux.dev,
	davidgow@...gle.com,
	rmoar@...gle.com
Cc: Ivan Orlov <ivan.orlov0322@...il.com>,
	linux-kselftest@...r.kernel.org,
	kunit-dev@...glegroups.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/5] kunit: kunit-test: Remove stub for log tests

Since now we are exporting string-stream functions into the KUnit
namespace, we can safely use them in kunit-test when it is compiled as
a module as well. So, remove the stubs used when kunit-test is compiled
as a module. Import the KUnit namespace in the test.

Signed-off-by: Ivan Orlov <ivan.orlov0322@...il.com>
---
 lib/kunit/kunit-test.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
index e3412e0ca399..42178d5a97d1 100644
--- a/lib/kunit/kunit-test.c
+++ b/lib/kunit/kunit-test.c
@@ -577,12 +577,6 @@ static struct kunit_suite kunit_resource_test_suite = {
 	.test_cases = kunit_resource_test_cases,
 };
 
-/*
- * Log tests call string_stream functions, which aren't exported. So only
- * build this code if this test is built-in.
- */
-#if IS_BUILTIN(CONFIG_KUNIT_TEST)
-
 /* This avoids a cast warning if kfree() is passed direct to kunit_add_action(). */
 KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
 
@@ -637,17 +631,6 @@ static void kunit_log_newline_test(struct kunit *test)
 		kunit_skip(test, "only useful when debugfs is enabled");
 	}
 }
-#else
-static void kunit_log_test(struct kunit *test)
-{
-	kunit_skip(test, "Log tests only run when built-in");
-}
-
-static void kunit_log_newline_test(struct kunit *test)
-{
-	kunit_skip(test, "Log tests only run when built-in");
-}
-#endif /* IS_BUILTIN(CONFIG_KUNIT_TEST) */
 
 static struct kunit_case kunit_log_test_cases[] = {
 	KUNIT_CASE(kunit_log_test),
@@ -871,4 +854,5 @@ kunit_test_suites(&kunit_try_catch_test_suite, &kunit_resource_test_suite,
 		  &kunit_current_test_suite, &kunit_device_test_suite,
 		  &kunit_fault_test_suite);
 
+MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
 MODULE_LICENSE("GPL v2");
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ