[Skiboot] [PATCH v2 4/9] core/test/run-msg: Add callback function test

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Apr 9 21:49:24 AEST 2019


- Test callback function
- Add test case to test OPAL_PARTIAL return value.
- Add test for opal_queue_msg_buf().

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/test/run-msg.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/core/test/run-msg.c b/core/test/run-msg.c
index 839074d61..ed590733e 100644
--- a/core/test/run-msg.c
+++ b/core/test/run-msg.c
@@ -63,7 +63,7 @@ void opal_update_pending_evt(uint64_t evt_mask, uint64_t evt_values)
 static long magic = 8097883813087437089UL;
 static void callback(void *data, int status)
 {
-	assert(status == OPAL_SUCCESS);
+	assert((status == OPAL_SUCCESS || status == OPAL_PARTIAL));
         assert(*(uint64_t *)data == magic);
 }
 
@@ -228,9 +228,29 @@ int main(void)
         r = opal_get_msg(m_ptr, sizeof(m));
         assert(r == 0);
 
+	assert(list_count(&msg_pending_list) == --npending);
+	assert(list_count(&msg_free_list) == ++nfree);
+
         r = opal_get_msg(m_ptr, sizeof(m));
         assert(r == OPAL_RESOURCE);
 
+        /* Return OPAL_PARTIAL to callback */
+	r = opal_queue_msg(0, &magic, callback, 0, 1, 2, 3, 4, 5, 6, 7, 0xBADDA7A);
+	assert(r == 0);
+
+	assert(list_count(&msg_pending_list) == ++npending);
+	assert(list_count(&msg_free_list) == --nfree);
+
+	r = opal_get_msg(m_ptr, sizeof(m));
+	assert(r == OPAL_PARTIAL);
+
+	assert(list_count(&msg_pending_list) == --npending);
+	assert(list_count(&msg_free_list) == ++nfree);
+
+        /* return OPAL_PARAMETER */
+	r = opal_queue_msg_buf(0, NULL, NULL, OPAL_MSG_SIZE, m_ptr);
+	assert(r == OPAL_PARAMETER);
+
 #define test_queue_num(type, val) \
         r = opal_queue_msg(0, NULL, NULL, \
                 (type)val, (type)val, (type)val, (type)val, \
-- 
2.14.3



More information about the Skiboot mailing list