[Skiboot] [PATCH v2 40/52] test-ipmi-hiomap: Add get-info-malformed tests

Andrew Jeffery andrew at aj.id.au
Thu Feb 21 17:28:39 AEDT 2019


Cc: stable
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 libflash/test/test-ipmi-hiomap.c | 64 ++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 05e3ecf3c29f..b51803602a0d 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -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);
@@ -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 },
 };
 
-- 
2.19.1



More information about the Skiboot mailing list