diff mbox series

[v2,41/52] test-ipmi-hiomap: Add get-flash-info-malformed tests

Message ID 20190221062851.21958-42-andrew@aj.id.au
State Accepted
Headers show
Series ipmi-hiomap: Tests and fixes for event handling | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master

Commit Message

Andrew Jeffery Feb. 21, 2019, 6:28 a.m. UTC
Cc: stable
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 libflash/test/test-ipmi-hiomap.c | 64 ++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
diff mbox series

Patch

diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index b51803602a0d..016ec1f7519a 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 },
 };