linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: brendan.higgins@linux.dev, davidgow@google.com, rmoar@google.com
Cc: Ivan Orlov <ivan.orlov0322@gmail.com>,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, skhan@linuxfoundation.org
Subject: [PATCH v2 2/5] kunit: kunit-test: Remove stub for log tests
Date: Tue, 18 Jun 2024 18:03:28 +0100	[thread overview]
Message-ID: <20240618170331.264851-3-ivan.orlov0322@gmail.com> (raw)
In-Reply-To: <20240618170331.264851-1-ivan.orlov0322@gmail.com>

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.

Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
---
V1 -> V2:
- No changes

 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 37e02be1e710..d86f7cb3b3e4 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),
@@ -872,4 +855,5 @@ kunit_test_suites(&kunit_try_catch_test_suite, &kunit_resource_test_suite,
 		  &kunit_fault_test_suite);
 
 MODULE_DESCRIPTION("KUnit test for core test infrastructure");
+MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
 MODULE_LICENSE("GPL v2");
-- 
2.34.1


  parent reply	other threads:[~2024-06-18 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 17:03 [PATCH v2 0/5] Reorganize string-stream and assert tests Ivan Orlov
2024-06-18 17:03 ` [PATCH v2 1/5] kunit: string-stream: export non-static functions Ivan Orlov
2024-06-21 21:00   ` Rae Moar
2024-06-18 17:03 ` Ivan Orlov [this message]
2024-06-21 21:03   ` [PATCH v2 2/5] kunit: kunit-test: Remove stub for log tests Rae Moar
2024-06-18 17:03 ` [PATCH v2 3/5] kunit: string-stream-test: Make it a separate module Ivan Orlov
2024-06-19 18:09   ` Jeff Johnson
2024-06-27 20:49     ` Ivan Orlov
2024-06-21 21:07   ` Rae Moar
2024-06-27 20:51     ` Ivan Orlov
2024-06-18 17:03 ` [PATCH v2 4/5] kunit: assert_test: Prepare to be merged into kunit-test.c Ivan Orlov
2024-06-21 21:19   ` Rae Moar
2024-06-18 17:03 ` [PATCH v2 5/5] kunit: Merge assertion test " Ivan Orlov
2024-06-21 21:38   ` Rae Moar
2024-06-27 20:46     ` Ivan Orlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618170331.264851-3-ivan.orlov0322@gmail.com \
    --to=ivan.orlov0322@gmail.com \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).