All of lore.kernel.org
 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 1/5] kunit: string-stream: export non-static functions
Date: Tue, 18 Jun 2024 18:03:27 +0100	[thread overview]
Message-ID: <20240618170331.264851-2-ivan.orlov0322@gmail.com> (raw)
In-Reply-To: <20240618170331.264851-1-ivan.orlov0322@gmail.com>

Export non-static functions from the string-stream.c file into the KUnit
namespace in order to be able to access them from the KUnit core tests
(when they are loaded as modules).

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

 lib/kunit/string-stream.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/kunit/string-stream.c b/lib/kunit/string-stream.c
index 54f4fdcbfac8..a5e3339854da 100644
--- a/lib/kunit/string-stream.c
+++ b/lib/kunit/string-stream.c
@@ -10,7 +10,7 @@
 #include <kunit/test.h>
 #include <linux/list.h>
 #include <linux/slab.h>
-
+#include <kunit/visibility.h>
 #include "string-stream.h"
 
 
@@ -86,6 +86,7 @@ int string_stream_vadd(struct string_stream *stream,
 
 	return 0;
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_vadd);
 
 int string_stream_add(struct string_stream *stream, const char *fmt, ...)
 {
@@ -98,6 +99,7 @@ int string_stream_add(struct string_stream *stream, const char *fmt, ...)
 
 	return result;
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_add);
 
 void string_stream_clear(struct string_stream *stream)
 {
@@ -113,6 +115,7 @@ void string_stream_clear(struct string_stream *stream)
 	stream->length = 0;
 	spin_unlock(&stream->lock);
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_clear);
 
 char *string_stream_get_string(struct string_stream *stream)
 {
@@ -131,6 +134,7 @@ char *string_stream_get_string(struct string_stream *stream)
 
 	return buf;
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_get_string);
 
 int string_stream_append(struct string_stream *stream,
 			 struct string_stream *other)
@@ -148,11 +152,13 @@ int string_stream_append(struct string_stream *stream,
 
 	return ret;
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_append);
 
 bool string_stream_is_empty(struct string_stream *stream)
 {
 	return list_empty(&stream->fragments);
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_is_empty);
 
 struct string_stream *alloc_string_stream(gfp_t gfp)
 {
@@ -168,6 +174,7 @@ struct string_stream *alloc_string_stream(gfp_t gfp)
 
 	return stream;
 }
+EXPORT_SYMBOL_IF_KUNIT(alloc_string_stream);
 
 void string_stream_destroy(struct string_stream *stream)
 {
@@ -179,6 +186,7 @@ void string_stream_destroy(struct string_stream *stream)
 	string_stream_clear(stream);
 	kfree(stream);
 }
+EXPORT_SYMBOL_IF_KUNIT(string_stream_destroy);
 
 static void resource_free_string_stream(void *p)
 {
@@ -200,8 +208,10 @@ struct string_stream *kunit_alloc_string_stream(struct kunit *test, gfp_t gfp)
 
 	return stream;
 }
+EXPORT_SYMBOL_IF_KUNIT(kunit_alloc_string_stream);
 
 void kunit_free_string_stream(struct kunit *test, struct string_stream *stream)
 {
 	kunit_release_action(test, resource_free_string_stream, (void *)stream);
 }
+EXPORT_SYMBOL_IF_KUNIT(kunit_free_string_stream);
-- 
2.34.1


  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 ` Ivan Orlov [this message]
2024-06-21 21:00   ` [PATCH v2 1/5] kunit: string-stream: export non-static functions Rae Moar
2024-06-18 17:03 ` [PATCH v2 2/5] kunit: kunit-test: Remove stub for log tests Ivan Orlov
2024-06-21 21:03   ` 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-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.