diff options
author | Peter Maydell | 2014-10-06 11:59:55 +0200 |
---|---|---|
committer | Peter Maydell | 2014-10-06 11:59:56 +0200 |
commit | 507ef2f9fab3e67ac6fefda4e20db7fc5f2bc186 (patch) | |
tree | 71c2dc7fcfeb4f0b0dfba1287e191998b1375c79 /tests/qdev-monitor-test.c | |
parent | Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20141002-1' into... (diff) | |
parent | blockdev-test: Test device_del after drive_del (diff) | |
download | qemu-507ef2f9fab3e67ac6fefda4e20db7fc5f2bc186.tar.gz qemu-507ef2f9fab3e67ac6fefda4e20db7fc5f2bc186.tar.xz qemu-507ef2f9fab3e67ac6fefda4e20db7fc5f2bc186.zip |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Sat 04 Oct 2014 21:24:46 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/block-pull-request: (23 commits)
blockdev-test: Test device_del after drive_del
blockdev-test: Factor out some common code into helpers
blockdev-test: Simplify by using g_assert_cmpstr()
blockdev-test: Clean up bogus drive_add argument
blockdev-test: Use single rather than double quotes in QMP
drive_del-test: Merge of qdev-monitor-test, blockdev-test
iotests: qemu-img info output for corrupt image
qapi: Add corrupt field to ImageInfoSpecificQCow2
iotests: Use _img_info
util: Emancipate id_wellformed() from QemuOpts
q35/ahci: Pick up -cdrom and -hda options
qtest/bios-tables: Correct Q35 command line
ide: Update ide_drive_get to be HBA agnostic
pc/vl: Add units-per-default-bus property
blockdev: Allow overriding if_max_dev property
blockdev: Orphaned drive search
qemu-iotests: Fix supported cache modes for 052
make check-block: Use default cache modes
Modify qemu_opt_rename to realize renaming all items in opts
vmdk: Fix integer overflow in offset calculation
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qdev-monitor-test.c')
-rw-r--r-- | tests/qdev-monitor-test.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/tests/qdev-monitor-test.c b/tests/qdev-monitor-test.c deleted file mode 100644 index e20ffd67a7..0000000000 --- a/tests/qdev-monitor-test.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * qdev-monitor.c test cases - * - * Copyright (C) 2013 Red Hat Inc. - * - * Authors: - * Stefan Hajnoczi <stefanha@redhat.com> - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#include <string.h> -#include <glib.h> -#include "libqtest.h" -#include "qapi/qmp/qjson.h" - -static void test_device_add(void) -{ - QDict *response; - QDict *error; - - qtest_start("-drive if=none,id=drive0"); - - /* Make device_add fail. If this leaks the virtio-blk-pci device then a - * reference to drive0 will also be held (via qdev properties). - */ - response = qmp("{\"execute\": \"device_add\"," - " \"arguments\": {" - " \"driver\": \"virtio-blk-pci\"," - " \"drive\": \"drive0\"" - "}}"); - g_assert(response); - error = qdict_get_qdict(response, "error"); - g_assert_cmpstr(qdict_get_try_str(error, "class"), ==, "GenericError"); - QDECREF(response); - - /* Delete the drive */ - response = qmp("{\"execute\": \"human-monitor-command\"," - " \"arguments\": {" - " \"command-line\": \"drive_del drive0\"" - "}}"); - g_assert(response); - g_assert_cmpstr(qdict_get_try_str(response, "return"), ==, ""); - QDECREF(response); - - /* Try to re-add the drive. This fails with duplicate IDs if a leaked - * virtio-blk-pci exists that holds a reference to the old drive0. - */ - response = qmp("{\"execute\": \"human-monitor-command\"," - " \"arguments\": {" - " \"command-line\": \"drive_add pci-addr=auto if=none,id=drive0\"" - "}}"); - g_assert(response); - g_assert_cmpstr(qdict_get_try_str(response, "return"), ==, "OK\r\n"); - QDECREF(response); - - qtest_end(); -} - -int main(int argc, char **argv) -{ - const char *arch = qtest_get_arch(); - - /* Check architecture */ - if (strcmp(arch, "i386") && strcmp(arch, "x86_64")) { - g_test_message("Skipping test for non-x86\n"); - return 0; - } - - /* Run the tests */ - g_test_init(&argc, &argv, NULL); - - qtest_add_func("/qmp/device_add", test_device_add); - - return g_test_run(); -} |