From nobody Tue Feb 10 05:10:42 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506467502983980.0540132440835; Tue, 26 Sep 2017 16:11:42 -0700 (PDT) Received: from localhost ([::1]:51419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwz0w-0002t8-6a for importer@patchew.org; Tue, 26 Sep 2017 19:11:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwywo-0007qV-RN for qemu-devel@nongnu.org; Tue, 26 Sep 2017 19:07:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwywl-0005PI-KN for qemu-devel@nongnu.org; Tue, 26 Sep 2017 19:07:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41342) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwywl-0005Oi-BK for qemu-devel@nongnu.org; Tue, 26 Sep 2017 19:07:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 740B07E42E for ; Tue, 26 Sep 2017 23:07:22 +0000 (UTC) Received: from localhost (ovpn-116-64.gru2.redhat.com [10.97.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC7A5779E9; Tue, 26 Sep 2017 23:07:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 740B07E42E Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:07:09 -0300 Message-Id: <20170926230709.22958-7-ehabkost@redhat.com> In-Reply-To: <20170926230709.22958-1-ehabkost@redhat.com> References: <20170926230709.22958-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Sep 2017 23:07:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 6/6] device-crash-test: Multi-device device_add test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , "Dr. David Alan Gilbert" , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When running device_add tests, test all devices in a single run instead of restarting QEMU every time. There's a plug_all testcase argument that can be used to make the test code plug all devices at once. I'm adding this mode because there's a crash that was detected while testing the script without any device_del command, but the crash goes away if we device_del every device immediately: $ ../scripts/device-crash-test ./x86_64-softmmu/qemu-system-x86_64 --quic= k -t method=3Ddevice_add --strict -t plug_all=3D1 INFO: running test case: binary=3D./x86_64-softmmu/qemu-system-x86_64 plu= g_all=3D1 accel=3Dkvm machine=3Dpc-0.12 device=3D* method=3Ddevice_add WARNING: qemu received signal -6: ./x86_64-softmmu/qemu-system-x86_64 -ch= ardev socket,id=3Dmon,path=3D/var/tmp/qemu-23578-monitor.sock -mon chardev= =3Dmon,mode=3Dcontrol -display none -vga none -S -machine pc-0.12,accel=3Dk= vm ERROR: result: binary=3D./x86_64-softmmu/qemu-system-x86_64 plug_all=3D1 = accel=3Dkvm machine=3Dpc-0.12 device=3D* method=3Ddevice_add ERROR: cmdline: ./x86_64-softmmu/qemu-system-x86_64 -S -machine pc-0.12,a= ccel=3Dkvm ERROR: log: audio: Could not init `oss' audio driver ERROR: log: qemu-system-x86_64: .../qemu/migration/savevm.c:721: vmstate_= register_with_alias_id: Assertion `!se->compat || se->instance_id =3D=3D 0'= failed. ERROR: last device_add device: usb-net ERROR: exit code: -6 ERROR: exception: ERROR: Traceback (most recent call last): ERROR: File "../scripts/device-crash-test", line 437, in checkOneCase ERROR: vm.command('device_add', driver=3Ddevice, id=3Ddevid) ERROR: File ".../qemu/scripts/qemu.py", line 269, in command ERROR: raise qmp.qmp.QMPError("Monitor is closed") ERROR: QMPError: Monitor is closed ERROR: INFO: Total: 1 test cases ERROR: Fatal failure: binary=3D./x86_64-softmmu/qemu-system-x86_64 plug_a= ll=3D1 accel=3Dkvm machine=3Dpc-0.12 device=3D* method=3Ddevice_add ERROR: Fatal failures on some machine/device combinations Signed-off-by: Eduardo Habkost --- scripts/device-crash-test | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 1245e214a0..43110fed15 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -404,10 +404,19 @@ def checkOneCase(args, testcase): assert method in ['-device', 'device_add'] =20 dbg("will test: %r", testcase) + if device =3D=3D '*': + bi =3D getBinaryInfo(args, binary) + if method =3D=3D '-device': + devices =3D list(bi.user_devs) + else: + devices =3D list(bi.hotpluggable_devs) + else: + devices =3D [device] =20 args =3D ['-S', '-machine', '%s,accel=3D%s' % (machine, accel)] if method =3D=3D '-device': - args.extend(['-device', qemuOptsEscape(device)]) + for device in devices: + args.extend(['-device', qemuOptsEscape(device)]) cmdline =3D ' '.join([binary] + args) dbg("will launch QEMU: %s", cmdline) vm =3D QEMUMachine(binary=3Dbinary, args=3Dargs) @@ -418,11 +427,27 @@ def checkOneCase(args, testcase): try: vm.launch() if method =3D=3D 'device_add': - dbg('running device_add %s', device) - try: - vm.command('device_add', driver=3Ddevice) - except MonitorResponseError, e: - r['device_add_error'] =3D e.reply['error']['desc'] + plug_all =3D int(testcase.get('plug_all', 0)) + for device in devices: + r['device_add_device'] =3D device + dbg('running device_add %s', device) + devid =3D 'test-%s' % (device) + try: + vm.command('device_add', driver=3Ddevice, id=3Ddevid) + if not plug_all: + vm.command('device_del', id=3Ddevid) + except MonitorResponseError, e: + r2 =3D r.copy() + r2['device_add_error'] =3D e.reply['error']['desc'] + yield r2 + + if plug_all: + for device in devices: + devid =3D 'test-%s' % (device) + vm.command('device_del', id=3Ddevid) + + except GeneratorExit: + raise except KeyboardInterrupt: raise except: @@ -458,7 +483,7 @@ def plugMethods(args, testcase): =20 def devicesToTest(args, testcase): if testcase['method'] =3D=3D 'device_add': - return getBinaryInfo(args, testcase['binary']).hotpluggable_devs + return '*' # will test all devices in a single checkOneCase() call else: return getBinaryInfo(args, testcase['binary']).user_devs =20 @@ -520,6 +545,8 @@ def logResult(f, level): logger.log(level, "cmdline: %s", f['cmdline']) for l in f.get('log', '').strip().split('\n'): logger.log(level, "log: %s", l) + if 'device_add_device' in f: + logger.log(level, 'last device_add device: %s', f['device_add_devi= ce']) if 'device_add_error' in f: logger.log(level, "device_add error: %s", f['device_add_error']) logger.log(level, "exit code: %r", f.get('exitcode')) --=20 2.13.5