From nobody Sun Nov 2 00:17:00 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509723045337886.3652761398401; Fri, 3 Nov 2017 08:30:45 -0700 (PDT) Received: from localhost ([::1]:37178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAdvH-0005UT-D8 for importer@patchew.org; Fri, 03 Nov 2017 11:30:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAdtl-0004cq-UJ for qemu-devel@nongnu.org; Fri, 03 Nov 2017 11:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAdti-0005dX-Qs for qemu-devel@nongnu.org; Fri, 03 Nov 2017 11:28:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAdti-0005dF-LT for qemu-devel@nongnu.org; Fri, 03 Nov 2017 11:28:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CD10C0568F9; Fri, 3 Nov 2017 15:28:41 +0000 (UTC) Received: from localhost (ovpn-112-63.ams2.redhat.com [10.36.112.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9ED045C888; Fri, 3 Nov 2017 15:28:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8CD10C0568F9 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=marcandre.lureau@redhat.com From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Nov 2017 16:28:24 +0100 Message-Id: <20171103152824.21948-3-marcandre.lureau@redhat.com> In-Reply-To: <20171103152824.21948-1-marcandre.lureau@redhat.com> References: <20171103152824.21948-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 03 Nov 2017 15:28:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] test: add some chardev mux event tests 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: , Cc: pbonzini@redhat.com, kirill.shutemov@linux.intel.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Check the expected behaviour of qemu_chr_be_event() on a mux chardev. For some reason, sending the event on the base chardev broadcast to all frontends, while sending it on the mux chardev itself should trigger the event on the currently focused chardev frontend. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/test-char.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test-char.c b/tests/test-char.c index 7ac25ff73f..911e3f6e8d 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -5,6 +5,7 @@ #include "qemu/config-file.h" #include "qemu/sockets.h" #include "chardev/char-fe.h" +#include "chardev/char-mux.h" #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qom/qom-qobject.h" @@ -164,6 +165,7 @@ static void char_mux_test(void) FeHandler h1 =3D { 0, }, h2 =3D { 0, }; CharBackend chr_be1, chr_be2; =20 + muxes_realized =3D true; /* done after machine init */ opts =3D qemu_opts_create(qemu_find_opts("chardev"), "mux-label", 1, &error_abort); qemu_opt_set(opts, "backend", "ringbuf", &error_abort); @@ -201,8 +203,23 @@ static void char_mux_test(void) g_assert_cmpstr(h2.read_buf, =3D=3D, "hello"); h2.read_count =3D 0; =20 + g_assert_cmpint(h1.last_event, !=3D, 42); /* should be MUX_OUT or OPEN= ED */ + g_assert_cmpint(h2.last_event, !=3D, 42); /* should be MUX_IN or OPENE= D */ + /* sending event on the base broadcast to all fe, historical reasons? = */ + qemu_chr_be_event(base, 42); + g_assert_cmpint(h1.last_event, =3D=3D, 42); + g_assert_cmpint(h2.last_event, =3D=3D, 42); + qemu_chr_be_event(chr, -1); + g_assert_cmpint(h1.last_event, =3D=3D, 42); + g_assert_cmpint(h2.last_event, =3D=3D, -1); + /* switch focus */ qemu_chr_be_write(base, (void *)"\1c", 2); + g_assert_cmpint(h1.last_event, =3D=3D, CHR_EVENT_MUX_IN); + g_assert_cmpint(h2.last_event, =3D=3D, CHR_EVENT_MUX_OUT); + qemu_chr_be_event(chr, -1); + g_assert_cmpint(h1.last_event, =3D=3D, -1); + g_assert_cmpint(h2.last_event, =3D=3D, CHR_EVENT_MUX_OUT); =20 qemu_chr_be_write(base, (void *)"hello", 6); g_assert_cmpint(h2.read_count, =3D=3D, 0); --=20 2.15.0.rc0.40.gaefcc5f6f