qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc Marí" <marc.mari.barcelo@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc Marí" <marc.mari.barcelo@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v6 5/7] libqos: Added test case for configuration changes in virtio-blk test
Date: Mon, 25 Aug 2014 10:36:11 +0200	[thread overview]
Message-ID: <1408955773-4778-6-git-send-email-marc.mari.barcelo@gmail.com> (raw)
In-Reply-To: <1408955773-4778-1-git-send-email-marc.mari.barcelo@gmail.com>

Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com>
---
 tests/virtio-blk-test.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
index 95e6861..07ae754 100644
--- a/tests/virtio-blk-test.c
+++ b/tests/virtio-blk-test.c
@@ -359,6 +359,39 @@ static void pci_indirect(void)
     test_end();
 }
 
+static void pci_config(void)
+{
+    QVirtioPCIDevice *dev;
+    QPCIBus *bus;
+    int n_size = TEST_IMAGE_SIZE / 2;
+    void *addr;
+    uint64_t capacity;
+
+    bus = test_start();
+
+    dev = virtio_blk_init(bus);
+
+    /* MSI-X is not enabled */
+    addr = dev->addr + QVIRTIO_DEVICE_SPECIFIC_NO_MSIX;
+
+    capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, addr);
+    g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512);
+
+    qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);
+
+    qmp("{ 'execute': 'block_resize', 'arguments': { 'device': 'drive0', "
+                                                    " 'size': %d } }", n_size);
+    g_assert(qvirtio_wait_isr(&qvirtio_pci, &dev->vdev, 0x2,
+                                                        QVIRTIO_BLK_TIMEOUT));
+
+    capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, addr);
+    g_assert_cmpint(capacity, ==, n_size / 512);
+
+    qvirtio_pci_device_disable(dev);
+    g_free(dev);
+    test_end();
+}
+
 int main(int argc, char **argv)
 {
     int ret;
@@ -367,6 +400,7 @@ int main(int argc, char **argv)
 
     g_test_add_func("/virtio/blk/pci/basic", pci_basic);
     g_test_add_func("/virtio/blk/pci/indirect", pci_indirect);
+    g_test_add_func("/virtio/blk/pci/config", pci_config);
 
     ret = g_test_run();
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-08-25  8:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  8:36 [Qemu-devel] [PATCH v6 0/7] Virtio PCI libqos driver Marc Marí
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 1/7] tests: Functions bus_foreach and device_find from libqos virtio API Marc Marí
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 2/7] tests: Add virtio device initialization Marc Marí
2014-08-27 13:51   ` Stefan Hajnoczi
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 3/7] libqos: Added basic virtqueue support to virtio implementation Marc Marí
2014-08-27 13:57   ` Stefan Hajnoczi
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 4/7] libqos: Added indirect descriptor " Marc Marí
2014-08-27 13:58   ` Stefan Hajnoczi
2014-08-25  8:36 ` Marc Marí [this message]
2014-08-27 13:59   ` [Qemu-devel] [PATCH v6 5/7] libqos: Added test case for configuration changes in virtio-blk test Stefan Hajnoczi
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 6/7] libqos: Added MSI-X support Marc Marí
2014-08-25  8:36 ` [Qemu-devel] [PATCH v6 7/7] libqos: Added EVENT_IDX support Marc Marí
2014-08-27 14:02 ` [Qemu-devel] [PATCH v6 0/7] Virtio PCI libqos driver Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408955773-4778-6-git-send-email-marc.mari.barcelo@gmail.com \
    --to=marc.mari.barcelo@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).