T398: Source cleanup for tool chain integration
This is a code cleanup to improve portability.
Specific issues addressed:
- Added type casts to (void *) here and there
- Changed non-standard \e escapes to \033
- Added cmake function to handle preinclude
- Changed a few Image$$ references to make use of the REGION_DECLARE
macro
- Reordered code slightly to avoid the need for a "void *rangeptr"
variable
- Changed compile time check typedef "err_msg" to avoid declaring
zero sized array, which is not standards compliant. It will now
either be -1 (error) or 1 (ok), not -1 and 0
- Reordered the *nfsptr_t typedef to make the cmse_nonsecure_call
standards compliant
- Added null tests to both secure and non_secure suites to avoid
defining zero length array. Also use this to find end of list
- Only define __stdout for ARMCLANG builds and conditionalize ns printf
output for ARMCLANG/GCC/IAR
- Cleaned up some enum type mismatches
- Changed non standard EINVAL error return to -1. The value was only
checked against 0 anyway
- Added type cast for conversion from float to int
Have tested with IAR, which starts and runs the idle thread. Changes
related to this is not included in this commit.
Author: Thomas Tornblom <thomas.tornblom@iar.com>
Signed-off-by: Thomas Tornblom <thomas.tornblom@iar.com>
Note: Sign off authority needs to adhere to the [DCO](./dco.txt)
rules.
Change-Id: I3e5229c0777623b128474af0311020ccacc1b797
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index e0f9d13..fac7299 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -86,12 +86,13 @@
/* Non-secure IPC test cases */
{®ister_testsuite_ns_ipc_interface, 0, 0, 0},
#endif
+ /* End of test suites */
+ {0, 0, 0, 0}
};
void start_integ_test(void)
{
- integ_test("Non-secure", test_suites,
- sizeof(test_suites)/sizeof(test_suites[0]));
+ integ_test("Non-secure", test_suites);
}
/* Service stand-in for NS tests. To be called from a non-secure context */
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 8eda21f..89613d4 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -65,6 +65,8 @@
#endif
#endif /* SERVICES_TEST_S */
#endif /* TFM_LVL == 3 */
+ /* End of test suites */
+ {0, 0, 0, 0}
};
static void setup_integ_test(void)
@@ -84,8 +86,6 @@
void start_integ_test(void)
{
setup_integ_test();
- integ_test("Secure",
- test_suites,
- sizeof(test_suites)/sizeof(test_suites[0]));
+ integ_test("Secure", test_suites);
tear_down_integ_test();
}
diff --git a/test/framework/test_framework_integ_test_helper.c b/test/framework/test_framework_integ_test_helper.c
index 414b333..a163c2b 100644
--- a/test/framework/test_framework_integ_test_helper.c
+++ b/test/framework/test_framework_integ_test_helper.c
@@ -11,8 +11,7 @@
#include "test_framework_integ_test_helper.h"
void integ_test(const char *suite_type,
- struct test_suite_t test_suites[],
- uint32_t test_suite_cnt)
+ struct test_suite_t test_suites[])
{
uint32_t i;
@@ -20,7 +19,7 @@
printf("\r\n#### Execute test suites for the %s area ####\r\n", suite_type);
/* Executes test suites */
- for (i = 0; i < test_suite_cnt; i++) {
+ for (i = 0; test_suites[i].freg != NULL; i++) {
if (run_testsuite(&test_suites[i]) != TEST_SUITE_ERR_NO_ERROR) {
/* End function execution */
return;
@@ -30,7 +29,7 @@
/* Prints test suites summary */
printf_set_color(YELLOW);
printf("\r\n*** %s test suites summary ***\r\n", suite_type);
- for (i = 0; i < test_suite_cnt; i++) {
+ for (i = 0; test_suites[i].freg != NULL; i++) {
printf_set_color(WHITE);
printf("Test suite '%s' has ", test_suites[i].name);
if (test_suites[i].val == TEST_PASSED) {
diff --git a/test/framework/test_framework_integ_test_helper.h b/test/framework/test_framework_integ_test_helper.h
index cfe7ace..af6221b 100644
--- a/test/framework/test_framework_integ_test_helper.h
+++ b/test/framework/test_framework_integ_test_helper.h
@@ -23,8 +23,7 @@
* \param[in] test_suite_cnt The number of test suites to be executed.
*/
void integ_test(const char *suite_type,
- struct test_suite_t test_suites[],
- uint32_t test_suite_cnt);
+ struct test_suite_t test_suites[]);
#ifdef __cplusplus
}