Return status of the test

Adding a new status code to return if there are any test failures.
This helps to automate these arch-tests on the running host.
diff --git a/api-tests/val/common/val.h b/api-tests/val/common/val.h
index f2ccf7a..243c584 100644
--- a/api-tests/val/common/val.h
+++ b/api-tests/val/common/val.h
@@ -241,6 +241,7 @@
   VAL_STATUS_UNSUPPORTED                 = 0x2B,
   VAL_STATUS_DRIVER_FN_FAILED            = 0x2C,
   VAL_STATUS_NO_TESTS                    = 0X2D,
+  VAL_STATUS_TEST_FAILED                 = 0x2E,
   VAL_STATUS_ERROR_MAX                   = INT_MAX,
 } val_status_t;
 
diff --git a/api-tests/val/nspe/val_dispatcher.c b/api-tests/val/nspe/val_dispatcher.c
index eff584f..5d6da4e 100644
--- a/api-tests/val/nspe/val_dispatcher.c
+++ b/api-tests/val/nspe/val_dispatcher.c
@@ -313,9 +313,9 @@
     @brief    - This function is responsible for setting up VAL infrastructure.
                 Loads test one by one from combine binary and calls test_entry
                 function of each test image.
-    @return   - none
+    @return   - 0 if success Or error code for the failure.
 **/
-void val_dispatcher(test_id_t test_id_prev)
+int32_t val_dispatcher(test_id_t test_id_prev)
 {
 
     test_id_t            test_id;
@@ -332,7 +332,7 @@
     if (VAL_ERROR(status))
     {
         val_print(PRINT_ERROR, "\n\ttarget config read failed", 0);
-        return;
+        return status;
     }
 
     combine_test_binary_addr   = misc_desc->ns_start_addr_of_combine_test_binary;
@@ -342,7 +342,7 @@
         status = val_get_boot_flag(&boot.state);
         if (VAL_ERROR(status))
         {
-            return;
+            return status;
         }
 
         /* Did last run test hang and system re-booted due to watchdog timeout and
@@ -356,7 +356,7 @@
             if (VAL_ERROR(status))
             {
                 val_print(PRINT_ERROR, "\n\tNVMEM read error", 0);
-                return;
+                return status;
             }
         }
         /* Did last run test hang and system reset due to watchdog timeout but
@@ -372,7 +372,7 @@
             if (VAL_ERROR(status))
             {
                 val_print(PRINT_ERROR, "\n\tNVMEM read error", 0);
-                return;
+                return status;
             }
         }
         else
@@ -381,7 +381,7 @@
 
             if (VAL_ERROR(status))
             {
-                return;
+                return status;
             }
             else if (test_id == VAL_INVALID_TEST_ID)
             {
@@ -393,7 +393,7 @@
             if (VAL_ERROR(status))
             {
                 val_print(PRINT_ERROR, "\n\tNVMEM write error", 0);
-                return;
+                return status;
             }
 
             if (VAL_GET_COMP_NUM(test_id_prev) != VAL_GET_COMP_NUM(test_id))
@@ -409,7 +409,7 @@
                 status = val_set_boot_flag(BOOT_NOT_EXPECTED);
                 if (VAL_ERROR(status))
                 {
-                    return;
+                    return status;
                 }
             }
             val_execute_test_fn();
@@ -421,7 +421,7 @@
         status = val_set_boot_flag(BOOT_UNKNOWN);
         if (VAL_ERROR(status))
         {
-            return;
+            return status;
         }
 
         /* Prepare suite summary data structure */
@@ -429,7 +429,7 @@
         if (VAL_ERROR(status))
         {
             val_print(PRINT_ERROR, "\n\tNVMEM read error", 0);
-            return;
+            return status;
         }
 
         switch (test_result)
@@ -452,7 +452,7 @@
         if (VAL_ERROR(status))
         {
             val_print(PRINT_ERROR, "\n\tNVMEM write error", 0);
-            return;
+            return status;
         }
 
         test_id_prev = test_id;
@@ -461,7 +461,7 @@
         if (VAL_ERROR(status))
         {
             val_print(PRINT_ERROR, "\n\tNVMEM write error", 0);
-            return;
+            return status;
         }
 
    } while(1);
@@ -470,7 +470,7 @@
    if (VAL_ERROR(status))
    {
        val_print(PRINT_ERROR, "\n\tNVMEM read error", 0);
-       return;
+       return status;
    }
 
    val_print(PRINT_ALWAYS, "\n************ ", 0);
@@ -483,6 +483,8 @@
    val_print(PRINT_ALWAYS, "TOTAL FAILED    : %d\n", test_count.fail_cnt);
    val_print(PRINT_ALWAYS, "TOTAL SKIPPED   : %d\n", test_count.skip_cnt);
    val_print(PRINT_ALWAYS, "******************************************\n", 0);
+
+   return (test_count.fail_cnt > 0) ? VAL_STATUS_TEST_FAILED : VAL_STATUS_SUCCESS ;
 }
 
 
diff --git a/api-tests/val/nspe/val_dispatcher.h b/api-tests/val/nspe/val_dispatcher.h
index 9adc98f..173e8c6 100644
--- a/api-tests/val/nspe/val_dispatcher.h
+++ b/api-tests/val/nspe/val_dispatcher.h
@@ -66,5 +66,5 @@
     uint32_t  elf_size;
 } test_header_t;
 
-void val_dispatcher(test_id_t);
+int32_t val_dispatcher(test_id_t);
 #endif
diff --git a/api-tests/val/nspe/val_entry.c b/api-tests/val/nspe/val_entry.c
index cff5ded..f0a44dd 100644
--- a/api-tests/val/nspe/val_entry.c
+++ b/api-tests/val/nspe/val_entry.c
@@ -23,18 +23,21 @@
 /**
     @brief    - PSA C main function, does VAL init and calls test dispatcher
     @param    - None
-    @return   - void
+    @return   - status - error code 
 **/
-void val_entry(void)
+int32_t val_entry(void)
 {
     test_id_t       test_id;
+    int32_t         status;
 
-    if (VAL_ERROR(val_uart_init()))
+    status = val_uart_init();
+    if (VAL_ERROR(status))
     {
         goto exit;
     }
 
-    if (VAL_ERROR(val_get_last_run_test_id(&test_id)))
+    status = val_get_last_run_test_id(&test_id);
+    if (VAL_ERROR(status))
     {
         goto exit;
     }
@@ -48,10 +51,12 @@
     }
 
     /* Call dispatcher routine*/
-    val_dispatcher(test_id);
+    status = val_dispatcher(test_id);
 
 exit:
     val_print(PRINT_ALWAYS, "\nEntering standby.. \n", 0);
 
     pal_terminate_simulation();
+
+    return status;
 }
diff --git a/api-tests/val/nspe/val_entry.h b/api-tests/val/nspe/val_entry.h
index 2236016..f594cc4 100644
--- a/api-tests/val/nspe/val_entry.h
+++ b/api-tests/val/nspe/val_entry.h
@@ -26,7 +26,7 @@
 /**
     @brief    - PSA Test Suite C main function, does VAL init and calls test dispatcher
     @param    - None
-    @return   - void
+    @return   - int32_t
 **/
-extern void val_entry(void);
+extern int32_t val_entry(void);
 #endif