[Skiboot] [PATCH 05/51] test-ipmi-hiomap: Add ability to delay some IPMI messages
Andrew Jeffery
andrew at aj.id.au
Fri Feb 15 17:56:22 AEDT 2019
The initial implementation delivered all BMC-initiated SELs immediately
after the delivery of the last response to the host. In some
circumstances we want slightly more control over how this works, so
introduce a means to manually advance the scenario in the test case.
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
libflash/test/test-ipmi-hiomap.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 0ad08b4cf5bc..19e0cbf5c846 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -25,7 +25,8 @@ enum scenario_event_type {
scenario_sentinel = 0,
scenario_event_p,
scenario_cmd,
- scenario_sel
+ scenario_sel,
+ scenario_delay,
};
struct scenario_cmd_data {
@@ -79,6 +80,20 @@ static void scenario_enter(const struct scenario_event *scenario)
ipmi_msg_ctx.cursor = scenario;
}
+static void scenario_advance(void)
+{
+ struct ipmi_msg_ctx *ctx = &ipmi_msg_ctx;
+
+ assert(ctx->cursor->type == scenario_delay);
+ ctx->cursor++;
+
+ /* Deliver all the undelayed, scheduled SELs */
+ while (ctx->cursor->type == scenario_sel) {
+ ctx->sel.fn(ctx->cursor->s.bmc_state, ctx->sel.context);
+ ctx->cursor++;
+ }
+}
+
static void scenario_exit(void)
{
assert(ipmi_msg_ctx.cursor->type == scenario_sentinel);
@@ -393,6 +408,9 @@ scenario_hiomap_event_daemon_regained_flash_control_dirty[] = {
},
},
},
+ {
+ .type = scenario_delay
+ },
{
.type = scenario_sel,
.s = {
@@ -460,6 +478,7 @@ static void test_hiomap_event_daemon_regained_flash_control_dirty(void)
scenario_enter(scenario_hiomap_event_daemon_regained_flash_control_dirty);
assert(!ipmi_hiomap_init(&bl));
assert(!bl->read(bl, 0, buf, len));
+ scenario_advance();
assert(!bl->read(bl, 0, buf, len));
ipmi_hiomap_exit(bl);
scenario_exit();
@@ -495,6 +514,9 @@ static const struct scenario_event scenario_hiomap_protocol_reset_recovery[] = {
},
},
},
+ {
+ .type = scenario_delay
+ },
{
.type = scenario_sel,
.s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET, }
@@ -598,6 +620,7 @@ static void test_hiomap_protocol_reset_recovery(void)
scenario_enter(scenario_hiomap_protocol_reset_recovery);
assert(!ipmi_hiomap_init(&bl));
assert(!bl->read(bl, 0, buf, len));
+ scenario_advance();
assert(!bl->read(bl, 0, buf, len));
ipmi_hiomap_exit(bl);
scenario_exit();
--
2.19.1
More information about the Skiboot
mailing list