From patchwork Thu Jun 15 10:52:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 776238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wpLNw6yvlz9s2s for ; Thu, 15 Jun 2017 21:09:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rgW1cprD"; dkim-atps=neutral Received: from localhost ([::1]:53197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSeM-00060I-Jf for incoming@patchwork.ozlabs.org; Thu, 15 Jun 2017 07:09:18 -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) 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) 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 += 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(); +}