diff options
author | Sam Nelson <sam.nelson@ti.com> | 2019-10-08 00:51:51 -0400 |
---|---|---|
committer | Sam Nelson <sam.nelson@ti.com> | 2019-10-08 15:51:06 -0400 |
commit | 716f2b3489d8297394812a3e47ada8f236fa911a (patch) | |
tree | 03cfde19718d751353d62f085ab46aab5a7e58ca | |
parent | ad4367789a6846a391d8bb9c416bc3543567c603 (diff) | |
download | ipc-716f2b3489d8297394812a3e47ada8f236fa911a.tar.gz |
tests: Add error check to be more robust
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rw-r--r-- | packages/ti/ipc/tests/messageq_fault.c | 7 | ||||
-rw-r--r-- | packages/ti/ipc/tests/messageq_multi.c | 7 | ||||
-rw-r--r-- | packages/ti/ipc/tests/messageq_multimulti.c | 9 | ||||
-rw-r--r-- | packages/ti/ipc/tests/messageq_single.c | 5 | ||||
-rw-r--r-- | packages/ti/ipc/tests/ping_tasks.c | 6 |
5 files changed, 25 insertions, 9 deletions
diff --git a/packages/ti/ipc/tests/messageq_fault.c b/packages/ti/ipc/tests/messageq_fault.c index 35f2c9b..7298062 100644 --- a/packages/ti/ipc/tests/messageq_fault.c +++ b/packages/ti/ipc/tests/messageq_fault.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017, Texas Instruments Incorporated + * Copyright (c) 2012-2019, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,7 +58,7 @@ Int32 fxnFault(UInt32 faultId) { - Int32 a; + Int32 a=0; Void (*fxn)(void) = (Void (*)())0x96000000; volatile Int dummy = 0; @@ -123,6 +123,7 @@ Void tsk1Fxn(UArg arg0, UArg arg1) messageQ = MessageQ_create(localQueueName, NULL); if (messageQ == NULL) { System_abort("MessageQ_create failed\n"); + return; } System_printf("tsk1Fxn: created MessageQ: %s; QueueID: 0x%x\n", @@ -133,6 +134,8 @@ Void tsk1Fxn(UArg arg0, UArg arg1) System_printf("Awaiting sync message from host...\n"); MessageQ_get(messageQ, &msg, MessageQ_FOREVER); + Assert_isTrue(msg != NULL, NULL); + params = MessageQ_payload(msg); numLoops = params[0]; print = params[1]; diff --git a/packages/ti/ipc/tests/messageq_multi.c b/packages/ti/ipc/tests/messageq_multi.c index 5263d92..a9963ec 100644 --- a/packages/ti/ipc/tests/messageq_multi.c +++ b/packages/ti/ipc/tests/messageq_multi.c @@ -81,6 +81,7 @@ Void loopbackFxn(UArg arg0, UArg arg1) messageQ = MessageQ_create(localQueueName, NULL); if (messageQ == NULL) { System_abort("MessageQ_create failed\n"); + return; } System_printf("loopbackFxn: created MessageQ: %s; QueueID: 0x%x\n", @@ -90,8 +91,10 @@ Void loopbackFxn(UArg arg0, UArg arg1) while (msgId < NUMLOOPS) { /* Get a message */ status = MessageQ_get(messageQ, &getMsg, MessageQ_FOREVER); - if (status != MessageQ_S_SUCCESS) { - System_abort("This should not happen since timeout is forever\n"); + if ((status != MessageQ_S_SUCCESS) + || (getMsg == NULL)) { + System_abort("This should not happen since timeout is forever\n"); + return; } remoteQueueId = MessageQ_getReplyQueue(getMsg); diff --git a/packages/ti/ipc/tests/messageq_multimulti.c b/packages/ti/ipc/tests/messageq_multimulti.c index 746deba..f86e27e 100644 --- a/packages/ti/ipc/tests/messageq_multimulti.c +++ b/packages/ti/ipc/tests/messageq_multimulti.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014, Texas Instruments Incorporated + * Copyright (c) 2012-2019, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,6 +83,7 @@ Void loopbackFxn(UArg arg0, UArg arg1) messageQ = MessageQ_create(localQueueName, NULL); if (messageQ == NULL) { System_abort("MessageQ_create failed\n"); + return; } System_printf("loopbackFxn: created MessageQ: %s; QueueID: 0x%x\n", @@ -92,8 +93,10 @@ Void loopbackFxn(UArg arg0, UArg arg1) while (msgId < NUMLOOPS) { /* Get a message */ status = MessageQ_get(messageQ, &getMsg, MessageQ_FOREVER); - if (status != MessageQ_S_SUCCESS) { - System_abort("This should not happen since timeout is forever\n"); + if ((status != MessageQ_S_SUCCESS) + || (getMsg == NULL)) { + System_abort("This should not happen since timeout is forever\n"); + return; } remoteQueueId = MessageQ_getReplyQueue(getMsg); diff --git a/packages/ti/ipc/tests/messageq_single.c b/packages/ti/ipc/tests/messageq_single.c index 2bebc2e..696e1bf 100644 --- a/packages/ti/ipc/tests/messageq_single.c +++ b/packages/ti/ipc/tests/messageq_single.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014, Texas Instruments Incorporated + * Copyright (c) 2012-2019, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,6 +79,7 @@ Void tsk1Fxn(UArg arg0, UArg arg1) messageQ = MessageQ_create(localQueueName, NULL); if (messageQ == NULL) { System_abort("MessageQ_create failed\n"); + return; } System_printf("tsk1Fxn: created MessageQ: %s; QueueID: 0x%x\n", @@ -89,6 +90,7 @@ Void tsk1Fxn(UArg arg0, UArg arg1) System_printf("Awaiting sync message from host...\n"); MessageQ_get(messageQ, &msg, MessageQ_FOREVER); + Assert_isTrue(msg != NULL, NULL); params = MessageQ_payload(msg); numLoops = params[0]; print = params[1]; @@ -109,6 +111,7 @@ Void tsk1Fxn(UArg arg0, UArg arg1) for (i = 1; i <= numLoops; i++) { status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER); Assert_isTrue(status == MessageQ_S_SUCCESS, NULL); + Assert_isTrue(msg != NULL, NULL); params = MessageQ_payload(msg); msgId = params[0]; diff --git a/packages/ti/ipc/tests/ping_tasks.c b/packages/ti/ipc/tests/ping_tasks.c index 4f4026a..2c6be40 100644 --- a/packages/ti/ipc/tests/ping_tasks.c +++ b/packages/ti/ipc/tests/ping_tasks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2013, Texas Instruments Incorporated + * Copyright (c) 2011-2019, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,10 @@ Void copyTaskFxn(UArg arg0, UArg arg1) /* Create the messageQ for receiving (and get our endpoint for sending). */ handle = RPMessage_create(arg0, NULL, NULL, &myEndpoint); + if (handle == NULL) { + System_printf("RPMessage_create failed...\n"); + return; + } System_sprintf(desc, "sample%d", arg1); |