summaryrefslogtreecommitdiffstats
path: root/tests/qtest/device-plug-test.c
Commit message (Collapse)AuthorAgeFilesLines
* tests/qtest: device-plug-test: Reverse the usage of double/single quotesBin Meng2022-10-281-8/+8
| | | | | | | | | | | | | | | | | | 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> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221028045736.679903-5-bin.meng@windriver.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/x86: Add subtest with 'q35' machine type to device-plug-testMichael Labiuk2022-10-111-0/+41
| | | | | | | | | Configure pci bridge setting to plug pci device and unplug. Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com> Message-Id: <20220929223547.1429580-3-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/x86: add helper qtest_qmp_device_del_send()Michael Labiuk2022-10-111-13/+2Star
| | | | | | | | | | | | Move sending 'device_del' command to separate function. Function can be used in case of addition action is needed to start actual removing device after sending command. Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com> Message-Id: <20220929223547.1429580-2-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth <thuth@redhat.com> [thuth: Fixed typo] Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/x86: Move common code to function in device-plug-testMichael Labiuk2022-09-271-25/+17Star
| | | | | | | | | Move common code for device removing to function. Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com> Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/qtest: device-plug-test: Reverse the usage of double/single quotesBin Meng2022-08-291-1/+1
| | | | | | | | | | | | | | | | 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> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220824094029.1634519-36-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests: move libqtest.h back under qtest/Marc-André Lureau2022-05-031-1/+1
| | | | | | | | | | | Since commit a2ce7dbd917 ("meson: convert tests/qtest to meson"), libqtest.h is under libqos/ directory, while libqtest.c is still in qtest/. Move back to its original location to avoid mixing with libqos/. Suggested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
* tests/x86: Use 'pc' machine type for hotplug testsDr. David Alan Gilbert2022-02-211-2/+18
| | | | | | | | | | Hotplug tests need a bridge setting up on q35, for now keep them on 'pc'. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220215162537.605030-3-dgilbert@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* softmmu: fix device deletion events with -device JSON syntaxDaniel P. Berrangé2022-01-141-0/+19
| | | | | | | | | | | | | | | | | | | | | | | The -device JSON syntax impl leaks a reference on the created DeviceState instance. As a result when you hot-unplug the device, the device_finalize method won't be called and thus it will fail to emit the required DEVICE_DELETED event. A 'json-cli' feature was previously added against the 'device_add' QMP command QAPI schema to indicated to mgmt apps that -device supported JSON syntax. Given the hotplug bug that feature flag is not usable for its purpose, so we add a new 'json-cli-hotplug' feature to indicate the -device supports JSON without breaking hotplug. Fixes: 5dacda5167560b3af8eadbce5814f60ba44b467e Resolves: https://gitlab.com/qemu-project/qemu/-/issues/802 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220105123847.4047954-2-berrange@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Tested-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* device-plug-test: use qtest_qmp to send the device_del commandPaolo Bonzini2020-10-121-23/+9Star
| | | | | | | Simplify the code now that events are buffered. There is no need anymore to separate sending the command and retrieving the response. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qtest: rename qtest_qmp_receive to qtest_qmp_receive_dictMaxim Levitsky2020-10-121-1/+1
| | | | | | | | | | | | In the next patch a new version of qtest_qmp_receive will be reintroduced that will buffer received qmp events for later consumption in qtest_qmp_eventwait_ref No functional change intended. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* meson: convert tests/qtest to mesonPaolo Bonzini2020-08-211-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* test: Move qtests to a separate directoryThomas Huth2020-01-121-0/+178
The tests directory itself is pretty overcrowded, and it's hard to see which test belongs to which test subsystem (unit, qtest, ...). Let's move the qtests to a separate folder for more clarity. Message-Id: <20191218103059.11729-6-thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>