From 8b652b505c17e022f42bc5730f97798babf72cb2 Mon Sep 17 00:00:00 2001 From: Arnie Reynoso Date: Wed, 19 Feb 2014 14:56:54 -0800 Subject: [PATCH] Linux/Qnx: MessageQBench test must check initial MSG put The MessageQBench test must ensure the initial MessageQ_put during the applications handshaking returns successful before continuing. --- linux/src/tests/MessageQBench.c | 15 +++++++++++---- qnx/src/tests/MessageQBench/MessageQBench.c | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/linux/src/tests/MessageQBench.c b/linux/src/tests/MessageQBench.c index 6317595..edbfc34 100644 --- a/linux/src/tests/MessageQBench.c +++ b/linux/src/tests/MessageQBench.c @@ -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: diff --git a/qnx/src/tests/MessageQBench/MessageQBench.c b/qnx/src/tests/MessageQBench/MessageQBench.c index 41f0e7f..63c36a2 100644 --- a/qnx/src/tests/MessageQBench/MessageQBench.c +++ b/qnx/src/tests/MessageQBench/MessageQBench.c @@ -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: -- 2.39.2