aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:40 +1030
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-03-04 21:23:29 +0530
commit7ae038042951d38d69db7c6d4004c457701fe829 (patch)
treee7f6928145c38dec210647d9487ca05cfb894e4d
parent90ae8a0767ceff33125ae13cc8eff9373361ac72 (diff)
downloadskiboot-7ae038042951d38d69db7c6d4004c457701fe829.zip
skiboot-7ae038042951d38d69db7c6d4004c457701fe829.tar.gz
skiboot-7ae038042951d38d69db7c6d4004c457701fe829.tar.bz2
test-ipmi-hiomap: Add get-flash-info-malformed tests
[ Upstream commit 5c2ada09e76dbaa8afbaa3fc5d2712f1acd8b283 ] 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>
-rw-r--r--libflash/test/test-ipmi-hiomap.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index b518036..016ec1f 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1818,6 +1818,68 @@ static void test_hiomap_get_info_malformed_large(void)
scenario_exit();
}
+static const struct scenario_event
+scenario_hiomap_get_flash_info_malformed_small[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_info_call, },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 3,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 5,
+ .resp = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 3,
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_get_flash_info_malformed_small(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_get_flash_info_malformed_small);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
+static const struct scenario_event
+scenario_hiomap_get_flash_info_malformed_large[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_info_call, },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 3,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 7,
+ .resp = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 3,
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_get_flash_info_malformed_large(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_get_flash_info_malformed_large);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
struct test_case {
const char *name;
void (*fn)(void);
@@ -1861,6 +1923,8 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_ack_malformed_large),
TEST_CASE(test_hiomap_get_info_malformed_small),
TEST_CASE(test_hiomap_get_info_malformed_large),
+ TEST_CASE(test_hiomap_get_flash_info_malformed_small),
+ TEST_CASE(test_hiomap_get_flash_info_malformed_large),
{ NULL, NULL },
};