linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: linux-modules@vger.kernel.org
Cc: Jiri Slaby <jirislaby@kernel.org>, Jessica Yu <jeyu@kernel.org>,
	Giovanni Gherdovich <ggherdovich@suse.cz>
Subject: [PATCH 3/4] testsuite: allow to re-use single function for tests
Date: Fri, 12 Feb 2021 01:45:23 -0800	[thread overview]
Message-ID: <20210212094524.170861-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20210212094524.170861-1-lucas.demarchi@intel.com>

Add a new DEFINE_TEST_WITH_FUNC() that accepts the function
alongside the test name. This will allow us to share a single function
for different tests.
---
 testsuite/testsuite.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index c74b648..44d1730 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -140,14 +140,16 @@ int test_run(const struct test *t);
 
 
 /* Test definitions */
-#define DEFINE_TEST(_name, ...) \
+#define DEFINE_TEST_WITH_FUNC(_name, _func, ...) \
 	static const struct test UNIQ(s##_name) \
 	__attribute__((used, section("kmod_tests"), aligned(8))) = { \
 		.name = #_name, \
-		.func = _name, \
+		.func = _func, \
 		## __VA_ARGS__ \
 	};
 
+#define DEFINE_TEST(_name, ...) DEFINE_TEST_WITH_FUNC(_name, _name, __VA_ARGS__)
+
 #define TESTSUITE_MAIN() \
 	extern struct test __start_kmod_tests[] __attribute__((weak, visibility("hidden")));	\
 	extern struct test __stop_kmod_tests[] __attribute__((weak, visibility("hidden")));	\
-- 
2.30.0


  parent reply	other threads:[~2021-02-12  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12  9:45 [PATCH 1/4] libkmod-config: revamp kcmdline parsing into a state machine Lucas De Marchi
2021-02-12  9:45 ` [PATCH 2/4] libkmod-config: re-quote option from kernel cmdline Lucas De Marchi
2021-02-15 15:28   ` Jessica Yu
2021-02-15 20:18     ` Lucas De Marchi
2021-02-12  9:45 ` Lucas De Marchi [this message]
2021-02-12  9:45 ` [PATCH 4/4] test-modprobe: share single function for kcmdline tests Lucas De Marchi

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=20210212094524.170861-3-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=ggherdovich@suse.cz \
    --cc=jeyu@kernel.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-modules@vger.kernel.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).