From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Anthony Liguori" <aliguori@amazon.com>,
"Andreas Färber" <afaerber@suse.de>,
stefanha@redhat.com, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH for-2.3 1/2] qtest: Add qtest_add_data_func() wrapper function
Date: Tue, 24 Mar 2015 23:45:47 +0100 [thread overview]
Message-ID: <1427237148-8728-2-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1427237148-8728-1-git-send-email-afaerber@suse.de>
It calls g_test_add_data_func() with a path supplemented by the
architecture, like qtest_add_func() does.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
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..e3f68d1 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, 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..e363f7f 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, void *data, void (*fn));
+
+/**
* qtest_start:
* @args: other arguments to pass to QEMU
*
--
2.1.4
next prev parent reply other threads:[~2015-03-24 22:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 22:45 [Qemu-devel] [PATCH for-2.3 0/2] qtest: Fix remaining test paths to include architecture Andreas Färber
2015-03-24 22:45 ` Andreas Färber [this message]
2015-03-24 23:04 ` [Qemu-devel] [PATCH for-2.3 1/2] qtest: Add qtest_add_data_func() wrapper function John Snow
2015-03-24 22:45 ` [Qemu-devel] [PATCH for-2.3 2/2] i440fx-test: Fix test paths to include architecture Andreas Färber
2015-03-24 23:09 ` John Snow
2015-03-24 23:20 ` Andreas Färber
2015-03-24 23:28 ` John Snow
2015-03-25 13:04 ` Paolo Bonzini
2015-03-25 15:29 ` [Qemu-devel] [PATCH for-2.3 0/2] qtest: Fix remaining " Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427237148-8728-2-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).