From nobody Mon Feb 9 23:07:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1688982755; cv=none; d=zohomail.com; s=zohoarc; b=AVbE1awhGUdDynU/S+GX7WbbPuA7A7wS33A1kd3FevSiKnK5QZ32vurXMjJQv13BRBSIGDDBFNDTl/SgO6/KHQAOyZdj60V+zpNpfPeibL6t3lKUP0DZVdkFdj7r4gFraV8G09pnoihqN/9q7RHkBL317dFWV5uiS4iIkwDtOJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688982755; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=85k2ArhcL+PwROxyGcu9Qfh6Ia16um4HbG9+RR8yxwA=; b=EPKno1n7GYkN8EtQXgRAm7cocSpZnwo0Cs0t+i4xhSdS3hxLKZsgr/CrpHzXXXrPZqcSSIZg8JBXGooV9J9Woy8Hk4knEHc2IaPg3jp5Q4M6L1J0tPz31PJVd8pPDQ1YFFyc1V730OXPHvnCSV9lS8LaDBhI0ZJQQpWxj2ttnh0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168898275529743.00350959891932; Mon, 10 Jul 2023 02:52:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qInZ5-0005kR-Ls; Mon, 10 Jul 2023 05:52:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qInYb-0005LB-SE for qemu-devel@nongnu.org; Mon, 10 Jul 2023 05:51:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qInYZ-0004gs-9W for qemu-devel@nongnu.org; Mon, 10 Jul 2023 05:51:49 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-xyIB5TfUOQyqFgtxwjgPtA-1; Mon, 10 Jul 2023 05:51:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E42CC3C0F663; Mon, 10 Jul 2023 09:51:42 +0000 (UTC) Received: from kostyanf14nb.redhat.com (unknown [10.45.225.233]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25BD340C206F; Mon, 10 Jul 2023 09:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688982706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=85k2ArhcL+PwROxyGcu9Qfh6Ia16um4HbG9+RR8yxwA=; b=EVXUKoSO3JAU20FVEZtyjqk5AjB974nEMBaGyrpF5soJaqk13Izt40P+X8gTWA4WPoiWjk DpmYj7EhUQfBDQpxgMR9wOUo8T3sAcUet97KGqxTbheuv7KyyTaGV2PehqiQoP8DT8eTGr 44pKhp0IzHVFeYTAc6QZYUhQmLBM7Xs= X-MC-Unique: xyIB5TfUOQyqFgtxwjgPtA-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Michael Roth Subject: [PATCH v2 3/3] qga: Add tests for --allow-rpcs option Date: Mon, 10 Jul 2023 12:51:36 +0300 Message-Id: <20230710095136.1022704-4-kkostiuk@redhat.com> In-Reply-To: <20230710095136.1022704-1-kkostiuk@redhat.com> References: <20230710095136.1022704-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1688982758286100001 Signed-off-by: Konstantin Kostiuk Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/unit/test-qga.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index 360b4cab23..671e83cb86 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -665,6 +665,36 @@ static void test_qga_blockedrpcs(gconstpointer data) fixture_tear_down(&fix, NULL); } =20 +static void test_qga_allowedrpcs(gconstpointer data) +{ + TestFixture fix; + QDict *ret, *error; + const gchar *class, *desc; + + fixture_setup(&fix, "-a guest-ping,guest-get-time", NULL); + + /* check allowed RPCs */ + ret =3D qmp_fd(fix.fd, "{'execute': 'guest-ping'}"); + qmp_assert_no_error(ret); + qobject_unref(ret); + + ret =3D qmp_fd(fix.fd, "{'execute': 'guest-get-time'}"); + qmp_assert_no_error(ret); + qobject_unref(ret); + + /* check something else */ + ret =3D qmp_fd(fix.fd, "{'execute': 'guest-get-fsinfo'}"); + g_assert_nonnull(ret); + error =3D qdict_get_qdict(ret, "error"); + class =3D qdict_get_try_str(error, "class"); + desc =3D qdict_get_try_str(error, "desc"); + g_assert_cmpstr(class, =3D=3D, "CommandNotFound"); + g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled")); + qobject_unref(ret); + + fixture_tear_down(&fix, NULL); +} + static void test_qga_config(gconstpointer data) { GError *error =3D NULL; @@ -1090,6 +1120,7 @@ int main(int argc, char **argv) test_qga_fsfreeze_status); =20 g_test_add_data_func("/qga/blockedrpcs", NULL, test_qga_blockedrpcs); + g_test_add_data_func("/qga/allowedrpcs", NULL, test_qga_allowedrpcs); g_test_add_data_func("/qga/config", NULL, test_qga_config); g_test_add_data_func("/qga/guest-exec", &fix, test_qga_guest_exec); g_test_add_data_func("/qga/guest-exec-separated", &fix, --=20 2.34.1