From patchwork Mon Mar 30 17:42:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 456267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9AD711400A0 for ; Tue, 31 Mar 2015 04:43:40 +1100 (AEDT) Received: from localhost ([::1]:35395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycdis-0007Vn-My for incoming@patchwork.ozlabs.org; Mon, 30 Mar 2015 13:43:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcdiA-0006Ba-E1 for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:42:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ycdi1-0007xP-Np for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:42:54 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45009 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycdi1-0007wj-DR for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:42:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3E39DADB9 for ; Mon, 30 Mar 2015 17:42:43 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 30 Mar 2015 19:42:40 +0200 Message-Id: <1427737362-5588-3-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427737362-5588-1-git-send-email-afaerber@suse.de> References: <1427737362-5588-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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ärber --- 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); } +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; 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)); /** + * 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 *