Detect and report mutex usage errors
If the mutex usage verification framework is enabled and it detects a
mutex usage error, report this error and mark the test as failed.
This detects most usage errors, but not all cases of using
uninitialized memory (which is impossible in full generality) and not
leaks due to missing free (which will be handled in a subsequent commit).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 63e91e8..4d4f32f 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -111,6 +111,7 @@
fflush( stdout );
ret = DISPATCH_TEST_FN_NOT_FOUND;
}
+
#else
ret = DISPATCH_UNSUPPORTED_SUITE;
#endif
@@ -457,6 +458,10 @@
}
#endif /* __unix__ || __APPLE__ __MACH__ */
+#if defined(MBEDTLS_TEST_MUTEX_USAGE)
+ if( ret == DISPATCH_TEST_SUCCESS )
+ mbedtls_test_mutex_usage_check( );
+#endif /* MBEDTLS_TEST_MUTEX_USAGE */
}
if( unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE )