From nobody Mon Nov 17 16:04:04 2025 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=1604502500; cv=none; d=zohomail.com; s=zohoarc; b=UWPCh7eOF9W1ucEjLE/312fr3r0+77k0ppE+siWSmVtMcW1g0idrn9XALf5JsONfrSvLQzdcKvyw/YMz5sQDQ8AEJnKOT4YFxd51Cf4N2e4K0UXd7bRYdkHdUDSllXiIAKAOGz9aWjckTVVX/ZuMhctJ1byxQxwiXMFSiiWSe40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604502500; h=Content-Type:Content-Transfer-Encoding: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=Ph4CmqhsXQa5cO2TzGtnNzpPtWhA4pyxk7zpC8CUIlU=; b=LHM93TLqxV069r96d3j5PAEGlfqFWKzGI3Vr5ZHdul2DM97N3Fdsb8oJXQsxHDjnbHGos3R2ohBsznC8wJHwKhOMkHV1XNQzCj8ycl2KFe+2L3oApcnYmcSod0LWyRCWhgh7ZNlijJDu2tSMRrjyqOVRRpUpgT/Rd5H0+wSjxJ8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604502500598137.40157977064018; Wed, 4 Nov 2020 07:08:20 -0800 (PST) Received: from localhost ([::1]:38850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaKOZ-0003nj-Sp for importer@patchew.org; Wed, 04 Nov 2020 10:08:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaKIm-0003FI-O0 for qemu-devel@nongnu.org; Wed, 04 Nov 2020 10:02:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kaKIf-00065Z-8S for qemu-devel@nongnu.org; Wed, 04 Nov 2020 10:02:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-72-bpZBZmHeNcKbs5TxJxcBbw-1; Wed, 04 Nov 2020 10:02:09 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8972C64151 for ; Wed, 4 Nov 2020 15:02:07 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DA4419C4F for ; Wed, 4 Nov 2020 15:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604502132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ph4CmqhsXQa5cO2TzGtnNzpPtWhA4pyxk7zpC8CUIlU=; b=ZJba+MEytOo6sQUo+kZNdf5Vk/5OHSRaMDCd8Quz/PBeDRcNgoMTXMNGZRkm3PIrVNK2pa KkA+Auc1HW8VK1xxsx2o+YjdWZe1ES/y18ke5tdU+hH0Qw6lGsb9GX5YeQLiKXhxdQ6oT6 eonCWwBuCOL96DxYOGckfmH9pbESr3M= X-MC-Unique: bpZBZmHeNcKbs5TxJxcBbw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/20] qtest: escape device name in device-introspect-test Date: Wed, 4 Nov 2020 10:01:53 -0500 Message-Id: <20201104150153.541326-21-pbonzini@redhat.com> In-Reply-To: <20201104150153.541326-1-pbonzini@redhat.com> References: <20201104150153.541326-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/03 22:09:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" device-introspect-test uses HMP, so it should escape the device name properly. Because of this, a few devices that had commas in their names were escaping testing. Signed-off-by: Paolo Bonzini --- tests/qtest/device-introspect-test.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index 9f22340ee5..bbec166dbc 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -104,7 +104,8 @@ static QList *device_type_list(QTestState *qts, bool ab= stract) static void test_one_device(QTestState *qts, const char *type) { QDict *resp; - char *help; + char *help, *escaped; + GRegex *comma; =20 g_test_message("Testing device '%s'", type); =20 @@ -113,8 +114,13 @@ static void test_one_device(QTestState *qts, const cha= r *type) type); qobject_unref(resp); =20 - help =3D qtest_hmp(qts, "device_add \"%s,help\"", type); + comma =3D g_regex_new(",", 0, 0, NULL); + escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, NULL); + g_regex_unref(comma); + + help =3D qtest_hmp(qts, "device_add \"%s,help\"", escaped); g_free(help); + g_free(escaped); } =20 static void test_device_intro_list(void) --=20 2.26.2