From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH] qemu-test: add virtio-serial test
Date: Thu, 22 Dec 2011 08:23:25 -0600 [thread overview]
Message-ID: <1324563805-4285-1-git-send-email-aliguori@us.ibm.com> (raw)
This is a pretty simple test that just confirms that virtio-serial shows up and
is writable. It also tests the alias for virtio-serial-pci.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
tests/virtio-serial.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100755 tests/virtio-serial.sh
diff --git a/tests/virtio-serial.sh b/tests/virtio-serial.sh
new file mode 100755
index 0000000..e95ae6e
--- /dev/null
+++ b/tests/virtio-serial.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+canary="** waiting for... **"
+
+in_host() {
+ tmpchr=$tmpdir/chr.log
+
+ # Also test alias
+ devname=`choose virtio-serial virtio-serial-pci`
+
+ qemu -nographic -enable-kvm -device $devname \
+ -device virtserialport,name=org.qemu.test,chardev=chr0 \
+ -chardev file,path=$tmpchr,id=chr0
+ rc=$?
+
+ if test $rc = 0; then
+ if ! grep "$canary" $tmpchr >/dev/null; then
+ echo "Failed to see output from guest!"
+ rc=1
+ fi
+ fi
+
+ rm -f $tmpchr
+
+ return $rc
+}
+
+in_guest() {
+ sysfspath=/sys/bus/virtio/devices/virtio0/virtio-ports/vport0p1
+ if ! test -e $sysfspath/name; then
+ echo "Device not visible!"
+ return 1
+ fi
+
+ name=`cat $sysfspath/name`
+
+ if test "$name" != "org.qemu.test"; then
+ echo "Device has wrong name!"
+ echo "Expected 'org.qemu.test', got '$name'"
+ return 2
+ fi
+
+ echo "$canary" > /dev/vport0p1
+
+ return 0
+}
+
+if test $QEMU_TEST; then
+ in_host
+else
+ in_guest
+fi
--
1.7.4.1
next reply other threads:[~2011-12-22 14:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 14:23 Anthony Liguori [this message]
2011-12-22 15:46 ` [Qemu-devel] [PATCH] qemu-test: add virtio-serial test Alex Bradbury
2011-12-22 15:58 ` Eric Blake
2011-12-22 16:20 ` Alex Bradbury
2011-12-22 16:55 ` Anthony Liguori
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=1324563805-4285-1-git-send-email-aliguori@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/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).