1 /*
2  * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stdio.h>
9 
10 #include "test_framework.h"
11 #include "test_framework_integ_test_helper.h"
12 
integ_test(const char * suite_type,struct test_suite_t test_suites[])13 enum test_suite_err_t integ_test(const char *suite_type,
14                                  struct test_suite_t test_suites[])
15 {
16     uint32_t i;
17     enum test_suite_err_t retval = TEST_SUITE_ERR_NO_ERROR;
18 
19     printf_set_color(YELLOW);
20     TEST_LOG("\r\n#### Execute test suites for the %s area ####\r\n",
21              suite_type);
22 
23     /* Executes test suites */
24     for (i = 0; test_suites[i].freg != NULL; i++) {
25         retval = run_testsuite(&test_suites[i]);
26         if (retval != TEST_SUITE_ERR_NO_ERROR) {
27             /* End function execution */
28             return retval;
29         }
30     }
31 
32     /* Prints test suites summary */
33     printf_set_color(YELLOW);
34     TEST_LOG("\r\n*** %s test suites summary ***\r\n", suite_type);
35     for (i = 0; test_suites[i].freg != NULL; i++) {
36         printf_set_color(DEFAULT);
37         TEST_LOG("Test suite '%s' has", test_suites[i].name);
38         if (test_suites[i].val == TEST_PASSED) {
39             printf_set_color(GREEN);
40             TEST_LOG(" PASSED\r\n");
41         } else {
42             printf_set_color(RED);
43             TEST_LOG(" FAILED\r\n");
44             retval = TEST_SUITE_ERR_TEST_FAILED;
45         }
46     }
47 
48     printf_set_color(YELLOW);
49     TEST_LOG("\r\n*** End of %s test suites ***\r\n", suite_type);
50     printf_set_color(DEFAULT);
51 
52     return retval;
53 }
54