qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.3 1/2] qtest: Add qtest_add_data_func() wr


From: John Snow
Subject: Re: [Qemu-devel] [PATCH for-2.3 1/2] qtest: Add qtest_add_data_func() wrapper function
Date: Tue, 24 Mar 2015 19:04:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0



On 03/24/2015 06:45 PM, Andreas Färber wrote:
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 <address@hidden>
---
  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
   *


Reviewed-by: John Snow <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]