aboutsummaryrefslogtreecommitdiff
path: root/libflash
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-04-08 11:35:39 +0530
committerStewart Smith <stewart@linux.ibm.com>2019-04-09 11:49:52 +1000
commit9facf33360549ce3ab82b4d1c4478332735cd16e (patch)
treea89c91fc118cbcd893b4a08c03160e2f13c592ec /libflash
parentdfa935ebaa5438bfd2b4623743a54686fecce353 (diff)
downloadskiboot-9facf33360549ce3ab82b4d1c4478332735cd16e.zip
skiboot-9facf33360549ce3ab82b4d1c4478332735cd16e.tar.gz
skiboot-9facf33360549ce3ab82b4d1c4478332735cd16e.tar.bz2
test-ipmi-hiomap: Add write-one-byte test
Add test case to write: - 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>
Diffstat (limited to 'libflash')
-rw-r--r--libflash/test/test-ipmi-hiomap.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index bf31a0e..b8f24a9 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1061,6 +1061,23 @@ static void test_hiomap_protocol_write_one_block(void)
scenario_exit();
}
+static void test_hiomap_protocol_write_one_byte(void)
+{
+ struct blocklevel_device *bl;
+ uint8_t *buf;
+ size_t len;
+
+ scenario_enter(scenario_hiomap_protocol_write_one_block);
+ assert(!ipmi_hiomap_init(&bl));
+ len = 1;
+ buf = calloc(1, len);
+ assert(buf);
+ assert(!bl->write(bl, 0, buf, len));
+ free(buf);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
static const struct scenario_event
scenario_hiomap_protocol_write_two_blocks[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -1128,6 +1145,25 @@ static void test_hiomap_protocol_write_two_blocks(void)
scenario_exit();
}
+static void test_hiomap_protocol_write_1block_1byte(void)
+{
+ struct blocklevel_device *bl;
+ struct ipmi_hiomap *ctx;
+ uint8_t *buf;
+ size_t len;
+
+ scenario_enter(scenario_hiomap_protocol_write_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->write(bl, 0, buf, len));
+ free(buf);
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
static const struct scenario_event
scenario_hiomap_protocol_write_one_block_twice[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
@@ -3079,7 +3115,9 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_protocol_event_before_read),
TEST_CASE(test_hiomap_protocol_event_during_read),
TEST_CASE(test_hiomap_protocol_write_one_block),
+ TEST_CASE(test_hiomap_protocol_write_one_byte),
TEST_CASE(test_hiomap_protocol_write_two_blocks),
+ TEST_CASE(test_hiomap_protocol_write_1block_1byte),
TEST_CASE(test_hiomap_protocol_write_one_block_twice),
TEST_CASE(test_hiomap_protocol_event_before_write),
TEST_CASE(test_hiomap_protocol_event_during_write),