Skip to contentSkip to conversation

QTest patch queue 2015-03-30

GIT PULL Applied Andreas Färber 2 participants 6 messages Mar 30, 2015 – Mar 31, 2015

lore
Share & tools
lore
#0 lore raw

Hello Peter,

This is my QTest queue for 2.3. Please pull.

Regards,
Andreas

Cc Peter Maydell <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc John Snow <[email protected]>

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(-)
#1 lore raw

[Qemu-devel] [PULL 4/4] i440fx-test: Fix test paths to include architecture

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.

---
 tests/i440fx-test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tests/i440fx-test.c +6 -6
index a3f7279..d0bc8de 100644
@@ -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;
Signature · 1 line
2.1.4
#2 lore raw

[Qemu-devel] [PULL 3/4] qtest: Add qtest_add() wrapper macro

In reply to Andreas Färber

It extends g_test_add() macro with the architecture path.

---
 tests/libqtest.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
tests/libqtest.h +20 -0
index 9281f5c..03469b8 100644
@@ -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
  *
Signature · 1 line
2.1.4
#3 lore raw

[Qemu-devel] [PULL 2/4] qtest: Add qtest_add_data_func() wrapper function

In reply to Andreas Färber

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

---
 tests/libqtest.c |  7 +++++++
 tests/libqtest.h | 12 ++++++++++++
 2 files changed, 19 insertions(+)
tests/libqtest.c +7 -0
index 9a92aa7..12d65bd 100644
@@ -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;
tests/libqtest.h +12 -0
index e7413d5..9281f5c 100644
@@ -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
  *
Signature · 1 line
2.1.4
#4 lore raw

[Qemu-devel] [PULL 1/4] fw_cfg-test: Fix test path to include architecture

In reply to Andreas Färber

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.

---
 tests/fw_cfg-test.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
tests/fw_cfg-test.c +13 -13
index 5c8f8d6..9be78e9 100644
@@ -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);
Signature · 1 line
2.1.4
#5 lore raw
In reply to Andreas Färber
Quoted 23 lines · Andreas Färber

Hello Peter,

This is my QTest queue for 2.3. Please pull.

Regards,
Andreas

Cc Peter Maydell <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc John Snow <[email protected]>

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:

Quoted 8 lines

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