All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30
@ 2015-03-30 17:42 Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture Andreas Färber
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andreas Färber @ 2015-03-30 17:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, John Snow, Andreas Färber, Stefan Hajnoczi,
	Paolo Bonzini

Hello Peter,

This is my QTest queue for 2.3. Please pull.

Regards,
Andreas

Cc: Peter Maydell <peter.maydell@linaro.org>

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: John Snow <jsnow@redhat.com>

The following changes since commit 627f91b1f80fecc73d00727181a9ddb6162cc30e:

  Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2015-03-28 10:10:04 +0000)

are available in the git repository at:

  git://github.com/afaerber/qemu-cpu.git tags/qtest-for-2.3

for you to fetch changes up to 6ca90ffeec8e3b4e306be32efd930d75a6d0b295:

  i440fx-test: Fix test paths to include architecture (2015-03-30 19:24:54 +0200)

----------------------------------------------------------------
QTest cleanups

* Change fw_cfg-test and i440fx-test GTester paths
* Extend libqtest API as necessary

----------------------------------------------------------------
Andreas Färber (4):
      fw_cfg-test: Fix test path to include architecture
      qtest: Add qtest_add_data_func() wrapper function
      qtest: Add qtest_add() wrapper macro
      i440fx-test: Fix test paths to include architecture

 tests/fw_cfg-test.c | 26 +++++++++++++-------------
 tests/i440fx-test.c | 12 ++++++------
 tests/libqtest.c    |  7 +++++++
 tests/libqtest.h    | 32 ++++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture
  2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
@ 2015-03-30 17:42 ` Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function Andreas Färber
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2015-03-30 17:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, qemu-stable

Use qtest_add_func() instead of g_test_add_func() to reflect
the architecture tested, changing GTester paths as follows:

  /fw_cfg/foo -> /x86_64/fw_cfg/foo etc.

Cc: qemu-stable@nongnu.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/fw_cfg-test.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 5c8f8d6..9be78e9 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -109,21 +109,21 @@ int main(int argc, char **argv)
 
     fw_cfg = pc_fw_cfg_init();
 
-    g_test_add_func("/fw_cfg/signature", test_fw_cfg_signature);
-    g_test_add_func("/fw_cfg/id", test_fw_cfg_id);
-    g_test_add_func("/fw_cfg/uuid", test_fw_cfg_uuid);
-    g_test_add_func("/fw_cfg/ram_size", test_fw_cfg_ram_size);
-    g_test_add_func("/fw_cfg/nographic", test_fw_cfg_nographic);
-    g_test_add_func("/fw_cfg/nb_cpus", test_fw_cfg_nb_cpus);
+    qtest_add_func("fw_cfg/signature", test_fw_cfg_signature);
+    qtest_add_func("fw_cfg/id", test_fw_cfg_id);
+    qtest_add_func("fw_cfg/uuid", test_fw_cfg_uuid);
+    qtest_add_func("fw_cfg/ram_size", test_fw_cfg_ram_size);
+    qtest_add_func("fw_cfg/nographic", test_fw_cfg_nographic);
+    qtest_add_func("fw_cfg/nb_cpus", test_fw_cfg_nb_cpus);
 #if 0
-    g_test_add_func("/fw_cfg/machine_id", test_fw_cfg_machine_id);
-    g_test_add_func("/fw_cfg/kernel", test_fw_cfg_kernel);
-    g_test_add_func("/fw_cfg/initrd", test_fw_cfg_initrd);
-    g_test_add_func("/fw_cfg/boot_device", test_fw_cfg_boot_device);
+    qtest_add_func("fw_cfg/machine_id", test_fw_cfg_machine_id);
+    qtest_add_func("fw_cfg/kernel", test_fw_cfg_kernel);
+    qtest_add_func("fw_cfg/initrd", test_fw_cfg_initrd);
+    qtest_add_func("fw_cfg/boot_device", test_fw_cfg_boot_device);
 #endif
-    g_test_add_func("/fw_cfg/max_cpus", test_fw_cfg_max_cpus);
-    g_test_add_func("/fw_cfg/numa", test_fw_cfg_numa);
-    g_test_add_func("/fw_cfg/boot_menu", test_fw_cfg_boot_menu);
+    qtest_add_func("fw_cfg/max_cpus", test_fw_cfg_max_cpus);
+    qtest_add_func("fw_cfg/numa", test_fw_cfg_numa);
+    qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu);
 
     cmdline = g_strdup_printf("-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8 ");
     s = qtest_start(cmdline);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function
  2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture Andreas Färber
@ 2015-03-30 17:42 ` Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 3/4] qtest: Add qtest_add() wrapper macro Andreas Färber
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2015-03-30 17:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

It calls g_test_add_data_func() with a path supplemented by the
architecture, like qtest_add_func() does.

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
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..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
  *
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 3/4] qtest: Add qtest_add() wrapper macro
  2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function Andreas Färber
