]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Linux/Qnx: MessageQBench test must check initial MSG put
authorArnie Reynoso <arnier@ti.com>
Wed, 19 Feb 2014 22:56:54 +0000 (14:56 -0800)
committerChris Ring <cring@ti.com>
Fri, 21 Feb 2014 16:45:37 +0000 (08:45 -0800)
The MessageQBench test must ensure the initial MessageQ_put during
the applications handshaking returns successful before continuing.

linux/src/tests/MessageQBench.c
qnx/src/tests/MessageQBench/MessageQBench.c

index 63175953c5353c8439e3c85761ad5119145698c2..edbfc34e39ceaba4f8125ae26d6135987edb169f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -125,15 +125,20 @@ Int MessageQApp_execute(UInt32 numLoops, UInt32 payloadSize, UInt16 procId)
     msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg) + payloadSize);
     if (msg == NULL) {
         printf("Error in MessageQ_alloc\n");
-        MessageQ_close(&queueId);
-        goto cleanup;
+        goto close_cleanup;
     }
 
     /* handshake with remote to set the number of loops */
     MessageQ_setReplyQueue(msgqHandle, msg);
     ((SyncMsg *)msg)->numLoops = numLoops;
     ((SyncMsg *)msg)->print = FALSE;
-    MessageQ_put(queueId, msg);
+
+    status = MessageQ_put(queueId, msg);
+    if (status < 0) {
+        printf("MessageQ_put handshake failed [%d]\n", status);
+        goto free_cleanup;
+     }
+
     MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
 
     printf("Exchanging %d messages with remote processor %s...\n",
@@ -180,7 +185,9 @@ Int MessageQApp_execute(UInt32 numLoops, UInt32 payloadSize, UInt16 procId)
                MultiProc_getName(procId), elapsed / numLoops);
     }
 
+free_cleanup:
     MessageQ_free(msg);
+close_cleanup:
     MessageQ_close(&queueId);
 
 cleanup:
index 41f0e7fcbf7a85a49a2acc2a138031a81795d49f..63c36a2606b18a915a8599f5cc0db80fda274549 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -125,15 +125,20 @@ Int MessageQApp_execute(UInt32 numLoops, UInt32 payloadSize, UInt16 procId)
     msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg) + payloadSize);
     if (msg == NULL) {
         printf("Error in MessageQ_alloc\n");
-        MessageQ_close(&queueId);
-        goto cleanup;
+        goto close_cleanup;
     }
 
     /* handshake with remote to set the number of loops */
     MessageQ_setReplyQueue(msgqHandle, msg);
     ((SyncMsg *)msg)->numLoops = numLoops;
     ((SyncMsg *)msg)->print = FALSE;
-    MessageQ_put(queueId, msg);
+
+    status = MessageQ_put(queueId, msg);
+    if (status < 0) {
+        printf("MessageQ_put handshake failed [%d]\n", status);
+        goto free_cleanup;
+     }
+
     MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
 
     printf("Exchanging %d messages with remote processor %s...\n",
@@ -180,7 +185,9 @@ Int MessageQApp_execute(UInt32 numLoops, UInt32 payloadSize, UInt16 procId)
                MultiProc_getName(procId), elapsed / numLoops);
     }
 
+free_cleanup:
     MessageQ_free(msg);
+close_cleanup:
     MessageQ_close(&queueId);
 
 cleanup: