From patchwork Wed Aug 17 12:07:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 9285753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0694F6086A for ; Wed, 17 Aug 2016 12:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 018E029089 for ; Wed, 17 Aug 2016 12:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA71429090; Wed, 17 Aug 2016 12:08:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99AB929089 for ; Wed, 17 Aug 2016 12:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547AbcHQMIF (ORCPT ); Wed, 17 Aug 2016 08:08:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34926 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633AbcHQMIC (ORCPT ); Wed, 17 Aug 2016 08:08:02 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 E880B85376 for ; Wed, 17 Aug 2016 12:08:01 +0000 (UTC) Received: from dhcp-27-118.brq.redhat.com (dhcp-27-122.brq.redhat.com [10.34.27.122]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7HC7i9v028577; Wed, 17 Aug 2016 08:08:01 -0400 From: Alexander Gordeev To: kvm@vger.kernel.org Cc: Alexander Gordeev , Thomas Huth , Andrew Jones Subject: [kvm-unit-tests PATCH v7 13/13] arm/arm64: pci: Add pci-testdev PCI device operation test Date: Wed, 17 Aug 2016 14:07:14 +0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 17 Aug 2016 12:08:01 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Suggested-by: Andrew Jones Cc: Thomas Huth Cc: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Alexander Gordeev --- arm/Makefile.common | 1 + arm/pci-test.c | 8 ++++++++ arm/run | 7 ++++++- arm/unittests.cfg | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arm/Makefile.common b/arm/Makefile.common index 97179bbea4e7..f37b5c2a3de4 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -36,6 +36,7 @@ cflatobjs += lib/alloc.o cflatobjs += lib/devicetree.o cflatobjs += lib/pci.o cflatobjs += lib/pci-host-generic.o +cflatobjs += lib/pci-testdev.o cflatobjs += lib/virtio.o cflatobjs += lib/virtio-mmio.o cflatobjs += lib/chr-testdev.o diff --git a/arm/pci-test.c b/arm/pci-test.c index daebdafceb60..10a367de5357 100644 --- a/arm/pci-test.c +++ b/arm/pci-test.c @@ -8,12 +8,20 @@ #include #include +#define NR_TESTS (PCI_TESTDEV_NUM_BARS * PCI_TESTDEV_NUM_TESTS) + int main(void) { + int ret; + if (!pci_probe()) report_abort("PCI bus probing failed\n"); pci_print(); + ret = pci_testdev(); + report("PCI test device passed %d/%d tests", + ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS); + return report_summary(); } diff --git a/arm/run b/arm/run index a2f35ef6a7e6..1ee6231599d6 100755 --- a/arm/run +++ b/arm/run @@ -67,8 +67,13 @@ fi chr_testdev='-device virtio-serial-device' chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd' +pci_testdev= +if $qemu $M -device '?' 2>&1 | grep pci-testdev > /dev/null; then + pci_testdev="-device pci-testdev" +fi + M+=",accel=$ACCEL" -command="$qemu $M -cpu $processor $chr_testdev" +command="$qemu $M -cpu $processor $chr_testdev $pci_testdev" command+=" -display none -serial stdio -kernel" command="$(timeout_cmd) $command" echo $command "$@" diff --git a/arm/unittests.cfg b/arm/unittests.cfg index ffd12e5794aa..20ffa0493c4c 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -51,3 +51,7 @@ file = selftest.flat smp = $MAX_SMP extra_params = -append 'smp' groups = selftest + +[pci-test] +file = pci-test.flat +groups = pci