Make tests output more concise and clearer

Also refactor the code that generates this output.

This is only a first step, subsequent patches will further improve
the output.

Here is a sample of the old output:

[cpu 0x0000] NOTICE:  Starting unittest 'Template - Single core test'
[cpu 0x0000] NOTICE:  Unittest 'Template - Single core test' complete. Result: Passed
[cpu 0x0000] NOTICE:  Starting unittest 'Template - Multi core test'
[cpu 0x0000] NOTICE:  Unittest 'Template - Multi core test' complete. Result: Passed
========== TEST REPORT ==========
 # Test suite 'Template':
- Single core test: Passed
- Multi core test: Passed
=================================
Tests Skipped : 0
Tests Passed  : 2
Tests Failed  : 0
Tests Crashed : 0
Total tests   : 2
=================================
[cpu 0x0000] NOTICE:  Exiting tests.

And now the new output:

[cpu 0x0000] --
[cpu 0x0000] Running test suite 'Template'
[cpu 0x0000] Description: Template test code
[cpu 0x0000]
[cpu 0x0000] > Executing 'Single core test'
[cpu 0x0000]   TEST COMPLETE                                                 Passed
[cpu 0x0000]
[cpu 0x0000] > Executing 'Multi core test'
[cpu 0x0000]   TEST COMPLETE                                                 Passed
[cpu 0x0000]
[cpu 0x0000] ******************************* Summary *******************************
[cpu 0x0000] > Test suite 'Template'
[cpu 0x0000]                                                                 Passed
[cpu 0x0000] =================================
[cpu 0x0000] Tests Skipped : 0
[cpu 0x0000] Tests Passed  : 2
[cpu 0x0000] Tests Failed  : 0
[cpu 0x0000] Tests Crashed : 0
[cpu 0x0000] Total tests   : 2
[cpu 0x0000] =================================
[cpu 0x0000] NOTICE:  Exiting tests.

Change-Id: I9d52f2da8905962ab1df73d0691846d88622d3b5
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index 3f94dc9..ea56f2e 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -148,8 +148,14 @@
 	for (unsigned int i = 0; i < PLATFORM_CORE_COUNT; ++i)
 		test_results[i] = TEST_RESULT_NA;
 
-	NOTICE("Starting unittest '%s - %s'\n",
-		current_testsuite()->name, current_testcase()->name);
+	/* If we're starting a new testsuite, announce it. */
+	test_ref_t test_to_run;
+	tftf_get_test_to_run(&test_to_run);
+	if (test_to_run.testcase_idx == 0) {
+		print_testsuite_start(current_testsuite());
+	}
+
+	print_test_start(current_testcase());
 
 	/* Program the watchdog */
 	tftf_platform_watchdog_set();
@@ -263,21 +269,18 @@
 	assert(tftf_get_ref_cnt() == 0);
 
 	/* Save test result in NVM */
-	test_result_t overall_test_result = get_overall_test_result();
 	tftf_testcase_set_result(current_testcase(),
-				overall_test_result,
+				get_overall_test_result(),
 				0);
 
-	NOTICE("Unittest '%s - %s' complete. Result: %s\n",
-	       current_testsuite()->name, current_testcase()->name,
-	       test_result_to_string(overall_test_result));
+	print_test_end(current_testcase());
 
 	/* The test is finished, let's move to the next one (if any) */
 	next_test = advance_to_next_test();
 
 	/* If this was the last test then report all results */
 	if (!next_test) {
-		tftf_report_generate();
+		print_tests_summary();
 		tftf_clean_nvm();
 		return 1;
 	} else {
@@ -551,7 +554,7 @@
 		NOTICE("Resuming interrupted test session\n");
 		rc = resume_test_session();
 		if (rc < 0) {
-			tftf_report_generate();
+			print_tests_summary();
 			tftf_clean_nvm();
 			tftf_exit();
 		}