From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yapun-0004U8-9r for qemu-devel@nongnu.org; Wed, 25 Mar 2015 14:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yapuj-0003Xh-JK for qemu-devel@nongnu.org; Wed, 25 Mar 2015 14:20:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41931 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yapuj-0003XE-Cs for qemu-devel@nongnu.org; Wed, 25 Mar 2015 14:20:25 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 25 Mar 2015 19:20:20 +0100 Message-Id: <1427307623-2425-2-git-send-email-afaerber@suse.de> In-Reply-To: <1427307623-2425-1-git-send-email-afaerber@suse.de> References: <1427307623-2425-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-2.3 v2 1/4] qtest: Add qtest_add_data_func() wrapper function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, jsnow@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , stefanha@redhat.com, Anthony Liguori It calls g_test_add_data_func() with a path supplemented by the architecture, like qtest_add_func() does. Reviewed-by: John Snow Reviewed-by: Stefan Hajnoczi Signed-off-by: Andreas F=C3=A4rber --- tests/libqtest.c | 7 +++++++ tests/libqtest.h | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/libqtest.c b/tests/libqtest.c index 9a92aa7..12d65bd 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -652,6 +652,13 @@ void qtest_add_func(const char *str, void (*fn)) g_free(path); } =20 +void qtest_add_data_func(const char *str, const void *data, void (*fn)) +{ + gchar *path =3D 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 =3D data; diff --git a/tests/libqtest.h b/tests/libqtest.h index e7413d5..9281f5c 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -345,6 +345,18 @@ const char *qtest_get_arch(void); void qtest_add_func(const char *str, void (*fn)); =20 /** + * 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 * --=20 2.1.4