[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/24] pca9552-test: do not rely on state across test
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/24] pca9552-test: do not rely on state across tests |
Date: |
Mon, 3 Jun 2019 19:10:32 +0200 |
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.
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
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 06359b7..89b4445 100644
--- a/tests/pca9552-test.c
+++ b/tests/pca9552-test.c
@@ -18,11 +18,20 @@
static I2CAdapter *i2c;
+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 = PCA9552_LS0 | PCA9552_AUTOINC;
+ pca9552_init(i2cdev);
+
i2c_send(i2c, PCA9552_TEST_ADDR, ®, 1);
/* PCA9552_LS0 */
@@ -52,16 +61,14 @@ static void send_and_receive(void)
value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0);
g_assert_cmphex(value, ==, 0x0);
- /* Switch on LED 0 */
- i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54);
+ pca9552_init(i2cdev);
+
value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0);
g_assert_cmphex(value, ==, 0x54);
value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0);
g_assert_cmphex(value, ==, 0x01);
- /* Switch on LED 12 */
- i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54);
value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3);
g_assert_cmphex(value, ==, 0x54);
--
1.8.3.1
- [Qemu-devel] [PULL 17/24] libqos: add ARM n800 machine object, (continued)
- [Qemu-devel] [PULL 17/24] libqos: add ARM n800 machine object, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 14/24] imx25-pdk: create ds1338 for qtest inside the test, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 18/24] libqos: add ARM imx25-pdk machine object, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 15/24] libqos: split I2CAdapter initialization and allocation, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 21/24] libqos: i2c: move address into QI2CDevice, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 19/24] tests: convert OMAP i2c tests to qgraph, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 24/24] q35: Revert to kernel irqchip, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 12/24] libqos: fix omap-i2c receiving more than 4 bytes, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 23/24] configure: remove tpm_passthrough & tpm_emulator, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 13/24] pca9552-test: do not rely on state across tests,
Paolo Bonzini <=
- [Qemu-devel] [PULL 16/24] libqos: convert I2C to qgraph, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 10/24] qgraph: fix qos_node_contains with options, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 06/24] edu: mmio: allow 64-bit access, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 11/24] libqos: move common i2c code to libqos, Paolo Bonzini, 2019/06/03
- [Qemu-devel] [PULL 22/24] ci: store Patchew configuration in the tree, Paolo Bonzini, 2019/06/03
- Re: [Qemu-devel] [PULL 00/24] Misc patches for 2019-06-03, Peter Maydell, 2019/06/03