Skip to content

Commit

Permalink
test-ipmi-hiomap: Add get-flash-info test
Browse files Browse the repository at this point in the history
[ Upstream commit f65c781 ]

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>
  • Loading branch information
amboar authored and Vasant Hegde committed Mar 4, 2019
1 parent 4f9facd commit b20312e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions libflash/test/test-ipmi-hiomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,51 @@ static void test_hiomap_protocol_action_error(void)
scenario_exit();
}

static const struct scenario_event
scenario_hiomap_protocol_get_flash_info[] = {
{ .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_cmd,
.c = {
.req = {
.cmd = HIOMAP_C_GET_FLASH_INFO,
.seq = 4,
.args = {
},
},
.cc = IPMI_CC_NO_ERROR,
.resp = {
.cmd = HIOMAP_C_GET_FLASH_INFO,
.seq = 4,
.args = {
[0] = 0x00, [1] = 0x20,
[2] = 0x01, [3] = 0x00,
},
},
},
},
SCENARIO_SENTINEL,
};

static void test_hiomap_protocol_get_flash_info(void)
{
struct blocklevel_device *bl;
const char *name;
uint32_t granule;
uint64_t size;

scenario_enter(scenario_hiomap_protocol_get_flash_info);
assert(!ipmi_hiomap_init(&bl));
assert(!bl->get_info(bl, &name, &size, &granule));
assert(!name);
assert(size == (32 * 1024 * 1024));
assert(granule == (4 * 1024));
ipmi_hiomap_exit(bl);
scenario_exit();
}

static const struct scenario_event
scenario_hiomap_protocol_persistent_error[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
Expand Down Expand Up @@ -1413,6 +1458,7 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_protocol_bad_sequence),
TEST_CASE(test_hiomap_protocol_action_error),
TEST_CASE(test_hiomap_protocol_persistent_error),
TEST_CASE(test_hiomap_protocol_get_flash_info),
{ NULL, NULL },
};

Expand Down

0 comments on commit b20312e

Please sign in to comment.