[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/41] megasas: add qtest
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 07/41] megasas: add qtest |
Date: |
Thu, 15 Jun 2017 12:52:27 +0200 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/Makefile.include | 3 +++
tests/megasas-test.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 tests/megasas-test.c
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f42f3df..77da9b7 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -205,6 +205,8 @@ check-qtest-pci-y += tests/intel-hda-test$(EXESUF)
gcov-files-pci-y += hw/audio/intel-hda.c hw/audio/hda-codec.c
check-qtest-pci-$(CONFIG_EVENTFD) += tests/ivshmem-test$(EXESUF)
gcov-files-pci-y += hw/misc/ivshmem.c
+check-qtest-pci-y += tests/megasas-test$(EXESUF)
+gcov-files-pci-y += hw/scsi/megasas.c
check-qtest-i386-y = tests/endianness-test$(EXESUF)
check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -755,6 +757,7 @@ tests/test-filter-mirror$(EXESUF):
tests/test-filter-mirror.o $(qtest-obj-y)
tests/test-filter-redirector$(EXESUF): tests/test-filter-redirector.o
$(qtest-obj-y)
tests/test-x86-cpuid-compat$(EXESUF): tests/test-x86-cpuid-compat.o
$(qtest-obj-y)
tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o
contrib/ivshmem-server/ivshmem-server.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
+tests/megasas-test$(EXESUF): tests/megasas-test.o $(libqos-spapr-obj-y)
$(libqos-pc-obj-y)
tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o
contrib/libvhost-user/libvhost-user.o $(test-util-obj-y)
tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
diff --git a/tests/megasas-test.c b/tests/megasas-test.c
new file mode 100644
index 0000000..a9e56a2
--- /dev/null
+++ b/tests/megasas-test.c
@@ -0,0 +1,51 @@
+/*
+ * QTest testcase for LSI MegaRAID
+ *
+ * Copyright (c) 2017 Red Hat Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest.h"
+#include "qemu/bswap.h"
+#include "libqos/libqos-pc.h"
+#include "libqos/libqos-spapr.h"
+
+static QOSState *qmegasas_start(const char *extra_opts)
+{
+ const char *arch = qtest_get_arch();
+ const char *cmd = "-drive id=hd0,if=none,file=null-co://,format=raw "
+ "-device megasas,id=scsi0,addr=04.0 "
+ "-device scsi-hd,bus=scsi0.0,drive=hd0 %s";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ return qtest_pc_boot(cmd, extra_opts ? : "");
+ }
+
+ g_printerr("virtio-scsi tests are only available on x86 or ppc64\n");
+ exit(EXIT_FAILURE);
+}
+
+static void qmegasas_stop(QOSState *qs)
+{
+ qtest_shutdown(qs);
+}
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+ QOSState *qs;
+
+ qs = qmegasas_start(NULL);
+ qmegasas_stop(qs);
+}
+
+int main(int argc, char **argv)
+{
+ g_test_init(&argc, &argv, NULL);
+ qtest_add_func("/megasas/pci/nop", pci_nop);
+
+ return g_test_run();
+}
--
1.8.3.1
- [Qemu-devel] [PULL 26/41] nbd/server: get rid of nbd_negotiate_read and friends, (continued)
- [Qemu-devel] [PULL 26/41] nbd/server: get rid of nbd_negotiate_read and friends, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 28/41] nbd/server: refactor nbd_co_send_reply, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 27/41] nbd/server: get rid of ssize_t, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 19/41] qemu-nbd: Ignore SIGPIPE, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 29/41] nbd/server: get rid of EAGAIN dead code, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 35/41] nbd/server: refactor nbd_trip, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 10/41] megasas: do not read DCMD opcode more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 11/41] megasas: do not read command more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 05/41] ivshmem: use ram_from_fd(), Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 18/41] nbd: Fix regression on resiliency to port scan, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 07/41] megasas: add qtest,
Paolo Bonzini <=
- [Qemu-devel] [PULL 24/41] nbd: rename read_sync and friends, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 30/41] nbd/server: refactor nbd_co_receive_request, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 34/41] nbd/server: rename rc to ret, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 31/41] nbd/server: remove NBDClientNewData, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 32/41] nbd/server: nbd_negotiate: fix error path, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 36/41] include/exec/poison: Add missing TARGET defines, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 33/41] nbd/server: get rid of fail: return rc, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 37/41] include/exec/poison: Mark some CONFIG defines as poisoned, too, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 38/41] docs: create interop/ subdirectory, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 39/41] qemu-doc: include version number, Paolo Bonzini, 2017/06/15