tests: Allow tx packets in mctp_binding_test
This requires setting src==dest for routing.
Change-Id: I098b67071b111e328cbcc8bb20656638d7baca39
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/tests/test-utils.c b/tests/test-utils.c
index ccbe382..5e78474 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -12,16 +12,16 @@
#include "test-utils.h"
+/* mctp_binding_test can be used for loopback in tests. Senders must use
+ * the local EID as the destination */
struct mctp_binding_test {
struct mctp_binding binding;
uint8_t tx_storage[MCTP_PKTBUF_SIZE(MCTP_BTU)];
};
-static int mctp_binding_test_tx(struct mctp_binding *b __attribute__((unused)),
- struct mctp_pktbuf *pkt __attribute__((unused)))
+static int mctp_binding_test_tx(struct mctp_binding *b, struct mctp_pktbuf *pkt)
{
- /* we are not expecting TX packets */
- assert(0);
+ mctp_bus_rx(b, pkt);
return 0;
}
@@ -73,4 +73,5 @@
assert(*binding);
mctp_binding_test_register_bus(*binding, *mctp, eid);
+ mctp_binding_set_tx_enabled(&(*binding)->binding, true);
}