From 077d19d8240552153688bef86a5f08c76197ed46 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Thu, 21 Feb 2019 16:58:27 +1030 Subject: test-ipmi-hiomap: Add bad-sequence test Cc: stable Signed-off-by: Andrew Jeffery Signed-off-by: Stewart Smith --- libflash/test/test-ipmi-hiomap.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c index 95bb353..6e9d8e7 100644 --- a/libflash/test/test-ipmi-hiomap.c +++ b/libflash/test/test-ipmi-hiomap.c @@ -1296,6 +1296,36 @@ static void test_hiomap_protocol_event_during_erase(void) scenario_exit(); } +static const struct scenario_event scenario_hiomap_protocol_bad_sequence[] = { + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_ACK, + .seq = 1, + .args = { + [0] = HIOMAP_E_ACK_MASK, + }, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_ACK, + .seq = 0, + }, + }, + }, + SCENARIO_SENTINEL, +}; + +static void test_hiomap_protocol_bad_sequence(void) +{ + struct blocklevel_device *bl; + + scenario_enter(scenario_hiomap_protocol_bad_sequence); + 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, }, @@ -1351,6 +1381,7 @@ struct test_case test_cases[] = { TEST_CASE(test_hiomap_protocol_erase_two_blocks), 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_persistent_error), { NULL, NULL }, }; -- cgit v1.1