From nobody Wed Nov 5 17:43:26 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; 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 1496751606186112.18925704460048; Tue, 6 Jun 2017 05:20:06 -0700 (PDT) Received: from localhost ([::1]:38141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIDSp-0003OX-3g for importer@patchew.org; Tue, 06 Jun 2017 08:19:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIDQu-0001tP-Gu for qemu-devel@nongnu.org; Tue, 06 Jun 2017 08:18:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIDQp-0005Ec-Tj for qemu-devel@nongnu.org; Tue, 06 Jun 2017 08:18:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIDQp-0005EJ-Kl for qemu-devel@nongnu.org; Tue, 06 Jun 2017 08:17:55 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 050F6C0587D8; Tue, 6 Jun 2017 12:17:54 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-248.ams2.redhat.com [10.36.117.248]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v56CHmM9003973; Tue, 6 Jun 2017 08:17:52 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 050F6C0587D8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 050F6C0587D8 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 14:17:41 +0200 Message-Id: <20170606121747.25356-2-pbonzini@redhat.com> In-Reply-To: <20170606121747.25356-1-pbonzini@redhat.com> References: <20170606121747.25356-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 06 Jun 2017 12:17:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/7] 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: , Cc: zyy4013@stu.ouc.edu.cn, hare@suse.de, ppandit@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The test does nothing at all except starting QEMU, but it's a start. 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 75893838e5..eb6b724ed6 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) @@ -753,6 +755,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 0000000000..a9e56a2389 --- /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 2.13.0