From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVg5S-0004NX-Rq for qemu-devel@nongnu.org; Thu, 03 Apr 2014 07:45:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVg5L-0004jG-08 for qemu-devel@nongnu.org; Thu, 03 Apr 2014 07:45:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53182 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVg5K-0004ix-Lh for qemu-devel@nongnu.org; Thu, 03 Apr 2014 07:45:30 -0400 Message-ID: <533D49D8.3010601@suse.de> Date: Thu, 03 Apr 2014 13:45:28 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1396450668-12145-1-git-send-email-afaerber@suse.de> <20140403084624.GD27704@stefanha-thinkpad.redhat.com> In-Reply-To: <20140403084624.GD27704@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: pbonzini@redhat.com, Cam Macdonell , qemu-devel@nongnu.org, mst@redhat.com Am 03.04.2014 10:46, schrieb Stefan Hajnoczi: > On Wed, Apr 02, 2014 at 04:57:48PM +0200, Andreas F=E4rber wrote: >> +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 =3D g_strdup_printf("-device ivshmem,shm=3D%s,size=3D1M", "qt= est"); >=20 > This test leaks the "qtest" shm object that gets created by the first > QEMU process. The name is constant so two instances of the test cannot > run in parallel on the same machine (the objects go in /dev/shm). Right. Therefore it's already using %s and not a fully hardcoded string. > The name should be unique and we should clean up in both success and > failure (abort(3)) cases. The recipe for unique filenames elsewhere is mkstemp(), which I was planning to use here as well using "/dev/shm/qtest.XXXXXX" and then to somehow strip the /dev/shm/ part, e.g. &...[9]. However I do not see any existing test specially cleaning up such temporary files on SIGABRT rather than just on success. Do you have a pointer or suggestion how to do that? Still the actual question of this RFC is, how do I detect whether we may run this test at all? 1) Relying on being run in the build directory, we could try to peek at $arch-softmmu/config-target.mak, looking for CONFIG_KVM. Ugly. 2) Determine via QMP whether KVM is available in the QEMU binary. How? Involves an additional process before launching the actual process with -device ivshmem. 3) Determine via QMP whether the device QOM type is available in the QEMU binary. Involves an additional process. 4) Make ivshmem build independent of CONFIG_KVM. Too much work for a single out of many test cases. 5) ??? Thanks, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg