Skip to content

Commit cb87c68

Browse files
amboarVasant Hegde
authored andcommitted
test-ipmi-hiomap: Add event-during-read test
[ Upstream commit fd271bc ] Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
1 parent b3fa961 commit cb87c68

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

libflash/test/test-ipmi-hiomap.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,46 @@ static void test_hiomap_protocol_event_before_read(void)
825825
scenario_exit();
826826
}
827827

828+
static const struct scenario_event
829+
scenario_hiomap_protocol_event_during_read[] = {
830+
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
831+
{ .type = scenario_event_p, .p = &hiomap_get_info_call, },
832+
{ .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
833+
{
834+
.type = scenario_event_p,
835+
.p = &hiomap_create_read_window_qs0l1_rs0l1_call,
836+
},
837+
{
838+
.type = scenario_sel,
839+
.s = {
840+
.bmc_state = HIOMAP_E_DAEMON_READY |
841+
HIOMAP_E_FLASH_LOST,
842+
}
843+
},
844+
SCENARIO_SENTINEL,
845+
};
846+
847+
static void test_hiomap_protocol_event_during_read(void)
848+
{
849+
struct blocklevel_device *bl;
850+
struct ipmi_hiomap *ctx;
851+
uint8_t *buf;
852+
size_t len;
853+
int rc;
854+
855+
scenario_enter(scenario_hiomap_protocol_event_during_read);
856+
assert(!ipmi_hiomap_init(&bl));
857+
ctx = container_of(bl, struct ipmi_hiomap, bl);
858+
len = 1 << ctx->block_size_shift;
859+
buf = calloc(1, len);
860+
assert(buf);
861+
rc = bl->read(bl, 0, buf, len);
862+
assert(rc == FLASH_ERR_AGAIN);
863+
free(buf);
864+
ipmi_hiomap_exit(bl);
865+
scenario_exit();
866+
}
867+
828868
static const struct scenario_event
829869
scenario_hiomap_protocol_persistent_error[] = {
830870
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -871,6 +911,7 @@ struct test_case test_cases[] = {
871911
TEST_CASE(test_hiomap_protocol_read_one_block),
872912
TEST_CASE(test_hiomap_protocol_read_two_blocks),
873913
TEST_CASE(test_hiomap_protocol_event_before_read),
914+
TEST_CASE(test_hiomap_protocol_event_during_read),
874915
TEST_CASE(test_hiomap_protocol_persistent_error),
875916
{ NULL, NULL },
876917
};

0 commit comments

Comments
 (0)