aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2015-03-25 16:52:45 +0100
committerAndreas Färber <afaerber@suse.de>2015-03-30 19:20:44 +0200
commit45b0f830dd1817277eeb97032ce64b3103fe0b6c (patch)
tree22ab1cc12f4afe5a97b86bba3d71fcf57b5a5e47
parent7949c0e39f7638a85515a1dcbd8bc96d13fca6de (diff)
qtest: Add qtest_add() wrapper macro
It extends g_test_add() macro with the architecture path. Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--tests/libqtest.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 9281f5c134..03469b8781 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -357,6 +357,26 @@ void qtest_add_func(const char *str, void (*fn));
void qtest_add_data_func(const char *str, const void *data, void (*fn));
/**
+ * qtest_add:
+ * @testpath: Test case path
+ * @Fixture: Fixture type
+ * @tdata: Test case data
+ * @fsetup: Test case setup function
+ * @ftest: Test case function
+ * @fteardown: Test case teardown function
+ *
+ * Add a GTester testcase with the given name, data and functions.
+ * The path is prefixed with the architecture under test, as
+ * returned by qtest_get_arch().
+ */
+#define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
+ do { \
+ char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
+ g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
+ g_free(path); \
+ } while (0)
+
+/**
* qtest_start:
* @args: other arguments to pass to QEMU
*