diff mbox series

[v6,04/11] tests/qtest: device-plug-test: Reverse the usage of double/single quotes

Message ID 20221028045736.679903-5-bin.meng@windriver.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Oct. 28, 2022, 4:57 a.m. UTC
The usage of double/single quotes in test_q35_pci_unplug_json_request()
should be reversed to work on both win32 and non-win32 platforms:

- The value of -device parameter needs to be surrounded by "" as
  Windows does not drop '' when passing it to QEMU which causes
  QEMU command line option parser failure.
- The JSON key/value pairs need to be surrounded by '' to make the
  JSON parser happy on Windows.

Fixes: a12f1a7e56b7 ("tests/x86: Add subtest with 'q35' machine type to device-plug-test")
Signed-off-by: Bin Meng <bin.meng@windriver.com>

---

Changes in v6:
- new patch: "tests/qtest: device-plug-test: Reverse the usage of double/single quotes"

 tests/qtest/device-plug-test.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Thomas Huth Oct. 28, 2022, 7:49 a.m. UTC | #1
On 28/10/2022 06.57, Bin Meng wrote:
> The usage of double/single quotes in test_q35_pci_unplug_json_request()
> should be reversed to work on both win32 and non-win32 platforms:
> 
> - The value of -device parameter needs to be surrounded by "" as
>    Windows does not drop '' when passing it to QEMU which causes
>    QEMU command line option parser failure.
> - The JSON key/value pairs need to be surrounded by '' to make the
>    JSON parser happy on Windows.
> 
> Fixes: a12f1a7e56b7 ("tests/x86: Add subtest with 'q35' machine type to device-plug-test")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> 
> ---
> 
> Changes in v6:
> - new patch: "tests/qtest: device-plug-test: Reverse the usage of double/single quotes"
> 
>   tests/qtest/device-plug-test.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
> index 3f44f731d1..5a6afa2b57 100644
> --- a/tests/qtest/device-plug-test.c
> +++ b/tests/qtest/device-plug-test.c
> @@ -112,16 +112,16 @@ static void test_pci_unplug_json_request(void)
>   
>   static void test_q35_pci_unplug_json_request(void)
>   {
> -    const char *port = "-device '{\"driver\": \"pcie-root-port\", "
> -                                      "\"id\": \"p1\"}'";
> +    const char *port = "-device \"{'driver': 'pcie-root-port', "
> +                                  "'id': 'p1'}\"";
>   
> -    const char *bridge = "-device '{\"driver\": \"pcie-pci-bridge\", "
> -                                   "\"id\": \"b1\", "
> -                                   "\"bus\": \"p1\"}'";
> +    const char *bridge = "-device \"{'driver': 'pcie-pci-bridge', "
> +                                    "'id': 'b1', "
> +                                    "'bus': 'p1'}\"";
>   
> -    const char *device = "-device '{\"driver\": \"virtio-mouse-pci\", "
> -                                   "\"bus\": \"b1\", "
> -                                   "\"id\": \"dev0\"}'";
> +    const char *device = "-device \"{'driver': 'virtio-mouse-pci', "
> +                                    "'bus': 'b1', "
> +                                    "'id': 'dev0'}\"";
>   
>       QTestState *qtest = qtest_initf("-machine q35 %s %s %s",
>                                       port, bridge, device);

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 3f44f731d1..5a6afa2b57 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -112,16 +112,16 @@  static void test_pci_unplug_json_request(void)
 
 static void test_q35_pci_unplug_json_request(void)
 {
-    const char *port = "-device '{\"driver\": \"pcie-root-port\", "
-                                      "\"id\": \"p1\"}'";
+    const char *port = "-device \"{'driver': 'pcie-root-port', "
+                                  "'id': 'p1'}\"";
 
-    const char *bridge = "-device '{\"driver\": \"pcie-pci-bridge\", "
-                                   "\"id\": \"b1\", "
-                                   "\"bus\": \"p1\"}'";
+    const char *bridge = "-device \"{'driver': 'pcie-pci-bridge', "
+                                    "'id': 'b1', "
+                                    "'bus': 'p1'}\"";
 
-    const char *device = "-device '{\"driver\": \"virtio-mouse-pci\", "
-                                   "\"bus\": \"b1\", "
-                                   "\"id\": \"dev0\"}'";
+    const char *device = "-device \"{'driver': 'virtio-mouse-pci', "
+                                    "'bus': 'b1', "
+                                    "'id': 'dev0'}\"";
 
     QTestState *qtest = qtest_initf("-machine q35 %s %s %s",
                                     port, bridge, device);