From nobody Tue May 21 07:45:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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 ARC-Seal: i=1; a=rsa-sha256; t=1578490632; cv=none; d=zohomail.com; s=zohoarc; b=TUvcDa2KKerOf5dvDHPZxmad/AR67h0xqR7BXJaxrzVVnhUh/o4PGob0k6+NXnfjaBg8sdJ8CLKmZ7FMwoMDxp4pai35nQQu9U3YbSMfnO+gasBBGvHs/ptzdKvd0k/C8xTksXvWjJVeVzeKJYQ7q1rbIuLwwDHfUJUh1/d3Ba0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578490632; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6xRyv19a65AkckLvk7hDMNMBMxxO7kHnyttZlntZGko=; b=lg564iIrlVHdrc2icCtbiOVqIDUhbTyvGkD91HG0GF9bvFMGHQXxdrbzPa7YmCT/nBoWrkuZvN/2FdW3msxvwB+jctIt+nhPNOm9aubo+LAEumOJcnxGA/hqckctSko/3WQwcmOnM/aALnx+Xn3f3/t4B2VquQs/ZpRQxeKNiCY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578490632662434.4698191737083; Wed, 8 Jan 2020 05:37:12 -0800 (PST) Received: from localhost ([::1]:44004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipBWJ-0000Fe-EL for importer@patchew.org; Wed, 08 Jan 2020 08:37:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43630) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipBVA-0007Jp-5m for qemu-devel@nongnu.org; Wed, 08 Jan 2020 08:36:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipBV8-0004jK-OA for qemu-devel@nongnu.org; Wed, 08 Jan 2020 08:36:00 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:38626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipBV8-0004i6-Hm for qemu-devel@nongnu.org; Wed, 08 Jan 2020 08:35:58 -0500 Received: by mail-wm1-x32c.google.com with SMTP id u2so2524713wmc.3 for ; Wed, 08 Jan 2020 05:35:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id f1sm3028235wmc.45.2020.01.08.05.35.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2020 05:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6xRyv19a65AkckLvk7hDMNMBMxxO7kHnyttZlntZGko=; b=b0LgB9cQlZUFZRI8vhFVOmEzO8rIU8yblKaABNzhbBE61tbuIQ8uiyTM482H7Mr3FZ zZ45LZFL1vEPk0xt6FkTQu1aG8lDNLZy72ZuLQWvY0dO4jlDT56HkiBNH4M7ZQDViOBR mFgMEhVO0wTl7fWasmtLVewg0rqShpUaAfbJOaUQgFa4lO69B5Fbns58tcXnmMe5WcNr fg/aigH9WTw/9PZfw5DIie5SAdSHIGyBZDbp19/8LiAcTqLIQobX7N0LEqlFHCS52rXC 0+LrcvI+sFulecVDHhv6bO3Khv/wFuv31k9EGTN/LW1OzI0a642w43LeAfxpUnWjrJHR ikiw== 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:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=6xRyv19a65AkckLvk7hDMNMBMxxO7kHnyttZlntZGko=; b=nTGrxcg/fo1uBt9s9bdrZMbm9Yj03mSX89PA0lrZu+nJVa4FGn0qK35j6OLT3Nbz/V f9Z7MZY4mMgtqc63Qs173EbmCO66E6KXsH3mnFBc2YYfB9vOJzDcFHj1OmZ3605TFES3 v1BHnkJJQR3i/FUfwdSONiP3rxowiE5Ywzz9MIMRWcLs+sYhaMH4DsX85uyQIBOsRu6i nFN4pH8xQ9DU7NunmcvcjeN0ZUXv0/3W5R7mYduEwKR/P5aJSy9jdsNrUX3I0mAK2lsn 8iDz6OXOIpEkJFOzpg9ANT0PjL9NggjpDjWtYQ7Zb+REyQoRIdDC0ufDVsV2PSl7VDjj YhfA== X-Gm-Message-State: APjAAAXr2JszyURZy6OVnKy1F+UnhP81tB+Gf70BQy1HBwalVVE08rLo xR03Y1yELHaykJDxcTM3LzcrfCwz X-Google-Smtp-Source: APXvYqwhO5hUMd7rAEL8M+4M7sh8HysGcflo0kjlwsiXKttdTinj2YcLFdfKSbnHz/1aQTYIzb6EGw== X-Received: by 2002:a7b:cf01:: with SMTP id l1mr3777928wmg.86.1578490556850; Wed, 08 Jan 2020 05:35:56 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2] tests: fix test-qga on macosx Date: Wed, 8 Jan 2020 14:35:55 +0100 Message-Id: <1578490555-6363-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 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::32c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Fix Unix socket connection & skip commands that are not implemented. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- tests/Makefile.include | 2 +- tests/test-qga.c | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 49e3b0d..192a08e 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -119,7 +119,7 @@ check-unit-$(CONFIG_BLOCK) +=3D tests/test-crypto-secre= t$(EXESUF) check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) +=3D tests/test-c= rypto-tlscredsx509$(EXESUF) check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) +=3D tests/test-c= rypto-tlssession$(EXESUF) ifneq (,$(findstring qemu-ga,$(TOOLS))) -check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) +=3D tests= /test-qga$(EXESUF) +check-unit-$(call land,$(CONFIG_POSIX),$(CONFIG_VIRTIO_SERIAL)) +=3D tests= /test-qga$(EXESUF) endif check-unit-y +=3D tests/test-timed-average$(EXESUF) check-unit-$(CONFIG_INOTIFY1) +=3D tests/test-util-filemonitor$(EXESUF) diff --git a/tests/test-qga.c b/tests/test-qga.c index d2b2435..191bfca 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -17,17 +17,17 @@ typedef struct { =20 static int connect_qga(char *path) { - int s, ret, len, i =3D 0; + int s, ret, i =3D 0; struct sockaddr_un remote; =20 s =3D socket(AF_UNIX, SOCK_STREAM, 0); g_assert(s !=3D -1); =20 + memset(&remote, 0, sizeof(struct sockaddr_un)); remote.sun_family =3D AF_UNIX; do { - strcpy(remote.sun_path, path); - len =3D strlen(remote.sun_path) + sizeof(remote.sun_family); - ret =3D connect(s, (struct sockaddr *)&remote, len); + strncpy(remote.sun_path, path, sizeof(remote.sun_path) - 1); + ret =3D connect(s, (struct sockaddr *)&remote, sizeof(struct socka= ddr_un)); if (ret =3D=3D -1) { g_usleep(G_USEC_PER_SEC); } @@ -305,6 +305,7 @@ static void test_qga_info(gconstpointer fix) qobject_unref(ret); } =20 +#if defined(CONFIG_LINUX) static void test_qga_get_vcpus(gconstpointer fix) { const TestFixture *fixture =3D fix; @@ -324,7 +325,9 @@ static void test_qga_get_vcpus(gconstpointer fix) =20 qobject_unref(ret); } +#endif =20 +#if defined(CONFIG_LINUX) static void test_qga_get_fsinfo(gconstpointer fix) { const TestFixture *fixture =3D fix; @@ -348,6 +351,7 @@ static void test_qga_get_fsinfo(gconstpointer fix) =20 qobject_unref(ret); } +#endif =20 static void test_qga_get_memory_block_info(gconstpointer fix) { @@ -394,6 +398,7 @@ static void test_qga_get_memory_blocks(gconstpointer fi= x) qobject_unref(ret); } =20 +#if defined(CONFIG_LINUX) static void test_qga_network_get_interfaces(gconstpointer fix) { const TestFixture *fixture =3D fix; @@ -412,6 +417,7 @@ static void test_qga_network_get_interfaces(gconstpoint= er fix) =20 qobject_unref(ret); } +#endif =20 static void test_qga_file_ops(gconstpointer fix) { @@ -682,7 +688,7 @@ static void test_qga_blacklist(gconstpointer data) qobject_unref(ret); =20 /* check something work */ - ret =3D qmp_fd(fix.fd, "{'execute': 'guest-get-fsinfo'}"); + ret =3D qmp_fd(fix.fd, "{'execute': 'guest-info'}"); qmp_assert_no_error(ret); qobject_unref(ret); =20 @@ -766,6 +772,7 @@ static void test_qga_config(gconstpointer data) g_key_file_free(kf); } =20 +#if defined(CONFIG_LINUX) static void test_qga_fsfreeze_status(gconstpointer fix) { const TestFixture *fixture =3D fix; @@ -781,6 +788,7 @@ static void test_qga_fsfreeze_status(gconstpointer fix) =20 qobject_unref(ret); } +#endif =20 static void test_qga_guest_exec(gconstpointer fix) { @@ -976,12 +984,17 @@ int main(int argc, char **argv) g_test_add_data_func("/qga/sync", &fix, test_qga_sync); g_test_add_data_func("/qga/ping", &fix, test_qga_ping); g_test_add_data_func("/qga/info", &fix, test_qga_info); +#if defined(CONFIG_LINUX) g_test_add_data_func("/qga/network-get-interfaces", &fix, test_qga_network_get_interfaces); if (!access("/sys/devices/system/cpu/cpu0", F_OK)) { g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus); } g_test_add_data_func("/qga/get-fsinfo", &fix, test_qga_get_fsinfo); + g_test_add_data_func("/qga/fsfreeze-status", &fix, + test_qga_fsfreeze_status); +#endif + g_test_add_data_func("/qga/get-memory-block-info", &fix, test_qga_get_memory_block_info); g_test_add_data_func("/qga/get-memory-blocks", &fix, @@ -993,8 +1006,6 @@ int main(int argc, char **argv) g_test_add_data_func("/qga/invalid-oob", &fix, test_qga_invalid_oob); g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd); g_test_add_data_func("/qga/invalid-args", &fix, test_qga_invalid_args); - g_test_add_data_func("/qga/fsfreeze-status", &fix, - test_qga_fsfreeze_status); =20 g_test_add_data_func("/qga/blacklist", NULL, test_qga_blacklist); g_test_add_data_func("/qga/config", NULL, test_qga_config); --=20 1.8.3.1