qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Cam Macdonell" <cam@cs.ualberta.ca>,
	"Andreas Färber" <afaerber@suse.de>,
	stefanha@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [RFC] tests: Add ivshmem qtest
Date: Wed,  2 Apr 2014 16:57:48 +0200	[thread overview]
Message-ID: <1396450668-12145-1-git-send-email-afaerber@suse.de> (raw)

Note that it launches two instances to as sharing memory is the purpose
of Nahanni/ivshmem.

Cc: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 This test demonstrates a use case of running two QEMU instances in qtest.

 However, similar to mst's proposed KVM acpi-test, it fails on systems
 without KVM support, and we cannot use $(CONFIG_KVM) to make it conditional
 since that is a per-target define rather than host-wide.

 I wonder if libqtest should expose an API to start a QEMU instance and
 inquire via QMP whether the executable supports KVM, returning true or false?

 tests/Makefile       |  3 +++
 tests/ivshmem-test.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 tests/ivshmem-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 6086f68..e4c3b12 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -137,6 +137,8 @@ check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
 check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
 gcov-files-i386-y += hw/pci-bridge/i82801b11.c
+check-qtest-i386-y += tests/ivshmem-test$(EXESUF)
+gcov-files-i386-y += i386-softmmu/hw/misc/ivshmem.c
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -287,6 +289,7 @@ tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
 tests/nvme-test$(EXESUF): tests/nvme-test.o
 tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
 tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
+tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 # QTest rules
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
new file mode 100644
index 0000000..e981ad3
--- /dev/null
+++ b/tests/ivshmem-test.c
@@ -0,0 +1,40 @@
+/*
+ * QTest testcase for Nahanni
+ *
+ * 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 <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* 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;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/ivshmem/nop", nop);
+
+    cmd = g_strdup_printf("-device ivshmem,shm=%s,size=1M", "qtest");
+    s1 = qtest_start(cmd);
+    s2 = qtest_start(cmd);
+    g_free(cmd);
+
+    ret = g_test_run();
+
+    qtest_quit(s1);
+    qtest_quit(s2);
+
+    return ret;
+}
-- 
1.8.4.5

             reply	other threads:[~2014-04-02 14:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 14:57 Andreas Färber [this message]
2014-04-02 15:06 ` [Qemu-devel] [RFC] tests: Add ivshmem qtest Michael S. Tsirkin
2014-04-02 15:07   ` Andreas Färber
2014-04-02 15:15     ` Michael S. Tsirkin
2014-04-02 15:15       ` Paolo Bonzini
2014-04-03 11:16         ` Michael S. Tsirkin
2014-04-03 11:23           ` Andreas Färber
2014-04-03 13:33             ` Michael S. Tsirkin
2014-04-03  8:46 ` Stefan Hajnoczi
2014-04-03 11:45   ` Andreas Färber
2014-04-03 12:58     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396450668-12145-1-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=cam@cs.ualberta.ca \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).