提交 7949c0e3 编写于 作者: A Andreas Färber

qtest: Add qtest_add_data_func() wrapper function

It calls g_test_add_data_func() with a path supplemented by the
architecture, like qtest_add_func() does.
Reviewed-by: NJohn Snow <jsnow@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 53850b88
......@@ -652,6 +652,13 @@ void qtest_add_func(const char *str, void (*fn))
g_free(path);
}
void qtest_add_data_func(const char *str, const void *data, void (*fn))
{
gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
g_test_add_data_func(path, data, fn);
g_free(path);
}
void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size)
{
const uint8_t *ptr = data;
......
......@@ -344,6 +344,18 @@ const char *qtest_get_arch(void);
*/
void qtest_add_func(const char *str, void (*fn));
/**
* qtest_add_data_func:
* @str: Test case path.
* @data: Test case data
* @fn: Test case function
*
* 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().
*/
void qtest_add_data_func(const char *str, const void *data, void (*fn));
/**
* qtest_start:
* @args: other arguments to pass to QEMU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册