diff mbox series

[v2,29/52] test-ipmi-hiomap: Add action-error test

Message ID 20190221062851.21958-30-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 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 6e9d8e7f3007..7e7689196307 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1326,6 +1326,35 @@  static void test_hiomap_protocol_bad_sequence(void)
 	scenario_exit();
 }
 
+static const struct scenario_event scenario_hiomap_protocol_action_error[] = {
+	{
+		.type = scenario_cmd,
+		.c = {
+			/* Ack is legitimate, but we'll pretend it's invalid */
+			.req = {
+				.cmd = HIOMAP_C_ACK,
+				.seq = 1,
+				.args = { [0] = 0x3 },
+			},
+			.cc = IPMI_INVALID_COMMAND_ERR,
+			.resp = {
+				.cmd = HIOMAP_C_ACK,
+				.seq = 1,
+			},
+		},
+	},
+	SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_protocol_action_error(void)
+{
+	struct blocklevel_device *bl;
+
+	scenario_enter(scenario_hiomap_protocol_action_error);
+	assert(ipmi_hiomap_init(&bl) > 0);
+	scenario_exit();
+}
+
 static const struct scenario_event
 scenario_hiomap_protocol_persistent_error[] = {
 	{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -1382,6 +1411,7 @@  struct test_case test_cases[] = {
 	TEST_CASE(test_hiomap_protocol_event_before_erase),
 	TEST_CASE(test_hiomap_protocol_event_during_erase),
 	TEST_CASE(test_hiomap_protocol_bad_sequence),
+	TEST_CASE(test_hiomap_protocol_action_error),
 	TEST_CASE(test_hiomap_protocol_persistent_error),
 	{ NULL, NULL },
 };