aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-19 15:42:01 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2016-09-08 18:05:22 +0400
commit822e36ca358c20406c34b7cb585d1ce2456027d5 (patch)
treea1a07139315e61116844b230b41dda0652fa15df /tests/libqtest.h
parentf73480c36f49562556b80bb5bf8acc45e20dcca1 (diff)
tests: add qtest_add_data_func_full
Allows one to specify a destroy function for the test data. Add a fallback using glib g_test_add_vtable() internal function, whose signature changed over time. Tested with glib 2.22, 2.26 and 2.48, which according to git log should be enough to cover all variations. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/libqtest.h')
-rw-r--r--tests/libqtest.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 37f37adbf7..d2b48535a6 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -426,6 +426,23 @@ void qtest_add_data_func(const char *str, const void *data,
void (*fn)(const void *));
/**
+ * qtest_add_data_func_full:
+ * @str: Test case path.
+ * @data: Test case data
+ * @fn: Test case function
+ * @data_free_func: GDestroyNotify for data
+ *
+ * Add a GTester testcase with the given name, data and function.
+ * The path is prefixed with the architecture under test, as
+ * returned by qtest_get_arch().
+ *
+ * @data is passed to @data_free_func() on test completion.
+ */
+void qtest_add_data_func_full(const char *str, void *data,
+ void (*fn)(const void *),
+ GDestroyNotify data_free_func);
+
+/**
* qtest_add:
* @testpath: Test case path
* @Fixture: Fixture type