Skip to content

Commit 1e83368

Browse files
henrikbrixandersencarlescufi
authored andcommitted
tests: drivers: can: api: fix misunderstood use of ESI flag
Fix the test for sending frames with the CAN_FRAME_ESI flag set. Sending frames with this flag set in software is never allowed. Fixes: 8023a58 Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 1c75408 commit 1e83368

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/drivers/can/api/src/canfd.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,22 +257,20 @@ ZTEST(canfd, test_send_fd_dlc_out_of_range)
257257
}
258258

259259
/**
260-
* @brief Test error when CAN FD Error State Indicator (ESI) is send without FD format flag (FDF).
260+
* @brief Test error when CAN FD Error State Indicator (ESI) is set on transmit frame.
261261
*
262-
* CAN FD Error State Indicator (ESI) indicates that the transmitting node is
263-
* in error-passive state. Only valid in combination with CAN_FRAME_FDF.
262+
* CAN FD Error State Indicator (ESI) indicates that the transmitting node is in error-passive
263+
* state, but should never be set explicitly. Setting it is handled in the CAN controller hardware.
264264
*/
265265
ZTEST(canfd, test_send_fd_incorrect_esi)
266266
{
267267
struct can_frame frame = {
268-
.flags = CAN_FRAME_ESI,
268+
.flags = CAN_FRAME_FDF | CAN_FRAME_ESI,
269269
.id = TEST_CAN_STD_ID_1,
270270
.dlc = 0,
271271
};
272272
int err;
273273

274-
Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS);
275-
276274
err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL);
277275
zassert_equal(err, -ENOTSUP, "wrong error on sending invalid frame (err %d)", err);
278276
}

0 commit comments

Comments
 (0)