From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zpd0U-0008VF-Qp for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:07:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zpd0M-0004AI-OW for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:07:46 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:47802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zpd0K-00047q-HR for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:07:38 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Oct 2015 10:07:36 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 06E78C9003C for ; Fri, 23 Oct 2015 09:55:45 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9NE7X0256033432 for ; Fri, 23 Oct 2015 14:07:33 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9NE7XLW016039 for ; Fri, 23 Oct 2015 10:07:33 -0400 From: Michael Roth Date: Fri, 23 Oct 2015 09:07:13 -0500 Message-Id: <1445609233-13498-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1445609233-13498-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1445609233-13498-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 1/1] 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: peter.maydell@linaro.org, Michael Roth , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= QGA skips pseudo-filesystems when querying filesystems via guest-get-fsinfo. On some hosts, such as travis-ci which uses containers with simfs filesystems, QGA might not report *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é Lureau Cc: Peter Maydell Signed-off-by: Michael Roth --- 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 = qdict_get_qlist(ret, "return"); entry = 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), "mountpoint")); + 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