aboutsummaryrefslogtreecommitdiff
path: root/libflash/test
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:26 +1030
committerStewart Smith <stewart@linux.ibm.com>2019-02-24 17:43:37 -0600
commitc2a4b4988eccbc8c73d366be6c7356f78385112f (patch)
tree6811eee6b99a1f237b8b0bae0d159773895f8036 /libflash/test
parent410b80725ad266026e89b664b957e56e28b95660 (diff)
downloadskiboot-c2a4b4988eccbc8c73d366be6c7356f78385112f.zip
skiboot-c2a4b4988eccbc8c73d366be6c7356f78385112f.tar.gz
skiboot-c2a4b4988eccbc8c73d366be6c7356f78385112f.tar.bz2
test-ipmi-hiomap: Add event-during-erase
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/test')
-rw-r--r--libflash/test/test-ipmi-hiomap.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index c00c30f..95bb353 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1261,6 +1261,42 @@ static void test_hiomap_protocol_event_before_erase(void)
}
static const struct scenario_event
+scenario_hiomap_protocol_event_during_erase[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_info_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
+ {
+ .type = scenario_event_p,
+ .p = &hiomap_create_write_window_qs0l1_rs0l1_call,
+ },
+ {
+ .type = scenario_sel,
+ .s = {
+ .bmc_state = HIOMAP_E_DAEMON_READY |
+ HIOMAP_E_FLASH_LOST,
+ }
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_protocol_event_during_erase(void)
+{
+ struct blocklevel_device *bl;
+ struct ipmi_hiomap *ctx;
+ size_t len;
+ int rc;
+
+ scenario_enter(scenario_hiomap_protocol_event_during_erase);
+ assert(!ipmi_hiomap_init(&bl));
+ ctx = container_of(bl, struct ipmi_hiomap, bl);
+ len = 1 << ctx->block_size_shift;
+ rc = bl->erase(bl, 0, len);
+ assert(rc == FLASH_ERR_AGAIN);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
+static const struct scenario_event
scenario_hiomap_protocol_persistent_error[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
{ .type = scenario_event_p, .p = &hiomap_get_info_call, },
@@ -1314,6 +1350,7 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_protocol_erase_one_block),
TEST_CASE(test_hiomap_protocol_erase_two_blocks),
TEST_CASE(test_hiomap_protocol_event_before_erase),
+ TEST_CASE(test_hiomap_protocol_event_during_erase),
TEST_CASE(test_hiomap_protocol_persistent_error),
{ NULL, NULL },
};