aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-04-08 11:35:41 +0530
committeroohal <oohal@users.noreply.github.com>2019-05-09 17:05:56 +1000
commit365da17acd186562e6b90c41a948ed88bde0e5e5 (patch)
tree5b7f34cf66294f02b091a932e53155070433ce7f
parent7ca01934d0f16efcc911f319d31b8666e4aa2880 (diff)
downloadskiboot-365da17acd186562e6b90c41a948ed88bde0e5e5.zip
skiboot-365da17acd186562e6b90c41a948ed88bde0e5e5.tar.gz
skiboot-365da17acd186562e6b90c41a948ed88bde0e5e5.tar.bz2
test-ipmi-hiomap: Add read-one-byte test
[ Upstream commit 857f046d3ab00ec12dcb06ddabfed6bdfe00a819 ] Add test case to read: - 1 byte - 1 block and 1 byte data Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
-rw-r--r--libflash/test/test-ipmi-hiomap.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index abc9777..e1bc5ef 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -874,6 +874,24 @@ static void test_hiomap_protocol_read_one_block(void)
scenario_exit();
}
+static void test_hiomap_protocol_read_one_byte(void)
+{
+ struct blocklevel_device *bl;
+ uint8_t *buf;
+ size_t len;
+
+ scenario_enter(scenario_hiomap_protocol_read_one_block);
+ assert(!ipmi_hiomap_init(&bl));
+ len = 1;
+ buf = calloc(1, len);
+ assert(buf);
+ assert(!bl->read(bl, 0, buf, len));
+ assert(lpc_read_success(buf, len));
+ free(buf);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
static const struct scenario_event
scenario_hiomap_protocol_read_two_blocks[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -929,6 +947,26 @@ static void test_hiomap_protocol_read_two_blocks(void)
scenario_exit();
}
+static void test_hiomap_protocol_read_1block_1byte(void)
+{
+ struct blocklevel_device *bl;
+ struct ipmi_hiomap *ctx;
+ uint8_t *buf;
+ size_t len;
+
+ scenario_enter(scenario_hiomap_protocol_read_two_blocks);
+ assert(!ipmi_hiomap_init(&bl));
+ ctx = container_of(bl, struct ipmi_hiomap, bl);
+ len = (1 << ctx->block_size_shift) + 1;
+ buf = calloc(1, len);
+ assert(buf);
+ assert(!bl->read(bl, 0, buf, len));
+ assert(lpc_read_success(buf, len));
+ free(buf);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
static const struct scenario_event
scenario_hiomap_protocol_read_one_block_twice[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -3112,7 +3150,9 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_event_daemon_regained_flash_control_dirty),
TEST_CASE(test_hiomap_protocol_reset_recovery),
TEST_CASE(test_hiomap_protocol_read_one_block),
+ TEST_CASE(test_hiomap_protocol_read_one_byte),
TEST_CASE(test_hiomap_protocol_read_two_blocks),
+ TEST_CASE(test_hiomap_protocol_read_1block_1byte),
TEST_CASE(test_hiomap_protocol_read_one_block_twice),
TEST_CASE(test_hiomap_protocol_event_before_read),
TEST_CASE(test_hiomap_protocol_event_during_read),