From nobody Fri Nov 7 14:33:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548094132501140.98552141549044; Mon, 21 Jan 2019 10:08:52 -0800 (PST) Received: from localhost ([127.0.0.1]:57366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gle0B-0005iT-4a for importer@patchew.org; Mon, 21 Jan 2019 13:08:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gldy3-0004If-Rf for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gldy1-00044I-RS for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:39 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:39488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gldy1-00041t-Hn for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:37 -0500 Received: by mail-wm1-x334.google.com with SMTP id y8so11690349wmi.4 for ; Mon, 21 Jan 2019 10:06:36 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 133sm56197732wme.9.2019.01.21.10.06.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jan 2019 10:06:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=My0RoaouMo780IeBcuxO/CcgZR3A6nSoUQGH8ZSKMMM=; b=aQaD4GKk6ANd8htN6O6ZjI4qHrPM1IVpMoLCYtADG9of/J3njNIcyOCp9WrPaSFSjK 4cVn/pUHY7r3GM33tRMTFcKQYiwk9wkxBHydchlkbg1pqL56CBgvcJooMYU3+eyJ7WHT iA5vzXsTIIMKeTVm7uy323i11xPCyfukUlaSxPuBdUbGwH8hNsD3CH+T14zvaMfK7Vhi si4djjFMUR2IHETKFKjzyRyl9NBRzG0LnDQzsDlFBhR8q5M73TMN6MR3JyNCkmJ53ZYc AtSP4jhJGfPfVsmpSlO8HtoRFeydSDYXq0wAC8vKdat2exdTvJR2SDZkPIXtPyLwQ6wX Sdug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=My0RoaouMo780IeBcuxO/CcgZR3A6nSoUQGH8ZSKMMM=; b=pi4SPSkOqt5XQwy5P/cEAyIgdQBvIptdFVWmUHLBz1uhi/7XzXBOSITx/5xRnK7Sz8 XMNTBrQ+Ao2l4Ll2228rQuVjgtUYALv0WyHWZZafM6ctPdL0YZqezE6bPbRZAVTWYKcH bbQHrdQidKJ3GU5FOa9yrgYF7ytCKYBBgqJAx7TclOjxaOG9xay94UIsF7MimRGZILmW 3zsd831nBM8WPsxxP6uEAXRskx3eqZlYDdFKRzvoqEtdNH7506ChBcjoQdR7/z5OBIi3 Or4DNhwDRdvyNDEOsY4b2JPhet7zLeCHTROHAPcsCYIbXI6dHM41MPM3uQtbZnjgswiJ VoIg== X-Gm-Message-State: AJcUukcpSw9xAwinaH8rsInTWi/2PmwBIttsmfTsMJNy7hR76MasR9Sh hIKv/aaZm+F67gdRfObyGuZtCGgL X-Google-Smtp-Source: ALg8bN4n6gh3AzkWKwWJh6qOXmWj5Qa11ajOH+Ix4+PvqL0oyhPOVhuNZyHH3HwFQOb/bqdErB8Stw== X-Received: by 2002:a1c:4046:: with SMTP id n67mr369405wma.123.1548093995243; Mon, 21 Jan 2019 10:06:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Jan 2019 19:05:43 +0100 Message-Id: <1548093980-43088-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> References: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 12/49] vhost-user-test: skip if there is no memory at address 0 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The virt machine cannot run the vhost-user qtests because they hardcode the presence of memory at address 0. Report the tests as a skip so that they can be converted to use qgraph. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-11-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 58 ++++++++++++++++++++++++++++++++++++++-------= ---- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index e36f3e6..30b0aba 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -231,9 +231,11 @@ static void uninit_virtio_dev(TestServer *s) qvirtio_pci_device_free(s->dev); } =20 -static void wait_for_fds(TestServer *s) +static bool wait_for_fds(TestServer *s) { gint64 end_time; + bool got_region; + int i; =20 g_mutex_lock(&s->data_mutex); =20 @@ -251,6 +253,19 @@ static void wait_for_fds(TestServer *s) g_assert_cmpint(s->fds_num, =3D=3D, s->memory.nregions); =20 g_mutex_unlock(&s->data_mutex); + + got_region =3D false; + for (i =3D 0; i < s->memory.nregions; ++i) { + VhostUserMemoryRegion *reg =3D &s->memory.regions[i]; + if (reg->guest_phys_addr =3D=3D 0) { + got_region =3D true; + break; + } + } + if (!got_region) { + g_test_skip("No memory at address 0x0"); + } + return got_region; } =20 static void read_guest_mem_server(TestServer *s) @@ -259,8 +274,6 @@ static void read_guest_mem_server(TestServer *s) int i, j; size_t size; =20 - wait_for_fds(s); - g_mutex_lock(&s->data_mutex); =20 /* iterate all regions */ @@ -582,8 +595,6 @@ static void write_guest_mem(TestServer *s, uint32_t see= d) int i, j; size_t size; =20 - wait_for_fds(s); - /* iterate all regions */ for (i =3D 0; i < s->fds_num; i++) { =20 @@ -666,8 +677,13 @@ static void test_read_guest_mem(const void *arg) =20 init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC); =20 + if (!wait_for_fds(server)) { + goto exit; + } + read_guest_mem_server(server); =20 +exit: uninit_virtio_dev(server); =20 qtest_quit(s); @@ -694,8 +710,10 @@ static void test_migrate(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + size =3D get_log_size(s); g_assert_cmpint(size, =3D=3D, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)= ); =20 @@ -704,6 +722,7 @@ static void test_migrate(void) g_free(tmp); to =3D qtest_init(cmd); g_free(cmd); + init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); =20 source =3D g_source_new(&test_migrate_source_funcs, sizeof(TestMigrateSource)); @@ -743,15 +762,18 @@ static void test_migrate(void) global_qtest =3D to; qmp_eventwait("RESUME"); =20 + g_assert(wait_for_fds(s)); read_guest_mem_server(dest); =20 - uninit_virtio_dev(s); uninit_virtio_dev(dest); + qtest_quit(to); =20 g_source_destroy(source); g_source_unref(source); =20 - qtest_quit(to); +exit: + uninit_virtio_dev(s); + test_server_free(dest); qtest_quit(from); test_server_free(s); @@ -815,16 +837,20 @@ static void test_reconnect_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + wait_for_rings_started(s, 2); =20 /* reconnect */ s->fds_num =3D 0; s->rings =3D 0; g_idle_add(reconnect_cb, s); - wait_for_fds(s); + g_assert(wait_for_fds(s)); wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); @@ -853,9 +879,12 @@ static void test_connect_fail_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); @@ -883,9 +912,12 @@ static void test_flags_mismatch_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); --=20 1.8.3.1