aboutsummaryrefslogtreecommitdiff
path: root/libflash/test
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:14 +1030
committerStewart Smith <stewart@linux.ibm.com>2019-02-24 17:43:37 -0600
commit41e6e8b4acf7951997679c7459ad37187e9d41f0 (patch)
tree466cb3288c1830ac886a46a83c5a21b4f8b414e2 /libflash/test
parent4af122b23402ca163012de527277901d7770c376 (diff)
downloadskiboot-41e6e8b4acf7951997679c7459ad37187e9d41f0.zip
skiboot-41e6e8b4acf7951997679c7459ad37187e9d41f0.tar.gz
skiboot-41e6e8b4acf7951997679c7459ad37187e9d41f0.tar.bz2
test-ipmi-hiomap: Add protocol-persistent-error test
Cc: stable Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/test')
-rw-r--r--libflash/test/test-ipmi-hiomap.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 4e1232f..08c9b32 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1,5 +1,6 @@
#include <assert.h>
#include <ccan/container_of/container_of.h>
+#include <libflash/blocklevel.h>
#include <lock.h>
#include <lpc.h>
#include <hiomap.h>
@@ -12,6 +13,9 @@
#include "../ipmi-hiomap.h"
#include "../errors.h"
+/* Stub for blocklevel debug macros */
+bool libflash_debug;
+
const struct bmc_sw_config bmc_sw_hiomap = {
.ipmi_oem_hiomap_cmd = IPMI_CODE(0x3a, 0x5a),
};
@@ -638,6 +642,34 @@ static void test_hiomap_protocol_reset_recovery(void)
free(buf);
}
+static const struct scenario_event
+scenario_hiomap_protocol_persistent_error[] = {
+ { .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_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_protocol_persistent_error(void)
+{
+ struct blocklevel_device *bl;
+ struct ipmi_hiomap *ctx;
+ char buf;
+ int rc;
+
+ scenario_enter(scenario_hiomap_protocol_persistent_error);
+ assert(!ipmi_hiomap_init(&bl));
+ ctx = container_of(bl, struct ipmi_hiomap, bl);
+ assert(ctx->bmc_state == HIOMAP_E_PROTOCOL_RESET);
+ rc = bl->read(bl, 0, &buf, sizeof(buf));
+ assert(rc == FLASH_ERR_DEVICE_GONE);
+ rc = bl->read(bl, 0, &buf, sizeof(buf));
+ assert(rc == FLASH_ERR_DEVICE_GONE);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
struct test_case {
const char *name;
void (*fn)(void);
@@ -653,6 +685,7 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_event_daemon_lost_flash_control),
TEST_CASE(test_hiomap_event_daemon_regained_flash_control_dirty),
TEST_CASE(test_hiomap_protocol_reset_recovery),
+ TEST_CASE(test_hiomap_protocol_persistent_error),
{ NULL, NULL },
};