From nobody Mon Feb 9 16:35:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552931313120372.2657753000252; Mon, 18 Mar 2019 10:48:33 -0700 (PDT) Received: from localhost ([127.0.0.1]:45264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5wNB-0000br-6p for importer@patchew.org; Mon, 18 Mar 2019 13:48:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5w4x-0003fV-DP for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5vrI-0003SX-Ou for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:15:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h5vrH-0003Qm-Vg for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:15:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06261C0495A6 for ; Mon, 18 Mar 2019 17:15:29 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 548955D70E for ; Mon, 18 Mar 2019 17:15:28 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 18 Mar 2019 18:15:13 +0100 Message-Id: <20190318171521.8524-6-pbonzini@redhat.com> In-Reply-To: <20190318171521.8524-1-pbonzini@redhat.com> References: <20190318171521.8524-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Mar 2019 17:15:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/13] pca9552-test: do not rely on state across 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" receive_autoinc is relying on the LED state that is set by send_and_receive. Stop doing that, because qgraph resets the machine between tests. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- tests/pca9552-test.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/pca9552-test.c b/tests/pca9552-test.c index 06359b7435..89b4445e29 100644 --- a/tests/pca9552-test.c +++ b/tests/pca9552-test.c @@ -18,11 +18,20 @@ =20 static I2CAdapter *i2c; =20 +static void pca9552_init(I2CAdapter *i2c) +{ + /* Switch on LEDs 0 and 12 */ + i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54); + i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54); +} + static void receive_autoinc(void) { uint8_t resp; uint8_t reg =3D PCA9552_LS0 | PCA9552_AUTOINC; =20 + pca9552_init(i2cdev); + i2c_send(i2c, PCA9552_TEST_ADDR, ®, 1); =20 /* PCA9552_LS0 */ @@ -52,16 +61,14 @@ static void send_and_receive(void) value =3D i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); g_assert_cmphex(value, =3D=3D, 0x0); =20 - /* Switch on LED 0 */ - i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54); + pca9552_init(i2cdev); + value =3D i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0); g_assert_cmphex(value, =3D=3D, 0x54); =20 value =3D i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); g_assert_cmphex(value, =3D=3D, 0x01); =20 - /* Switch on LED 12 */ - i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54); value =3D i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3); g_assert_cmphex(value, =3D=3D, 0x54); =20 --=20 2.20.1