From nobody Fri May 3 01:05:08 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=1576074854; cv=none; d=zohomail.com; s=zohoarc; b=lcPNK62u3gh4ljq72DuO58TPvei8T/dhAw0pagx9+nxaer587SD4kTG6HqC4DoDKysSa1noqeffZ6CJSQh0qNBlF8rpJVMlug+MfGFGx573GtEsoRcHyqYunnLULJgHGeM4IS0Zj3PDu/E0Kw1EGug/5Hu9rXTaUW8l7rr+plF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576074854; 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=ovY/8mchaDtROHxcc8/8N5K4E3la5in6G3plOwjOIug=; b=a3TT1zuIy7sZTygGkhnOyzs6FTf+l9Chw38xh/cdOdxL1KSO4CzZBOmmIc0nQUIcWfO2H6Q4m77zqHxhLcRI+QAkSWT1N2/xP1gb3yEqdScY1TlpmRYmFqsI6kr2/nXkqq50k9PClbb0vM8+BVrRrIVODz+bfnDkOLadOKLVFYQ= 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 1576074854783277.0155058450706; Wed, 11 Dec 2019 06:34:14 -0800 (PST) Received: from localhost ([::1]:43274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if348-0006fT-GU for importer@patchew.org; Wed, 11 Dec 2019 09:34:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34008) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if2ty-0005Qc-0w for qemu-devel@nongnu.org; Wed, 11 Dec 2019 09:23:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1if2tw-0003Gu-OR for qemu-devel@nongnu.org; Wed, 11 Dec 2019 09:23:41 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1if2tw-0003Fy-Hk; Wed, 11 Dec 2019 09:23:40 -0500 Received: by mail-wr1-x443.google.com with SMTP id z3so24268422wru.3; Wed, 11 Dec 2019 06:23:40 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id g23sm2503783wmk.14.2019.12.11.06.23.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 06:23:38 -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=ovY/8mchaDtROHxcc8/8N5K4E3la5in6G3plOwjOIug=; b=rhikW6K/gbZ9isrqgty7qmQwUnbyVnmYTKz5HypEJhZK0/qTafXLXtIFuXdLvgfLtp RPV+FDadKho0M/WHWOitlUADP+hhRJtYNywS2S/t162KCf13MDA1JiOGzc91glbobHBv iXX1tInbK9TtrGRVyGkIWfrRAXC2JrrS8JOqNPaDEOl+HGjl45BLp1jjLCJmza/KvF1P g+fucdjqv4/DladghQF4xIl78WeUYTiGd+GDlvkV7i9H+b7FZHK+WdgjSnZygbdxKfey EyY8h1VPT4onzQDQPpqCIewrCQJQaKGff5qR0Fkaf1NZny4+KVUY+tXkgI7Z/basGfVk 94BQ== 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=ovY/8mchaDtROHxcc8/8N5K4E3la5in6G3plOwjOIug=; b=bQg4HOHGg7qzbpnU+Qw/spXjXkcb8mKppT4lxduBFgcYK/a9JjsldDtKCNFdr9UJzg JY5LtelHBlMtACyjR6GbvDSoIkpR2AvdnrCBjjkmO0of19wfKdbtyKfU9ZqxG+PxTwhM MI3H6ey0G7gjHGmTSRG07hcne/mH3dgLWzar3dr0ysqjdaq/8joUPuR+dUPLFyXo6tEK JV1gpUAExJBYkSJkBNFBWTwDtUR+rW8EFshHCzzCkfiVUJgqEXPQGhFD0ib5kTczB2lW lQTtIIoPsdvikufQcXJhQbojeOj2rore26tX7wWhFNY751GDsh2OHTLnDdpyDusCfqQ6 yTaA== X-Gm-Message-State: APjAAAV4UF4mEhMnj2VeCuFGn1kjUXdMuarqD4zmv2tWYvaX87WMvyHE m8zLUGGI9GnTJ1pcuoGy+7C57d0o X-Google-Smtp-Source: APXvYqz/+foVIWHc/iUo+ZpM6GX9itFSn4I4d039NFmWwstofErAvka4YFP2raP6bLbipJrIIR9pPA== X-Received: by 2002:adf:dfc9:: with SMTP id q9mr21438wrn.219.1576074219297; Wed, 11 Dec 2019 06:23:39 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] tests: fix test-qga on macosx Date: Wed, 11 Dec 2019 15:23:29 +0100 Message-Id: <1576074210-52834-8-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::443 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: qemu-trivial@nongnu.org, =?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 --- tests/test-qga.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/test-qga.c b/tests/test-qga.c index d2b2435..abeb9c9 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(__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(__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(__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(__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(__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