aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:39 +1030
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-03-04 21:22:51 +0530
commit90ae8a0767ceff33125ae13cc8eff9373361ac72 (patch)
tree1cb6d74b520eb45b55ad2c014150ae397b7db769
parent66b4b2e49d465c016cdcebd5ea89f27945cb2f75 (diff)
downloadskiboot-90ae8a0767ceff33125ae13cc8eff9373361ac72.zip
skiboot-90ae8a0767ceff33125ae13cc8eff9373361ac72.tar.gz
skiboot-90ae8a0767ceff33125ae13cc8eff9373361ac72.tar.bz2
test-ipmi-hiomap: Add get-info-malformed tests
[ Upstream commit 8745e91d48d16900f754849e6e8ec35c78eaa7a8 ] Cc: stable Signed-off-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.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 05e3ecf..b518036 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1756,6 +1756,68 @@ static void test_hiomap_ack_malformed_large(void)
scenario_exit();
}
+static const struct scenario_event
+scenario_hiomap_get_info_malformed_small[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_GET_INFO,
+ .seq = 2,
+ .args = { [0] = 0x2 },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 7,
+ .resp = {
+ .cmd = HIOMAP_C_GET_INFO,
+ .seq = 2,
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_get_info_malformed_small(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_get_info_malformed_small);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
+static const struct scenario_event
+scenario_hiomap_get_info_malformed_large[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_GET_INFO,
+ .seq = 2,
+ .args = { [0] = 0x2 },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp_size = 9,
+ .resp = {
+ .cmd = HIOMAP_C_GET_INFO,
+ .seq = 2,
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_get_info_malformed_large(void)
+{
+ struct blocklevel_device *bl;
+
+ scenario_enter(scenario_hiomap_get_info_malformed_large);
+ assert(ipmi_hiomap_init(&bl) > 0);
+ scenario_exit();
+}
+
struct test_case {
const char *name;
void (*fn)(void);
@@ -1797,6 +1859,8 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_erase_error),
TEST_CASE(test_hiomap_ack_malformed_small),
TEST_CASE(test_hiomap_ack_malformed_large),
+ TEST_CASE(test_hiomap_get_info_malformed_small),
+ TEST_CASE(test_hiomap_get_info_malformed_large),
{ NULL, NULL },
};