[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 07/40] ivshmem-test: Improve test case /ivshmem/si
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL v2 07/40] ivshmem-test: Improve test case /ivshmem/single |
Date: |
Mon, 21 Mar 2016 21:43:30 +0100 |
Test state of registers after reset.
Test reading Interrupt Status clears it.
Test (invalid) read of Doorbell.
Add more comments.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
---
tests/ivshmem-test.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
index da6ca0d..a48dc49 100644
--- a/tests/ivshmem-test.c
+++ b/tests/ivshmem-test.c
@@ -143,32 +143,41 @@ static void test_ivshmem_single(void)
setup_vm(&state);
s = &state;
- /* valid io */
- out_reg(s, INTRMASK, 0);
- in_reg(s, INTRSTATUS);
- in_reg(s, IVPOSITION);
+ /* initial state of readable registers */
+ g_assert_cmpuint(in_reg(s, INTRMASK), ==, 0);
+ g_assert_cmpuint(in_reg(s, INTRSTATUS), ==, 0);
+ g_assert_cmpuint(in_reg(s, IVPOSITION), ==, 0);
+ /* trigger interrupt via registers */
out_reg(s, INTRMASK, 0xffffffff);
g_assert_cmpuint(in_reg(s, INTRMASK), ==, 0xffffffff);
out_reg(s, INTRSTATUS, 1);
- /* XXX: intercept IRQ, not seen in resp */
+ /* check interrupt status */
g_assert_cmpuint(in_reg(s, INTRSTATUS), ==, 1);
+ /* reading clears */
+ g_assert_cmpuint(in_reg(s, INTRSTATUS), ==, 0);
+ /* TODO intercept actual interrupt (needs qtest work) */
- /* invalid io */
+ /* invalid register access */
out_reg(s, IVPOSITION, 1);
+ in_reg(s, DOORBELL);
+
+ /* ring the (non-functional) doorbell */
out_reg(s, DOORBELL, 8 << 16);
+ /* write shared memory */
for (i = 0; i < G_N_ELEMENTS(data); i++) {
data[i] = i;
}
qtest_memwrite(s->qtest, (uintptr_t)s->mem_base, data, sizeof(data));
+ /* verify write */
for (i = 0; i < G_N_ELEMENTS(data); i++) {
g_assert_cmpuint(((uint32_t *)tmpshmem)[i], ==, i);
}
+ /* read it back and verify read */
memset(data, 0, sizeof(data));
-
qtest_memread(s->qtest, (uintptr_t)s->mem_base, data, sizeof(data));
for (i = 0; i < G_N_ELEMENTS(data); i++) {
g_assert_cmpuint(data[i], ==, i);
--
2.4.3
- [Qemu-devel] [PULL v2 00/40] ivshmem: Fixes, cleanups, device model split, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 12/40] ivshmem: Compile debug prints unconditionally to prevent bit-rot, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 04/40] qemu-doc: Fix ivshmem huge page example, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 13/40] ivshmem: Clean up after commit 9940c32, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 07/40] ivshmem-test: Improve test case /ivshmem/single,
Markus Armbruster <=
- [Qemu-devel] [PULL v2 05/40] event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFD, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 02/40] ivshmem-server: Fix and clean up command line help, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 08/40] ivshmem-test: Clean up wait for devices to become operational, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 18/40] ivshmem: Clean up register callbacks, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 17/40] ivshmem: Failed realize() can leave migration blocker behind, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 22/40] ivshmem: Simplify rejection of invalid peer ID from server, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 16/40] ivshmem: Fix harmless misuse of Error, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 34/40] qdev: New DEFINE_PROP_ON_OFF_AUTO, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 38/40] ivshmem: Drop ivshmem property x-memdev, Markus Armbruster, 2016/03/21
- [Qemu-devel] [PULL v2 06/40] tests/libqos/pci-pc: Fix qpci_pc_iomap() to map BARs aligned, Markus Armbruster, 2016/03/21