diff mbox series

[35/51] tests/qtest: device-plug-test: Reverse the usage of double/single quotes

Message ID 20220824094029.1634519-36-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Aug. 24, 2022, 9:40 a.m. UTC
From: Bin Meng <bin.meng@windriver.com>

The usage of double/single quotes in test_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.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/device-plug-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Aug. 25, 2022, 12:20 p.m. UTC | #1
On 24/08/2022 11.40, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> The usage of double/single quotes in test_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.
> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>   tests/qtest/device-plug-test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
> index 2e3137843e..a1fb99c8ff 100644
> --- a/tests/qtest/device-plug-test.c
> +++ b/tests/qtest/device-plug-test.c
> @@ -95,7 +95,7 @@ static void test_pci_unplug_json_request(void)
>       }
>   
>       QTestState *qtest = qtest_initf(
> -        "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'",
> +        "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"",
>           machine_addition);

It's also a shorter string, so that's even nicer to read!

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 2e3137843e..a1fb99c8ff 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -95,7 +95,7 @@  static void test_pci_unplug_json_request(void)
     }
 
     QTestState *qtest = qtest_initf(
-        "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'",
+        "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"",
         machine_addition);
 
     /*