Test: test framework and test suites
-- Test framework
-- Test secure service
-- TFM Core secure/non-secure test suites
-- SST secure/non-secure test suites
Change-Id: I5868d9a65a740b984748d975a3a5bd486cbfafc4
Signed-off-by: Abhishek Pandit <abhishek.pandit@arm.com>
Co-Authored-By: Mate Toth-pal <mate.toth-pal@arm.com>
Co-Authored-By: Antonio de Angelis <antonio.deangelis@arm.com>
Co-Authored-By: Miklos Balint <miklos.balint@arm.com>
Co-Authored-By: Jamie Fox <jamie.fox@arm.com>
Co-Authored-By: Ashutosh Singh <ashutosh.singh@arm.com>
diff --git a/test/framework/helpers.c b/test/framework/helpers.c
new file mode 100755
index 0000000..f6d5df7
--- /dev/null
+++ b/test/framework/helpers.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "helpers.h"
+
+#include <stdio.h>
+
+const char *sst_err_to_str(enum tfm_sst_err_t err)
+{
+ switch (err) {
+ case TFM_SST_ERR_SUCCESS:
+ return "TFM_SST_ERR_SUCCESS";
+ case TFM_SST_ERR_ASSET_NOT_PREPARED:
+ return "TFM_SST_ERR_ASSET_NOT_PREPARED";
+ case TFM_SST_ERR_ASSET_NOT_FOUND:
+ return "TFM_SST_ERR_ASSET_NOT_FOUND";
+ case TFM_SST_ERR_PARAM_ERROR:
+ return "TFM_SST_ERR_PARAM_ERROR";
+ case TFM_SST_ERR_INVALID_HANDLE:
+ return "TFM_SST_ERR_INVALID_HANDLE";
+ case TFM_SST_ERR_STORAGE_SYSTEM_FULL:
+ return "TFM_SST_ERR_STORAGE_SYSTEM_FULL";
+ case TFM_SST_ERR_SYSTEM_ERROR:
+ return "TFM_SST_ERR_SYSTEM_ERROR";
+ case TFM_SST_ERR_FORCE_INT_SIZE:
+ return "TFM_SST_ERR_FORCE_INT_SIZE";
+ /* default: The default is not defined intentionally to force the
+ * compiler to check that all the enumeration values are
+ * covered in the switch.
+ */
+ }
+}
+
+const char *asset_perms_to_str(uint8_t permissions)
+{
+ switch (permissions) {
+ case 0:
+ return "No permissions";
+ case 1:
+ return "SECURE_ASSET_REFERENCE";
+ case 2:
+ return "SECURE_ASSET_WRITE";
+ case 3:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_WRITE";
+ case 4:
+ return "SECURE_ASSET_READ";
+ case 5:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_READ";
+ case 6:
+ return "SECURE_ASSET_WRITE | SECURE_ASSET_READ";
+ case 7:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_WRITE | "
+ "SECURE_ASSET_READ";
+ default:
+ return "Unknown permissions";
+ }
+}
+
+void printf_set_color(enum serial_color_t color_id)
+{
+ printf("\33[3%dm", color_id);
+}