From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZovBW-0003Qs-2X for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:20:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZovBQ-0006uY-SS for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:20:14 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:47906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZovBQ-0006uB-KW for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:20:08 -0400 Received: from localhost by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Oct 2015 09:20:07 -0600 Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 167FD38C804F for ; Wed, 21 Oct 2015 11:20:05 -0400 (EDT) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9LFK4YV55509152 for ; Wed, 21 Oct 2015 15:20:04 GMT Received: from d01av05.pok.ibm.com (localhost [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9LFJMxX013810 for ; Wed, 21 Oct 2015 11:19:23 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1445359759-7575-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1445359759-7575-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-ID: <20151021151947.18764.50381@loki> Date: Wed, 21 Oct 2015 10:19:47 -0500 Subject: Re: [Qemu-devel] [PATCH] tests: test-qga, loosen assumptions about host filesystems List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Peter Maydell Quoting Michael Roth (2015-10-20 11:49:19) > QGA skips pseudo-filesystems when querying filesystems via > guest-get-fsinfo. On some hosts, such as travis-ci which uses > containers which simfs filesystems, QGA might not reports *any* > filesystems. Our test case assumes there would be at least one, > leading to false error messages in these situations. > = > Instead, sanity-check values iff we get at least one filesystem. > = > Cc: Marc-Andr=C3=A9 Lureau > Cc: Peter Maydell > Signed-off-by: Michael Roth Applied with some spelling fixes: https://github.com/mdroth/qemu/commits/qga > --- > tests/test-qga.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > = > diff --git a/tests/test-qga.c b/tests/test-qga.c > index 0531c9f..6473846 100644 > --- a/tests/test-qga.c > +++ b/tests/test-qga.c > @@ -273,13 +273,15 @@ static void test_qga_get_fsinfo(gconstpointer fix) > g_assert_nonnull(ret); > qmp_assert_no_error(ret); > = > - /* check there is at least a fs */ > + /* sanity-check the response if there are any filesystems */ > list =3D qdict_get_qlist(ret, "return"); > entry =3D qlist_first(list); > - g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name")); > - g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoint")); > - g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type")); > - g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk")); > + if (entry) { > + g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name")); > + g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoin= t")); > + g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type")); > + g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk")); > + } > = > QDECREF(ret); > } > -- = > 1.9.1 >=20