These tests rely on HMP commands (drive_add, drive_del) that have no direct QMP equivalent. QMP's blockdev-del operates on node-names and rejects deletion of in-use nodes, whereas HMP's drive_del operates on BlockBackend IDs and can detach a drive from a device. The equivalent QMP-based tests already exist (test_blockdev_add_device_add_and_del*).
Signed-off-by: Marc-André Lureau <[email protected]> --- tests/qtest/drive_del-test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 30d9451ddda..d78816d44a7 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -87,6 +87,7 @@ static void blockdev_add_with_media(QTestState *qts) g_assert(has_blockdev(qts)); } +#ifdef CONFIG_HMP static void drive_add(QTestState *qts) { char *resp = qtest_hmp(qts, "drive_add 0 if=none,id=drive0"); @@ -117,6 +118,7 @@ static void drive_del(QTestState *qts) g_assert(!has_drive(qts)); g_free(resp); } +#endif /* * qvirtio_get_dev_type: @@ -163,6 +165,7 @@ static void device_del(QTestState *qts, bool and_reset) qtest_qmp_eventwait(qts, "DEVICE_DELETED"); } +#ifdef CONFIG_HMP static void test_drive_without_dev(void) { QTestState *qts; @@ -245,6 +248,7 @@ static void test_drive_del_device_del(void) qtest_quit(qts); } +#endif static void test_cli_device_del(void) { @@ -391,6 +395,7 @@ static void test_device_add_and_del_q35(void) qtest_quit(qts); } +#ifdef CONFIG_HMP static void test_drive_add_device_add_and_del(void) { QTestState *qts; @@ -443,6 +448,7 @@ static void test_drive_add_device_add_and_del_q35(void) qtest_quit(qts); } +#endif static void test_blockdev_add_device_add_and_del(void) { @@ -501,19 +507,25 @@ int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); +#ifdef CONFIG_HMP qtest_add_func("/drive_del/without-dev", test_drive_without_dev); +#endif if (qvirtio_get_dev_type() != NULL) { +#ifdef CONFIG_HMP qtest_add_func("/drive_del/after_failed_device_add", test_after_failed_device_add); qtest_add_func("/drive_del/drive_del_device_del", test_drive_del_device_del); +#endif qtest_add_func("/device_del/drive/cli_device", test_cli_device_del); qtest_add_func("/device_del/drive/device_add", test_device_add_and_del); +#ifdef CONFIG_HMP qtest_add_func("/device_del/drive/drive_add_device_add", test_drive_add_device_add_and_del); +#endif qtest_add_func("/device_del/empty", test_empty_device_del); qtest_add_func("/device_del/blockdev", @@ -524,8 +536,10 @@ int main(int argc, char **argv) test_cli_device_del_q35); qtest_add_func("/device_del/drive/device_add_q35", test_device_add_and_del_q35); +#ifdef CONFIG_HMP qtest_add_func("/device_del/drive/drive_add_device_add_q35", test_drive_add_device_add_and_del_q35); +#endif qtest_add_func("/device_del/blockdev_q35", test_blockdev_add_device_add_and_del_q35); } -- 2.54.0
