7474static uint16_t pktioEvtMask = 0x0000U ;
7575static uint16_t evtGroupCreate = 0x0001U ;
7676
77- int NumLoops ;
7877
7978static int recvCount = 0 ;
79+ static int testInfiniteLoop = 0 ;
8080
8181static int eventDesiredCount = 0 ;
8282static uint16_t desiredPktioEvtMask = 0x0000U ;
@@ -182,7 +182,6 @@ CellularTokenTable_t tokenTableWithoutSuccessTable =
182182void setUp ()
183183{
184184 /*Assume no loops unless we specify in a test */
185- NumLoops = 0 ;
186185 setBitFromIsrReturn = 1 ;
187186 higherPriorityTaskWokenReturn = 1 ;
188187 isWrongString = 0 ;
@@ -192,6 +191,7 @@ void setUp()
192191 tokenTableType = 0 ;
193192 recvCommFail = 0 ;
194193 setpktDataPrefixCBReturn = 0 ;
194+ testInfiniteLoop = 0 ;
195195}
196196
197197/* Called after each test method. */
@@ -248,6 +248,15 @@ uint16_t MockPlatformEventGroup_WaitBits( PlatformEventGroupHandle_t groupEvent,
248248 ( void ) xWaitForAllBits ;
249249 ( void ) xTicksToWait ;
250250
251+ if ( testInfiniteLoop > 0 )
252+ {
253+ testInfiniteLoop -- ;
254+ }
255+ else if ( recvCount == 0 )
256+ {
257+ return PKTIO_EVT_MASK_ABORT ;
258+ }
259+
251260 return pktioEvtMask ;
252261}
253262
@@ -780,7 +789,6 @@ void test__Cellular_PktioInit_Thread_Receive_Abort_Event( void )
780789
781790 /* Test the abort event. */
782791 pktioEvtMask = PKTIO_EVT_MASK_ABORT ;
783- NumLoops = 3 ;
784792 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
785793 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
786794 TEST_ASSERT_EQUAL ( CELLULAR_PKT_STATUS_OK , pktStatus );
@@ -804,7 +812,7 @@ void test__Cellular_PktioInit_Thread_Empty_Case( void )
804812
805813 /* Test PKTIO_EVT_MASK_STARTED event for _pktioReadThread empty else case. */
806814 pktioEvtMask = PKTIO_EVT_MASK_STARTED ;
807- NumLoops = 3 ;
815+ testInfiniteLoop = 1 ;
808816 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
809817 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
810818 TEST_ASSERT_EQUAL ( CELLULAR_PKT_STATUS_OK , pktStatus );
@@ -828,7 +836,6 @@ void test__Cellular_PktioInit_String_Wo_Terminator( void )
828836
829837 /* Test the rx_data event with CELLULAR_AT_WO_PREFIX resp. */
830838 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
831- NumLoops = 2 ;
832839 recvCount = 1 ;
833840 atCmdType = CELLULAR_AT_WO_PREFIX ;
834841 tokenTableType = 4 ;
@@ -859,7 +866,6 @@ void test__Cellular_PktioInit_String_With_NewLine( void )
859866
860867 /* Test the rx_data event with CELLULAR_AT_WO_PREFIX resp. */
861868 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
862- NumLoops = 2 ;
863869 recvCount = 1 ;
864870 atCmdType = CELLULAR_AT_WO_PREFIX ;
865871 tokenTableType = 5 ;
@@ -895,7 +901,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_MULTI_DATA_WO_PRE
895901
896902 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
897903 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
898- NumLoops = 2 ;
899904 recvCount = 2 ;
900905 atCmdType = CELLULAR_AT_MULTI_DATA_WO_PREFIX ;
901906
@@ -928,7 +933,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_pktDataPrefixCB_CELLULAR_PKT_
928933 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
929934 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
930935 atCmdType = CELLULAR_AT_MULTI_DATA_WO_PREFIX ;
931- NumLoops = 2 ;
932936 recvCount = 2 ;
933937
934938 /* set pktDataPrefixCB return CELLULAR_PKT_STATUS_SIZE_MISMATCH. */
@@ -964,7 +968,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_pktDataPrefixCB_CELLULAR_PKT_
964968 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
965969 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
966970 atCmdType = CELLULAR_AT_MULTI_DATA_WO_PREFIX ;
967- NumLoops = 2 ;
968971 recvCount = 2 ;
969972
970973 /* set pktDataPrefixCB return CELLULAR_PKT_STATUS_BAD_PARAM. */
@@ -999,7 +1002,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_pktDataPrefixCB_RECV_DATA_LEN
9991002 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
10001003 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
10011004 atCmdType = CELLULAR_AT_MULTI_DATA_WO_PREFIX ;
1002- NumLoops = 2 ;
10031005 recvCount = 2 ;
10041006
10051007 pktDataPrefixCBReturn = 0 ;
@@ -1036,15 +1038,13 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_pktDataPrefixCB__handleLeftov
10361038 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
10371039 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
10381040
1039- NumLoops = 2 ;
10401041 recvCount = 2 ;
10411042 pktDataPrefixCBReturn = 0 ;
10421043 recvDataLenFail = 1 ;
10431044 /* Call _Cellular_PktioInit to get partialDataRcvdLen. */
10441045 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
10451046
10461047 /* handle _handleLeftoverBuffer function case. */
1047- NumLoops = 23 ;
10481048 recvCount = 23 ;
10491049 recvCommFail = 1 ;
10501050 pktDataPrefixCBReturn = 1 ;
@@ -1079,7 +1079,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_pktDataPrefixCB__Test( void )
10791079 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
10801080 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
10811081
1082- NumLoops = 3 ;
10831082 recvCount = 3 ;
10841083 pktDataPrefixCBReturn = 0 ;
10851084 setpktDataPrefixCBReturn = 1 ;
@@ -1108,7 +1107,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_MULTI_WITH_PREFIX
11081107
11091108 /* Test the rx_data event with CELLULAR_AT_MULTI_WITH_PREFIX resp. */
11101109 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1111- NumLoops = 10 ;
11121110 recvCount = 2 ;
11131111 atCmdType = CELLULAR_AT_MULTI_WITH_PREFIX ;
11141112 /* copy the token table. */
@@ -1138,7 +1136,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_MULTI_WO_PREFIX(
11381136
11391137 /* Test the rx_data event with CELLULAR_AT_MULTI_WO_PREFIX resp. */
11401138 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1141- NumLoops = 2 ;
11421139 recvCount = 2 ;
11431140 atCmdType = CELLULAR_AT_MULTI_WO_PREFIX ;
11441141 /* copy the token table. */
@@ -1168,7 +1165,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_NO_COMMAND( void
11681165
11691166 /* Test the rx_data event with CELLULAR_AT_NO_COMMAND resp. */
11701167 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1171- NumLoops = 2 ;
11721168 recvCount = 2 ;
11731169 atCmdType = CELLULAR_AT_NO_COMMAND ;
11741170 /* copy the token table. */
@@ -1198,7 +1194,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_MULTI_WO_PREFIX_W
11981194
11991195 /* Test the rx_data event with CELLULAR_AT_MULTI_WO_PREFIX resp. */
12001196 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1201- NumLoops = 2 ;
12021197 recvCount = 2 ;
12031198 atCmdType = CELLULAR_AT_MULTI_WO_PREFIX ;
12041199 /* copy the token table. */
@@ -1211,7 +1206,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_MULTI_WO_PREFIX_W
12111206 setUp ();
12121207 /* Test the rx_data event with CELLULAR_AT_MULTI_WO_PREFIX resp. */
12131208 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1214- NumLoops = 2 ;
12151209 recvCount = 2 ;
12161210 atCmdType = CELLULAR_AT_MULTI_WO_PREFIX ;
12171211 /* copy the token table. */
@@ -1240,7 +1234,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_WITH_PREFIX_STRIN
12401234
12411235 /* Test the rx_data event with CELLULAR_AT_WITH_PREFIX resp. */
12421236 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1243- NumLoops = 4 ;
12441237 recvCount = 4 ;
12451238 atCmdType = CELLULAR_AT_WITH_PREFIX ;
12461239 /* copy the token table. */
@@ -1270,7 +1263,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_WITH_PREFIX_STRIN
12701263
12711264 /* Test the rx_data event with CELLULAR_AT_WITH_PREFIX resp. */
12721265 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1273- NumLoops = 2 ;
12741266 recvCount = 2 ;
12751267 atCmdType = CELLULAR_AT_WITH_PREFIX ;
12761268 /* copy the token table. */
@@ -1300,7 +1292,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_WO_PREFIX_STRING_
13001292
13011293 /* Test the rx_data event with CELLULAR_AT_WO_PREFIX resp. */
13021294 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1303- NumLoops = 2 ;
13041295 recvCount = 2 ;
13051296 atCmdType = CELLULAR_AT_WO_PREFIX ;
13061297 /* copy the token table. */
@@ -1339,7 +1330,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_TOKEN_TABLE_SUCCESS_TOKEN( vo
13391330
13401331 /* Set success token. */
13411332 tokenTableType = 1 ;
1342- NumLoops = 2 ;
13431333 recvCount = 2 ;
13441334 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
13451335 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
@@ -1372,7 +1362,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_TOKEN_TABLE_ERROR_TOKEN( void
13721362
13731363 /* Set error token. */
13741364 tokenTableType = 2 ;
1375- NumLoops = 2 ;
13761365 recvCount = 2 ;
13771366 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
13781367 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
@@ -1405,7 +1394,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_TOKEN_TABLE_EXTRA_TOKEN( void
14051394
14061395 /* Set extra token. */
14071396 tokenTableType = 3 ;
1408- NumLoops = 2 ;
14091397 recvCount = 2 ;
14101398 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
14111399 pktStatus = _Cellular_PktioInit ( & context , NULL );
@@ -1438,7 +1426,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_TOKEN_TABLE_SUCCESS_TOKEN_MEM
14381426
14391427 /* Set success token. */
14401428 tokenTableType = 1 ;
1441- NumLoops = 2 ;
14421429 recvCount = 2 ;
14431430 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
14441431 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
@@ -1463,7 +1450,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_CELLULAR_AT_NO_RESULT_URC_TOK
14631450
14641451 /* Test the rx_data event with CELLULAR_AT_WO_PREFIX resp. */
14651452 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1466- NumLoops = 2 ;
14671453 recvCount = 2 ;
14681454 atCmdType = CELLULAR_AT_NO_RESULT ;
14691455 /* copy the token table. */
@@ -1493,7 +1479,6 @@ void test__Cellular_PktioInit_Thread_Rx_Data_Event_URC_TOKEN_STRING_RESP( void )
14931479
14941480 /* Test the rx_data event with CELLULAR_AT_NO_COMMAND resp. */
14951481 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1496- NumLoops = 2 ;
14971482 recvCount = 2 ;
14981483 atCmdType = CELLULAR_AT_NO_COMMAND ;
14991484 /* copy the token table. */
@@ -1522,6 +1507,7 @@ void test__Cellular_PktioInit_Event_Aborted( void )
15221507 /* Test the aborted event. */
15231508 pktioEvtMask = PKTIO_EVT_MASK_ABORTED ;
15241509 evtGroupCreate = 1U ;
1510+ recvCount = 1 ;
15251511 /* Check that CELLULAR_PKT_STATUS_OK is returned. */
15261512 pktStatus = _Cellular_PktioInit ( & context , PktioHandlePacketCallback_t );
15271513 TEST_ASSERT_EQUAL ( CELLULAR_PKT_STATUS_FAILURE , pktStatus );
@@ -1584,7 +1570,6 @@ void test__Cellular_PktioInit_No_UrcToken_Prefix_Table( void )
15841570
15851571 /* Test the rx_data event with CELLULAR_AT_MULTI_DATA_WO_PREFIX resp. */
15861572 pktioEvtMask = PKTIO_EVT_MASK_RX_DATA ;
1587- NumLoops = 1 ;
15881573 recvCount = 1 ;
15891574 atCmdType = CELLULAR_AT_MULTI_DATA_WO_PREFIX ;
15901575 /* copy the token table. */
0 commit comments