summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2021-02-12 01:45:23 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2021-02-15 11:53:43 -0800
commitb77251f08d3c1acc28f1f453da5e3971d50e0bc2 (patch)
treec01e90de22f545a56486fd7ab3646bcd3734cd2e
parentd3a1fe67b64cad103ff4f93dfd9f2cf19cab09ba (diff)
downloadkmod-b77251f08d3c1acc28f1f453da5e3971d50e0bc2.tar.gz
kmod-b77251f08d3c1acc28f1f453da5e3971d50e0bc2.tar.bz2
kmod-b77251f08d3c1acc28f1f453da5e3971d50e0bc2.zip
testsuite: allow to re-use single function for tests
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.
-rw-r--r--testsuite/testsuite.h6
1 files 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"))); \