diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2019-02-21 16:58:05 +1030 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-02-21 22:58:46 -0600 |
commit | 43ca6a2e5b1237f7bf2efb70333c13d145ae62cd (patch) | |
tree | 5313d21745606763a0fbcf8d6faffc746bef0e58 /libflash | |
parent | 96409597aa396fa717a575194fd10cc08d1c1ef2 (diff) | |
download | talos-skiboot-43ca6a2e5b1237f7bf2efb70333c13d145ae62cd.tar.gz talos-skiboot-43ca6a2e5b1237f7bf2efb70333c13d145ae62cd.zip |
test-ipmi-hiomap: Add ability to delay some IPMI messages
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.
Cc: stable
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r-- | libflash/test/test-ipmi-hiomap.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c index 0ad08b4c..19e0cbf5 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); @@ -394,6 +409,9 @@ scenario_hiomap_event_daemon_regained_flash_control_dirty[] = { }, }, { + .type = scenario_delay + }, + { .type = scenario_sel, .s = { .bmc_state = (HIOMAP_E_DAEMON_READY @@ -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(); @@ -496,6 +515,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(); |