Updated Linux Client test to account for multiple alloc/free reference counts
[keystone-rtos/rm-lld.git] / test / k2k / armv7 / linux / rm_client_test.c
index 3df10de22719799ff17a5cd7b2304732552af8d1..691e60e43cd7ff4ccc801ed03c90e2ec98a4ebc5 100644 (file)
@@ -352,7 +352,7 @@ void transportReceive (void)
         return;
     }
     
-    if (length < sizeof(rm_pkt)) {
+    if (length < sizeof(*rm_pkt)) {
         error_msg("invalid RM message length %d\n", length);
         return;
     }
@@ -487,7 +487,16 @@ void cleanup(void)
     POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
                         coreNum, rmClientName, responseInfo.resourceName,
                         responseInfo.resourceBase, responseInfo.resourceLength, 
-                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);       
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ, 
+                 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ, 
                  800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
@@ -506,6 +515,25 @@ void cleanup(void)
                         coreNum, rmClientName, responseInfo.resourceName,
                         responseInfo.resourceBase, responseInfo.resourceLength, 
                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
                  7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);     
     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
@@ -513,7 +541,7 @@ void cleanup(void)
     POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
                         coreNum, rmClientName, responseInfo.resourceName,
                         responseInfo.resourceBase, responseInfo.resourceLength, 
-                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
                  0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);