From patchwork Mon Oct 12 16:40:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 529202 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 97047140D8F for ; Tue, 13 Oct 2015 03:43:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Nx1QrJiw; dkim-atps=neutral Received: from localhost ([::1]:56606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgCZ-0008HE-EL for incoming@patchwork.ozlabs.org; Mon, 12 Oct 2015 12:43:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgB7-00060S-Ku for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlgB4-0000wi-9P for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:42:25 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:33655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgB4-0000wZ-4b for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:42:22 -0400 Received: by pabrc13 with SMTP id rc13so23358547pab.0 for ; Mon, 12 Oct 2015 09:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=TnvicQIOdTGpIIfWnm+HjLbrP46rP0CkVxEBBPLFTWM=; b=Nx1QrJiwr3cLQX8RkGEhY2spi0/mmrsXmXGjWfH3LNIBuRjqtvCe6ZmPDrQ0ZEjT5x KOedmbUWSnV4bk/aBXQqUC52kLGpA2r/g2E50Y/LaLPOEd8Wg6NTZbFEOkaQVVMVzb7i MnGgeXW/dFQC+lunY31Jk4fma27kGeQOOwgnfw3F4epa6/PDN2NV3kVIrLwjaUevbRpF BDN/YweXf/3jCQjBMQlMt/ZVZ4XlkZ/WePIeXpZdtib3fwg3JT3PwRU5lnbv6VmVoHpt nDSd9KL8Kth5RGcaf/CvRKZQxpyLEwCS18hGGNv7vJrFLL/eos34av32Kx3ryOJ7JdVC PE+Q== X-Received: by 10.66.158.233 with SMTP id wx9mr24020490pab.157.1444668141486; Mon, 12 Oct 2015 09:42:21 -0700 (PDT) Received: from localhost (APoitiers-257-1-35-234.w90-38.abo.wanadoo.fr. [90.38.210.234]) by smtp.gmail.com with ESMTPSA id yq2sm19272377pbb.39.2015.10.12.09.42.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 09:42:20 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Mon, 12 Oct 2015 18:40:55 +0200 Message-Id: <1444668104-22955-2-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444668104-22955-1-git-send-email-marcandre.lureau@redhat.com> References: <1444668104-22955-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22a Cc: peter.maydell@linaro.org, drjones@redhat.com, claudio.fontana@huawei.com, stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, cam@cs.ualberta.ca, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PULL v2 01/50] tests: Add ivshmem qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Andreas Färber Note that it launches two instances, as sharing memory is the purpose of ivshmem. Cc: Cam Macdonell Cc: Marc-André Lureau Signed-off-by: Andreas Färber [ Remove Nahanni codename, add test to pci set - Marc-André ] Signed-off-by: Marc-André Lureau --- tests/Makefile | 3 +++ tests/ivshmem-test.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/ivshmem-test.c diff --git a/tests/Makefile b/tests/Makefile index dbd32a6..c44b8de 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -149,6 +149,8 @@ gcov-files-pci-y += hw/display/virtio-gpu-pci.c gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c 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_IVSHMEM) += tests/ivshmem-test$(EXESUF) +gcov-files-pci-y += hw/misc/ivshmem.c check-qtest-i386-y = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF) @@ -440,6 +442,7 @@ tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_hel tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y) tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y) tests/test-netfilter$(EXESUF): tests/test-netfilter.o $(qtest-obj-y) +tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o ifeq ($(CONFIG_POSIX),y) LIBS += -lutil diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c new file mode 100644 index 0000000..2f6bec8 --- /dev/null +++ b/tests/ivshmem-test.c @@ -0,0 +1,51 @@ +/* + * QTest testcase for ivshmem + * + * Copyright (c) 2014 SUSE LINUX Products GmbH + * + * 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 +#include +#include +#include +#include "libqtest.h" +#include "qemu/osdep.h" + +static char dev_shm_path[] = "/dev/shm/qtest.XXXXXX"; + +/* Tests only initialization so far. TODO: Replace with functional tests */ +static void nop(void) +{ +} + +int main(int argc, char **argv) +{ + QTestState *s1, *s2; + char *cmd; + int ret, fd; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/ivshmem/nop", nop); + + fd = mkstemp(dev_shm_path); + g_assert(fd >= 0); + close(fd); + unlink(dev_shm_path); + + cmd = g_strdup_printf("-device ivshmem,shm=%s,size=1M", &dev_shm_path[9]); + s1 = qtest_start(cmd); + s2 = qtest_start(cmd); + g_free(cmd); + + ret = g_test_run(); + + qtest_quit(s1); + qtest_quit(s2); + + unlink(dev_shm_path); + + return ret; +}