Skip to content

Commit

Permalink
test-ipmi-hiomap: Add get-info-malformed tests
Browse files Browse the repository at this point in the history
Cc: stable
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
amboar authored and stewartsmith committed Feb 24, 2019
1 parent 4642a6c commit 8745e91
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions libflash/test/test-ipmi-hiomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,68 @@ static void test_hiomap_ack_malformed_large(void)
scenario_exit();
}

static const struct scenario_event
scenario_hiomap_get_info_malformed_small[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
{
.type = scenario_cmd,
.c = {
.req = {
.cmd = HIOMAP_C_GET_INFO,
.seq = 2,
.args = { [0] = 0x2 },
},
.cc = IPMI_CC_NO_ERROR,
.resp_size = 7,
.resp = {
.cmd = HIOMAP_C_GET_INFO,
.seq = 2,
},
},
},
SCENARIO_SENTINEL,
};

static void test_hiomap_get_info_malformed_small(void)
{
struct blocklevel_device *bl;

scenario_enter(scenario_hiomap_get_info_malformed_small);
assert(ipmi_hiomap_init(&bl) > 0);
scenario_exit();
}

static const struct scenario_event
scenario_hiomap_get_info_malformed_large[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
{
.type = scenario_cmd,
.c = {
.req = {
.cmd = HIOMAP_C_GET_INFO,
.seq = 2,
.args = { [0] = 0x2 },
},
.cc = IPMI_CC_NO_ERROR,
.resp_size = 9,
.resp = {
.cmd = HIOMAP_C_GET_INFO,
.seq = 2,
},
},
},
SCENARIO_SENTINEL,
};

static void test_hiomap_get_info_malformed_large(void)
{
struct blocklevel_device *bl;

scenario_enter(scenario_hiomap_get_info_malformed_large);
assert(ipmi_hiomap_init(&bl) > 0);
scenario_exit();
}

struct test_case {
const char *name;
void (*fn)(void);
Expand Down Expand Up @@ -1797,6 +1859,8 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_erase_error),
TEST_CASE(test_hiomap_ack_malformed_small),
TEST_CASE(test_hiomap_ack_malformed_large),
TEST_CASE(test_hiomap_get_info_malformed_small),
TEST_CASE(test_hiomap_get_info_malformed_large),
{ NULL, NULL },
};

Expand Down

0 comments on commit 8745e91

Please sign in to comment.