[Skiboot] [PATCH 50/51] test-ipmi-hiomap: Add window-recovery-failure-restore-read test
Andrew Jeffery
andrew at aj.id.au
Fri Feb 15 17:57:07 AEDT 2019
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
libflash/test/test-ipmi-hiomap.c | 119 +++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 394355092613..234c30bd76b5 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -3299,6 +3299,124 @@ static void test_hiomap_protocol_recovery_failure_restore_read(void)
scenario_exit();
}
+static const struct scenario_event
+scenario_hiomap_window_recovery_failure_restore_read[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_info_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
+ {
+ .type = scenario_event_p,
+ .p = &hiomap_create_read_window_qs0l1_rs0l1_call,
+ },
+ { .type = scenario_delay },
+ {
+ .type = scenario_sel,
+ .s = {
+ .bmc_state = HIOMAP_E_DAEMON_READY |
+ HIOMAP_E_WINDOW_RESET
+ }
+ },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 5,
+ .args = {
+ [0] = HIOMAP_E_WINDOW_RESET,
+ },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 5,
+ },
+ },
+ },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_CREATE_READ_WINDOW,
+ .seq = 6,
+ .args = {
+ [0] = 0x00, [1] = 0x00,
+ [2] = 0x01, [3] = 0x00,
+ },
+ },
+ .cc = IPMI_ERR_UNSPECIFIED,
+ },
+ },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 7,
+ .args = {
+ [0] = HIOMAP_E_WINDOW_RESET,
+ },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_ACK,
+ .seq = 7,
+ },
+ },
+ },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_CREATE_READ_WINDOW,
+ .seq = 8,
+ .args = {
+ [0] = 0x00, [1] = 0x00,
+ [2] = 0x01, [3] = 0x00,
+ },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_CREATE_READ_WINDOW,
+ .seq = 8,
+ .args = {
+ [0] = 0xff, [1] = 0x0f,
+ [2] = 0x01, [3] = 0x00,
+ [4] = 0x00, [5] = 0x00,
+ },
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+
+};
+
+static void test_hiomap_window_recovery_restore_read(void)
+{
+ struct blocklevel_device *bl;
+ struct ipmi_hiomap *ctx;
+ size_t len;
+ void *buf;
+
+ scenario_enter(scenario_hiomap_window_recovery_failure_restore_read);
+ assert(!ipmi_hiomap_init(&bl));
+ ctx = container_of(bl, struct ipmi_hiomap, bl);
+ len = 1 << ctx->block_size_shift;
+ /*
+ * We're reading the same block 3 times - it's irrelevant, we're just
+ * trying to manipulate window state
+ */
+ buf = calloc(1, len);
+ assert(buf);
+ assert(!bl->read(bl, 0, buf, len));
+ scenario_advance();
+ assert(bl->read(bl, 0, buf, len) > 0);
+ assert(!bl->read(bl, 0, buf, len));
+ free(buf);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
struct test_case {
const char *name;
void (*fn)(void);
@@ -3359,6 +3477,7 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_protocol_recovery_failure_get_flash_info),
TEST_CASE(test_hiomap_protocol_recovery_failure_restore_write),
TEST_CASE(test_hiomap_protocol_recovery_failure_restore_read),
+ TEST_CASE(test_hiomap_window_recovery_restore_read),
{ NULL, NULL },
};
--
2.19.1
More information about the Skiboot
mailing list