Add accessor helpers for mbedtls_test_info

Step one of being able to control access to mbedtls_test_info with
a mutex.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index eb28919..6bfe15d 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -23,6 +23,61 @@
 mbedtls_test_info_t mbedtls_test_info;
 
 /*----------------------------------------------------------------------------*/
+/* Mbedtls Test Info accessors */
+
+mbedtls_test_result_t mbedtls_test_get_result(void)
+{
+    return mbedtls_test_info.result;
+}
+
+const char *mbedtls_test_get_test(void)
+{
+    return mbedtls_test_info.test;
+}
+const char *mbedtls_get_test_filename(void)
+{
+    return mbedtls_test_info.filename;
+}
+
+int mbedtls_test_get_line_no(void)
+{
+    return mbedtls_test_info.line_no;
+}
+
+void mbedtls_test_increment_step(void)
+{
+    ++mbedtls_test_info.step;
+}
+
+unsigned long mbedtls_test_get_step(void)
+{
+    return mbedtls_test_info.step;
+}
+
+const char *mbedtls_test_get_line1(void)
+{
+    return mbedtls_test_info.line1;
+}
+const char *mbedtls_test_get_line2(void)
+{
+    return mbedtls_test_info.line2;
+}
+
+#if defined(MBEDTLS_TEST_MUTEX_USAGE)
+const char *mbedtls_test_get_mutex_usage_error(void)
+{
+    return mbedtls_test_info.mutex_usage_error;
+}
+
+void mbedtls_test_set_mutex_usage_error(const char *msg)
+{
+    if (mbedtls_test_info.mutex_usage_error == NULL || msg == NULL) {
+        mbedtls_test_info.mutex_usage_error = msg;
+    }
+}
+#endif // #if defined(MBEDTLS_TEST_MUTEX_USAGE)
+
+/*----------------------------------------------------------------------------*/
 /* Helper Functions */
 
 int mbedtls_test_platform_setup(void)
diff --git a/tests/src/threading_helpers.c b/tests/src/threading_helpers.c
index 5fbf65b..261d141 100644
--- a/tests/src/threading_helpers.c
+++ b/tests/src/threading_helpers.c
@@ -109,9 +109,7 @@
 {
     (void) mutex;
 
-    if (mbedtls_test_info.mutex_usage_error == NULL) {
-        mbedtls_test_info.mutex_usage_error = msg;
-    }
+    mbedtls_test_set_mutex_usage_error(msg);
     mbedtls_fprintf(stdout, "[mutex: %s] ", msg);
     /* Don't mark the test as failed yet. This way, if the test fails later
      * for a functional reason, the test framework will report the message
@@ -233,17 +231,15 @@
          * negative number means a missing init somewhere. */
         mbedtls_fprintf(stdout, "[mutex: %d leaked] ", live_mutexes);
         live_mutexes = 0;
-        if (mbedtls_test_info.mutex_usage_error == NULL) {
-            mbedtls_test_info.mutex_usage_error = "missing free";
-        }
+        mbedtls_test_set_mutex_usage_error("missing free");
     }
-    if (mbedtls_test_info.mutex_usage_error != NULL &&
-        mbedtls_test_info.result != MBEDTLS_TEST_RESULT_FAILED) {
+    if (mbedtls_test_get_mutex_usage_error() != NULL &&
+        mbedtls_test_get_result() != MBEDTLS_TEST_RESULT_FAILED) {
         /* Functionally, the test passed. But there was a mutex usage error,
          * so mark the test as failed after all. */
         mbedtls_test_fail("Mutex usage error", __LINE__, __FILE__);
     }
-    mbedtls_test_info.mutex_usage_error = NULL;
+    mbedtls_test_set_mutex_usage_error(NULL);
 }
 
 void mbedtls_test_mutex_usage_end(void)