From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ReprG-00005Y-9K for qemu-devel@nongnu.org; Sun, 25 Dec 2011 10:19:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ReprE-0005oW-Ka for qemu-devel@nongnu.org; Sun, 25 Dec 2011 10:19:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ReprE-0005oS-DJ for qemu-devel@nongnu.org; Sun, 25 Dec 2011 10:19:28 -0500 Message-ID: <4EF73EF5.8050606@redhat.com> Date: Sun, 25 Dec 2011 17:19:17 +0200 From: Dor Laor MIME-Version: 1.0 References: <4EEF70B4.3070109@us.ibm.com> In-Reply-To: <4EEF70B4.3070109@us.ibm.com> Content-Type: multipart/mixed; boundary="------------020805050601090602050509" Subject: Re: [Qemu-devel] [ANNOUNCE] qemu-test: a set of tests scripts for QEMU Reply-To: dlaor@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: "lmr@redhat.com" , Gerd Hoffmann , qemu-devel , Stefan Hajnoczi This is a multi-part message in MIME format. --------------020805050601090602050509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 12/19/2011 07:13 PM, Anthony Liguori wrote: > Hi, > > I've published a set of tests I wrote over the weekend on qemu.org. My > motivations were 1) to prevent regressions like the libguestfs one and > 2) to have an easier way to do development testing as I work on QEMU > Object Model. > > Now before sending the obligatory, "What about using KVM autotest" > reply, note that this is significantly different than KVM autotest and > really occupies a different use-case. Well, I'm still not convinced that a new standalone package should handle these cases instead of kvm autotest. I'll be happy to integrate the tests to kvm autotest anyway and the more the merrier but imho it's a duplicate. kvm-unit-test is a case for unit tests since it replaces the guest kernel itself and test for really low level tests like task switch, instruction emulation, etc. > > It has the following characteristics: > > 1) It builds a custom kernel and initramfs based on busybox. This is > fairly important to ensure that we can run tests with no device > pre-requisites. This can be done easily w/ autotest too. > > 2) Tests are scripts that are launched in the initramfs > > 3) The test controls exactly how QEMU is launched which allows easy > testing of various QEMU options afaik kvm autotest do the same. It's true that kvm autotest might look less friendly but its may only be this way since it has lots of options. > > 4) Tests can interact with the monitor via QMP while the test is running ditto for kvm autotest > > 5) The tests execute very quickly, can be run stand alone, and do not > require root privileges ditto for kvm auotest. It's possible to configure it w/o root too which is not a huge issue. Please compare your own virtio-serial test w/ the autotest version of it: https://github.com/autotest/autotest/blob/master/client/tests/kvm/tests/virtio_console.py This single file tests functionality, limits, console, live migration and performance. Of course one can add a very basic 'hello world' sanity test too that will run quickly and will identify basic breakage fast. Noways we abstract kvm autotest so libvirt will be optionally tested too w/ the same tests. Again, I'm not advocating that kvm autotest is a solution for anything but for plain guest-host communication, monitor commands, etc it's a really good tool. I agree that kvm autotest may be less friendly for developer users since it carries allot of options for testing a huge matrix. Lucas and Cleber are working these days to add a make kvmautotest target to qemu so one would be able to quickly execute autotest and we can think of additional parameters like sanity-set, migration-set, etc. > > 6) They are random by nature with the ability to fix the seed in order > to be used in git-bisect. > > I think Gerd had been looking at doing something similar with a custom > initrd. > > I've tried to consider other architectures and had hoped that we could > commit the vmlinuz and initramfs into git so that it was easy to test > other architectures without having a full build environment. > Unfortunately, busybox doesn't link statically with glibc and I can't > see an obvious way to commit binaries while respecting the GPL since we > need to pull glibc into the initramfs. > > I know buildroot exists specifically to deal with this but in my > experience, buildroot is very unreliable and extremely heavy weight > since it rebuilds gcc multiple times in order to bootstrap a ulibc > environment. > > Anyway, the code is available at: > > http://git.qemu.org/qemu-test.git > > See the README for instructions on how to use it. > > Regards, > > Anthony Liguori > --------------020805050601090602050509 Content-Type: message/rfc822; name="Attached Message" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Attached Message" Return-Path: qemu-devel-bounces+dlaor=redhat.com@nongnu.org Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by zmail15.collab.prod.int.phx2.redhat.com with LMTP; Thu, 22 Dec 2011 09:23:49 -0500 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8FB41D8005 for ; Thu, 22 Dec 2011 09:23:49 -0500 (EST) Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1]) by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CkvIxrwH4YH2 for ; Thu, 22 Dec 2011 09:23:49 -0500 (EST) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7B661D8007 for ; Thu, 22 Dec 2011 09:23:49 -0500 (EST) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBMENnKq031120 for ; Thu, 22 Dec 2011 09:23:49 -0500 Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBMENif1025578 for ; Thu, 22 Dec 2011 09:23:45 -0500 Received: from localhost ([::1]:42172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdjYe-0006Pj-HN for dlaor@redhat.com; Thu, 22 Dec 2011 09:23:44 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdjYU-0006P8-Uq for qemu-devel@nongnu.org; Thu, 22 Dec 2011 09:23:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdjYP-0005zw-B2 for qemu-devel@nongnu.org; Thu, 22 Dec 2011 09:23:34 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:37585 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdjYO-0005zj-Uo for qemu-devel@nongnu.org; Thu, 22 Dec 2011 09:23:29 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pBMENQbV004322; Thu, 22 Dec 2011 08:23:26 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id pBMENPDH004320; Thu, 22 Dec 2011 08:23:25 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Thu, 22 Dec 2011 08:23:25 -0600 Message-Id: <1324563805-4285-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH] qemu-test: add virtio-serial test 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+dlaor=redhat.com@nongnu.org Sender: qemu-devel-bounces+dlaor=redhat.com@nongnu.org X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 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 --- 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 --------------020805050601090602050509--