Skip to content

Commit 5bd0912

Browse files
teburdnashif
authored andcommitted
i2c: Drop transceive test, fix transfer call count
Transactions should result in a single transfer call not multiple transfer calls. Transceive isn't supported by i2c and so the TXRX op isn't validated for success anymore. Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
1 parent 2476211 commit 5bd0912

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

tests/subsys/rtio/rtio_i2c/src/main.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -117,42 +117,6 @@ ZTEST(rtio_i2c, test_fallback_submit_tiny_tx)
117117
rtio_cqe_release(&test_rtio_ctx, cqe);
118118
}
119119

120-
ZTEST(rtio_i2c, test_fallback_submit_txrx)
121-
{
122-
uint8_t tx_data[] = {0x01, 0x02, 0x03};
123-
uint8_t rx_data[ARRAY_SIZE(tx_data)] = {0};
124-
struct rtio_sqe *sqe = rtio_sqe_acquire(&test_rtio_ctx);
125-
126-
blocking_emul_i2c_transfer_fake.custom_fake =
127-
[&tx_data](const struct emul *, struct i2c_msg *msgs, int msg_count, int) {
128-
zassert_equal(2, msg_count);
129-
// First message should be a 'tx'
130-
zassert_equal(ARRAY_SIZE(tx_data), msgs[0].len);
131-
zassert_mem_equal(tx_data, msgs[0].buf, msgs[0].len);
132-
zassert_equal(I2C_MSG_WRITE, msgs[0].flags);
133-
// Second message should be an 'rx'
134-
zassert_equal(ARRAY_SIZE(tx_data), msgs[1].len);
135-
zassert_equal(I2C_MSG_READ | I2C_MSG_STOP, msgs[1].flags);
136-
for (uint8_t i = 0; i < msgs[1].len; ++i) {
137-
msgs[1].buf[i] = msgs[0].buf[i];
138-
}
139-
return 0;
140-
};
141-
142-
zassert_not_null(sqe);
143-
rtio_sqe_prep_transceive(sqe, &blocking_emul_iodev, RTIO_PRIO_NORM, tx_data, rx_data,
144-
ARRAY_SIZE(tx_data), NULL);
145-
zassert_ok(rtio_submit(&test_rtio_ctx, 1));
146-
zassert_equal(1, blocking_emul_i2c_transfer_fake.call_count);
147-
148-
struct rtio_cqe *cqe = rtio_cqe_consume_block(&test_rtio_ctx);
149-
150-
zassert_ok(cqe->result);
151-
zassert_mem_equal(tx_data, rx_data, ARRAY_SIZE(tx_data));
152-
153-
rtio_cqe_release(&test_rtio_ctx, cqe);
154-
}
155-
156120
ZTEST(rtio_i2c, test_fallback_submit_rx)
157121
{
158122
uint8_t expected_buffer[] = {0x00, 0x01, 0x02};
@@ -237,7 +201,7 @@ ZTEST(rtio_i2c, test_fallback_transaction)
237201
phase1->flags |= RTIO_SQE_TRANSACTION;
238202

239203
zassert_ok(rtio_submit(&test_rtio_ctx, 2));
240-
zassert_equal(2, blocking_emul_i2c_transfer_fake.call_count);
204+
zassert_equal(1, blocking_emul_i2c_transfer_fake.call_count);
241205

242206
struct rtio_cqe *cqe;
243207

0 commit comments

Comments
 (0)