test_astlpc: Add astlpc_test_poll_not_ready()
Ensure we don't fail or block the poll operation if there's no data.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Iadb63155bf94bf837b215c957fa75a866dcff9f0
diff --git a/tests/test_astlpc.c b/tests/test_astlpc.c
index 11e5699..35d00ee 100644
--- a/tests/test_astlpc.c
+++ b/tests/test_astlpc.c
@@ -534,6 +534,30 @@
network_destroy(&ctx);
}
+static void astlpc_test_poll_not_ready(void)
+{
+ struct astlpc_endpoint bmc;
+ uint8_t kcs[2] = { 0 };
+ void *lpc_mem;
+ int rc;
+
+ /* Test harness initialisation */
+ lpc_mem = calloc(1, 1 * 1024 * 1024);
+ assert(lpc_mem);
+
+ /* BMC initialisation */
+ endpoint_init(&bmc, 8, MCTP_BINDING_ASTLPC_MODE_BMC, &kcs, lpc_mem);
+
+ /* Check for a command despite none present */
+ rc = mctp_astlpc_poll(bmc.astlpc);
+
+ /* Make sure it doesn't fail */
+ assert(rc == 0);
+
+ endpoint_destroy(&bmc);
+ free(lpc_mem);
+}
+
/* clang-format off */
#define TEST_CASE(test) { #test, test }
static const struct {
@@ -547,6 +571,7 @@
TEST_CASE(astlpc_test_packetised_message_bmc_to_host),
TEST_CASE(astlpc_test_simple_indirect_message_bmc_to_host),
TEST_CASE(astlpc_test_host_tx_bmc_gone),
+ TEST_CASE(astlpc_test_poll_not_ready),
};
/* clang-format on */