@ 2015-03-30 17:42 ` Andreas Färber
  2015-03-30 17:42 ` [Qemu-devel] [PULL 4/4] i440fx-test: Fix test paths to include architecture Andreas Färber
  2015-03-31 10:50 ` [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2015-03-30 17:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

It extends g_test_add() macro with the architecture path.

Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/libqtest.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/libqtest.h b/tests/libqtest.h
index 9281f5c..03469b8 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -357,6 +357,26 @@ void qtest_add_func(const char *str, void (*fn));
 void qtest_add_data_func(const char *str, const void *data, void (*fn));
 
 /**
+ * qtest_add:
+ * @testpath: Test case path
+ * @Fixture: Fixture type
+ * @tdata: Test case data
+ * @fsetup: Test case setup function
+ * @ftest: Test case function
+ * @fteardown: Test case teardown function
+ *
+ * Add a GTester testcase with the given name, data and functions.
+ * The path is prefixed with the architecture under test, as
+ * returned by qtest_get_arch().
+ */
+#define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
+    do { \
+        char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
+        g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
+        g_free(path); \
+    } while (0)
+
+/**
  * qtest_start:
  * @args: other arguments to pass to QEMU
  *
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 4/4] i440fx-test: Fix test paths to include architecture
  2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
                   ` (2 preceding siblings ...)
  2015-03-30 17:42 ` [Qemu-devel] [PULL 3/4] qtest: Add qtest_add() wrapper macro Andreas Färber
@ 2015-03-30 17:42 ` Andreas Färber
  2015-03-31 10:50 ` [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2015-03-30 17:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, qemu-stable

Replace g_test_add_func() with new qtest_add_func() and g_test_add()
macro with qtest_add() macro. This effectively changes GTester paths:

  /i440fx/foo -> /x86_64/i440fx/foo etc.

Cc: qemu-stable@nongnu.org
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/i440fx-test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c
index a3f7279..d0bc8de 100644
--- a/tests/i440fx-test.c
+++ b/tests/i440fx-test.c
@@ -383,8 +383,8 @@ static void add_firmware_test(const char *testpath,
                               void (*setup_fixture)(FirmwareTestFixture *f,
                                                     gconstpointer test_data))
 {
-    g_test_add(testpath, FirmwareTestFixture, NULL, setup_fixture,
-               test_i440fx_firmware, NULL);
+    qtest_add(testpath, FirmwareTestFixture, NULL, setup_fixture,
+              test_i440fx_firmware, NULL);
 }
 
 static void request_bios(FirmwareTestFixture *fixture,
@@ -408,10 +408,10 @@ int main(int argc, char **argv)
 
     data.num_cpus = 1;
 
-    g_test_add_data_func("/i440fx/defaults", &data, test_i440fx_defaults);
-    g_test_add_data_func("/i440fx/pam", &data, test_i440fx_pam);
-    add_firmware_test("/i440fx/firmware/bios", request_bios);
-    add_firmware_test("/i440fx/firmware/pflash", request_pflash);
+    qtest_add_data_func("i440fx/defaults", &data, test_i440fx_defaults);
+    qtest_add_data_func("i440fx/pam", &data, test_i440fx_pam);
+    add_firmware_test("i440fx/firmware/bios", request_bios);
+    add_firmware_test("i440fx/firmware/pflash", request_pflash);
 
     ret = g_test_run();
     return ret;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30
  2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
                   ` (3 preceding siblings ...)
  2015-03-30 17:42 ` [Qemu-devel] [PULL 4/4] i440fx-test: Fix test paths to include architecture Andreas Färber
@ 2015-03-31 10:50 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-03-31 10:50 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Paolo Bonzini, John Snow, QEMU Developers, Stefan Hajnoczi

On 30 March 2015 at 18:42, Andreas Färber <afaerber@suse.de> wrote:
> Hello Peter,
>
> This is my QTest queue for 2.3. Please pull.
>
> Regards,
> Andreas
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: John Snow <jsnow@redhat.com>
>
> The following changes since commit 627f91b1f80fecc73d00727181a9ddb6162cc30e:
>
>   Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2015-03-28 10:10:04 +0000)
>
> are available in the git repository at:
>
>   git://github.com/afaerber/qemu-cpu.git tags/qtest-for-2.3
>
> for you to fetch changes up to 6ca90ffeec8e3b4e306be32efd930d75a6d0b295:
>
>   i440fx-test: Fix test paths to include architecture (2015-03-30 19:24:54 +0200)
>
> ----------------------------------------------------------------
> QTest cleanups
>
> * Change fw_cfg-test and i440fx-test GTester paths
> * Extend libqtest API as necessary
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-31 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 17:42 [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Andreas Färber
2015-03-30 17:42 ` [Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture Andreas Färber
2015-03-30 17:42 ` [Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function Andreas Färber
2015-03-30 17:42 ` [Qemu-devel] [PULL 3/4] qtest: Add qtest_add() wrapper macro Andreas Färber
2015-03-30 17:42 ` [Qemu-devel] [PULL 4/4] i440fx-test: Fix test paths to include architecture Andreas Färber
2015-03-31 10:50 ` [Qemu-devel] [PULL 0/4] QTest patch queue 2015-03-30 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.