]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qtest: Add qtest_add() wrapper macro
authorAndreas Färber <afaerber@suse.de>
Wed, 25 Mar 2015 15:52:45 +0000 (16:52 +0100)
committerAndreas Färber <afaerber@suse.de>
Mon, 30 Mar 2015 17:20:44 +0000 (19:20 +0200)
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>
tests/libqtest.h

index 9281f5c1349cd5d556878b89ac2199759fc1dc92..03469b87817e76e1df87cce3ea5f4ddb5ab4607e 100644 (file)
@@ -356,6 +356,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