Test: Change printf to TEST_LOG

Replace all the 'printf' call to 'TEST_LOG', and use
'tfm_log_printf' instead of standard library 'printf'.

Change-Id: Ie43009cf7ab35fe1fcd07500f41cf83129c37792
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/test/framework/test_framework.c b/test/framework/test_framework.c
index 862c43f..85e757f 100644
--- a/test/framework/test_framework.c
+++ b/test/framework/test_framework.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -16,23 +16,23 @@
 {
     printf_set_color(RED);
     if (ret->info_msg != 0) {
-        printf("  %s", ret->info_msg);
+        TEST_LOG("  %s", ret->info_msg);
         if (ret->filename != 0) {
-            printf(" (Failed at %s:%d)\r\n", ret->filename, ret->line);
+            TEST_LOG(" (Failed at %s:%d)\r\n", ret->filename, ret->line);
         }
     } else {
         if (ret->filename != 0) {
-            printf("  Failed at %s:%d\r\n", ret->filename, ret->line);
+            TEST_LOG("  Failed at %s:%d\r\n", ret->filename, ret->line);
         }
     }
 
-    printf("  TEST FAILED!\r\n");
+    TEST_LOG("  TEST FAILED!\r\n");
 }
 
 static void print_error(const char *err_msg)
 {
     printf_set_color(RED);
-    printf("Error ( %s )\r\n", err_msg);
+    TEST_LOG("Error ( %s )\r\n", err_msg);
 }
 
 const char *test_err_to_str(enum test_suite_err_t err)
@@ -102,7 +102,7 @@
     }
 
     printf_set_color(YELLOW);
-    printf("Running Test Suite %s...\r\n", test_suite->name);
+    TEST_LOG("Running Test Suite %s...\r\n", test_suite->name);
 
     /* Sets pointer to the first test */
     p_test = test_suite->test_list;
@@ -115,8 +115,8 @@
         }
 
         printf_set_color(WHITE);
-        printf("> Executing '%s' \r\n  Description: '%s'\r\n",
-               p_test->name, p_test->desc);
+        TEST_LOG("> Executing '%s' \r\n  Description: '%s'\r\n",
+                 p_test->name, p_test->desc);
 
         /* Sets the default value before the test */
         p_test->ret.val = TEST_PASSED;
@@ -128,7 +128,7 @@
             failed_tests++;
         } else {
             printf_set_color(GREEN);
-            printf("  TEST PASSED!\r\n");
+            TEST_LOG("  TEST PASSED!\r\n");
         }
 
         /* Sets pointer to the next test */
@@ -138,14 +138,14 @@
 
     if (failed_tests == 0) {
         printf_set_color(GREEN);
-        printf("TESTSUITE PASSED!\r\n");
+        TEST_LOG("TESTSUITE PASSED!\r\n");
         test_suite->val = TEST_PASSED;
     } else {
         printf_set_color(RED);
-        printf("TESTSUITE FAILED!\r\n");
+        TEST_LOG("TESTSUITE FAILED!\r\n");
         printf_set_color(YELLOW);
-        printf("Number of failed tests: %d of %d\r\n",
-               failed_tests, test_suite->list_size);
+        TEST_LOG("Number of failed tests: %d of %d\r\n",
+                 failed_tests, test_suite->list_size);
         test_suite->val = TEST_FAILED;
     }
 
diff --git a/test/framework/test_framework.h b/test/framework/test_framework.h
index 8c50ae5..9772875 100644
--- a/test/framework/test_framework.h
+++ b/test/framework/test_framework.h
@@ -12,6 +12,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include "log/tfm_log_raw.h"
 #include "test_framework_helpers.h"
 
 #ifdef __cplusplus
@@ -135,7 +136,7 @@
 
 #define TEST_FAIL(info_msg)  set_test_failed(info_msg, __FILE__, __LINE__, ret)
 
-#define TEST_LOG(...) printf(__VA_ARGS__)
+#define TEST_LOG(...) tfm_log_printf(__VA_ARGS__)
 
 #ifdef __cplusplus
 }
diff --git a/test/framework/test_framework_helpers.c b/test/framework/test_framework_helpers.c
index 7423325..5158c53 100644
--- a/test/framework/test_framework_helpers.c
+++ b/test/framework/test_framework_helpers.c
@@ -70,5 +70,5 @@
 
 void printf_set_color(enum serial_color_t color_id)
 {
-    printf("\33[3%dm", color_id);
+    TEST_LOG("\33[3%dm", color_id);
 }
diff --git a/test/framework/test_framework_integ_test_helper.c b/test/framework/test_framework_integ_test_helper.c
index a163c2b..f2e6c73 100644
--- a/test/framework/test_framework_integ_test_helper.c
+++ b/test/framework/test_framework_integ_test_helper.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -16,7 +16,8 @@
     uint32_t i;
 
     printf_set_color(YELLOW);
-    printf("\r\n#### Execute test suites for the %s area ####\r\n", suite_type);
+    TEST_LOG("\r\n#### Execute test suites for the %s area ####\r\n",
+             suite_type);
 
     /* Executes test suites */
     for (i = 0; test_suites[i].freg != NULL; i++) {
@@ -28,19 +29,19 @@
 
     /* Prints test suites summary */
     printf_set_color(YELLOW);
-    printf("\r\n*** %s test suites summary ***\r\n", suite_type);
+    TEST_LOG("\r\n*** %s test suites summary ***\r\n", suite_type);
     for (i = 0; test_suites[i].freg != NULL; i++) {
         printf_set_color(WHITE);
-        printf("Test suite '%s' has ", test_suites[i].name);
+        TEST_LOG("Test suite '%s' has ", test_suites[i].name);
         if (test_suites[i].val == TEST_PASSED) {
             printf_set_color(GREEN);
-            printf(" PASSED\r\n");
+            TEST_LOG(" PASSED\r\n");
         } else {
             printf_set_color(RED);
-            printf(" FAILED\r\n");
+            TEST_LOG(" FAILED\r\n");
         }
     }
 
     printf_set_color(YELLOW);
-    printf("\r\n*** End of %s test suites ***\r\n", suite_type);
+    TEST_LOG("\r\n*** End of %s test suites ***\r\n", suite_type);
 }