From nobody Thu Nov 6 08:32:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497525023191760.764479304087; Thu, 15 Jun 2017 04:10:23 -0700 (PDT) Received: from localhost ([::1]:53203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSfN-0007Pa-MK for importer@patchew.org; Thu, 15 Jun 2017 07:10:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSOv-0008B1-6W for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLSOt-0007V7-La for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:21 -0400 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]:34050) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLSOt-0007Ui-Es for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:19 -0400 Received: by mail-wr0-x22e.google.com with SMTP id 77so16384326wrb.1 for ; Thu, 15 Jun 2017 03:53:19 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id f21sm3258597wra.5.2017.06.15.03.53.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 03:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=WlCS/ehTB9VJSGw02hKzhNioK62N5l4yq2+Ys1z2dw0=; b=rgW1cprDQH0B31299xYtbOCyD8+08ry8XkOHb+oKTo6UnBTU1k8eHtlIGhhUKK6h+r WRya18MtW155bfzt3fmG062oHbV6LXDUbiA4FiumDtKjHH0opZzzkA7OMV3iIn4Yvj++ vDv0pPChtMkfiuagDYQ/4newF2pLINPjfduoGgYoNy8nwOFVhPIjpTer2y+7YJ2WpNZf tF5fiEOun5NqnI/ku45R1CSzWiZmqewi/QIp2Hrg0q2kI/birBO5ASSVCDvmwfH7RAFh BieApNcKAncHW40CXVAdKtHlRmaFz5eQ7tsnAnFefM3Ign/JrOoy83hTl3q6Oi2wvowo hOWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=WlCS/ehTB9VJSGw02hKzhNioK62N5l4yq2+Ys1z2dw0=; b=gTxWtmkeYZ5d8F7HsP3WqDCbBDWZ7dTERiG3NM45Vo64wT91epHGEIdIuqkUclLAcU mw+Sd8uPUJXjsUNTz6NWFFxqm/BAFxxPXxJLkWP4FRLMj0f7X0j4b3s4nxIq7NLCAkK0 02Er342ondE3CXpnTdxFklRhKMzlAUZcA7v0Uj9bXRd0HSWxN9ZMUl5XKJ2XmmQG9r92 YJB1Jk97oXMKbAqsR67C4pbGXXyUPGj6oId4JlAcnQy+Pf6REqitvmj4LJA3Qw28/ifw 7/jDcS1fKCMggDTBVgXD58X8cJkUblx9yf+00Q/s+8JP2LmttHIk/VWGc7kyA4KC8z0u 6uDg== X-Gm-Message-State: AKS2vOzQpYKKQGLsBFu5qt46W/7xZeGXU8QNE6lS7qcP2WfxTdKpxrFf 3ri7TKILkuVQTdqJNA0= X-Received: by 10.223.168.6 with SMTP id l6mr3121524wrc.78.1497523998046; Thu, 15 Jun 2017 03:53:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Jun 2017 12:52:27 +0200 Message-Id: <1497523981-38449-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> References: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22e Subject: [Qemu-devel] [PULL 07/41] megasas: add qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- 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 +=3D tests/intel-hda-test$(EXESUF) gcov-files-pci-y +=3D hw/audio/intel-hda.c hw/audio/hda-codec.c check-qtest-pci-$(CONFIG_EVENTFD) +=3D tests/ivshmem-test$(EXESUF) gcov-files-pci-y +=3D hw/misc/ivshmem.c +check-qtest-pci-y +=3D tests/megasas-test$(EXESUF) +gcov-files-pci-y +=3D hw/scsi/megasas.c =20 check-qtest-i386-y =3D tests/endianness-test$(EXESUF) check-qtest-i386-y +=3D tests/fdc-test$(EXESUF) @@ -755,6 +757,7 @@ tests/test-filter-mirror$(EXESUF): tests/test-filter-mi= rror.o $(qtest-obj-y) tests/test-filter-redirector$(EXESUF): tests/test-filter-redirector.o $(qt= est-obj-y) tests/test-x86-cpuid-compat$(EXESUF): tests/test-x86-cpuid-compat.o $(qtes= t-obj-y) tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/i= vshmem-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/libvho= st-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 late= r. + * 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 =3D qtest_get_arch(); + const char *cmd =3D "-drive id=3Dhd0,if=3Dnone,file=3Dnull-co://,forma= t=3Draw " + "-device megasas,id=3Dscsi0,addr=3D04.0 " + "-device scsi-hd,bus=3Dscsi0.0,drive=3Dhd0 %s"; + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 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 =3D 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(); +} --=20 1.8.3.1