Make mbedtls_test_err_add_check fail tests

Previously an error message was printed and then the test manually exited
via `mbedtls_exit( 1 )`. This commit includes a rebase onto:
540320bf7b5de6d3dbd78abb3e5527674189d09c so that `mbedtls_test_fail` can
be used instead to properly fail tests (and report them as such).

Signed-off-by: Chris Jones <christopher.jones@arm.com>
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index 9c981de..8319e90 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -289,33 +289,25 @@
 {
     if ( high > -0x1000 )
     {
-        mbedtls_fprintf( stderr, "\n'high' is not a high-level error code - "
-                                 "%s:%d\n", file, line );
-        mbedtls_exit( 1 );
+        mbedtls_test_fail( "'high' is not a high-level error code",
+                            line, file );
     }
     else if ( high < -0x7F80 )
     {
-        mbedtls_fprintf( stderr, "\n'high' is greater than 16-bits - "
-                                 "%s:%d\n", file, line );
-        mbedtls_exit( 1 );
+        mbedtls_test_fail( "'high' is greater than 16-bits", line, file );
     }
     else if ( ( high & 0x7F ) != 0 )
     {
-        mbedtls_fprintf( stderr, "\n'high' contains a low-level error code - "
-                                 "%s:%d\n", file, line );
-        mbedtls_exit( 1 );
+        mbedtls_test_fail( "'high' contains a low-level error code",
+                            line, file );
     }
     else if ( low < -0x007F )
     {
-        mbedtls_fprintf( stderr, "\n'low' is greater than 8-bits - "
-                                 "%s:%d\n", file, line );
-        mbedtls_exit( 1 );
+        mbedtls_test_fail( "'low' is greater than 8-bits", line, file );
     }
     else if ( low > 0 )
     {
-        mbedtls_fprintf( stderr, "\n'low' is zero or greater - "
-                                 "%s:%d\n", file, line );
-        mbedtls_exit( 1 );
+        mbedtls_test_fail( "'low' is zero or greater", line, file );
     }
 }
 #endif /* MBEDTLS_TEST_HOOKS */