aboutsummaryrefslogtreecommitdiff
path: root/libflash
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:38 +1030
committerStewart Smith <stewart@linux.ibm.com>2019-02-24 17:43:38 -0600
commit4642a6c9a66b5ff52026dce5cd20532039da5b32 (patch)
tree48a7b3920463d98a55b2b37f5a7549e9480f13d0 /libflash
parent12ca08b58e5b8fda6497223650aea8b3f0859056 (diff)
downloadskiboot-4642a6c9a66b5ff52026dce5cd20532039da5b32.zip
skiboot-4642a6c9a66b5ff52026dce5cd20532039da5b32.tar.gz
skiboot-4642a6c9a66b5ff52026dce5cd20532039da5b32.tar.bz2
test-ipmi-hiomap: Add ack-malformed tests
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.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 8fbee1f..05e3ecf 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -43,6 +43,7 @@ struct scenario_cmd {
struct scenario_cmd_data req;
struct scenario_cmd_data resp;
uint8_t cc;
+ size_t resp_size;
};
struct scenario_sel {
@@ -177,6 +178,9 @@ void ipmi_queue_msg_sync(struct ipmi_msg *msg)
msg->cc = cmd->cc;
memcpy(msg->data, &cmd->resp, msg->resp_size);
+ if (cmd->resp_size)
+ msg->resp_size = cmd->resp_size;
+
msg->complete(msg);
ctx->cursor++;
@@ -1698,6 +1702,60 @@ static void test_hiomap_erase_error(void)
scenario_exit();
}
+static const struct scenario_event scenario_hiomap_ack_malformed_small[] = {
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 1,
+ .args = { [0] = 0x3 },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 1
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_ack_malformed_small(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_ack_malformed_small);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
+static const struct scenario_event scenario_hiomap_ack_malformed_large[] = {
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 1,
+ .args = { [0] = 0x3 },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 3,
+ .resp = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 1,
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_ack_malformed_large(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_ack_malformed_large);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
struct test_case {
const char *name;
void (*fn)(void);
@@ -1737,6 +1795,8 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_flush_error),
TEST_CASE(test_hiomap_ack_error),
TEST_CASE(test_hiomap_erase_error),
+ TEST_CASE(test_hiomap_ack_malformed_small),
+ TEST_CASE(test_hiomap_ack_malformed_large),
{ NULL, NULL },
};