mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-10-23 01:52:40 +03:00
No negative tests since all forbidden usage has undefined behavior. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
33 lines
612 B
C
33 lines
612 B
C
/* BEGIN_HEADER */
|
|
/* Basic tests for the threading interface.
|
|
*/
|
|
|
|
#include "mbedtls/threading.h"
|
|
|
|
#include "test/threading_helpers.h"
|
|
|
|
/* END_HEADER */
|
|
|
|
/* BEGIN_DEPENDENCIES
|
|
* depends_on:MBEDTLS_THREADING_C
|
|
* END_DEPENDENCIES
|
|
*/
|
|
|
|
/* BEGIN_CASE */
|
|
void mutex_usage_nominal(int lock_cycles)
|
|
{
|
|
mbedtls_threading_mutex_t mutex;
|
|
|
|
mbedtls_mutex_init(&mutex);
|
|
|
|
for (int i = 0; i < lock_cycles; i++) {
|
|
mbedtls_test_set_step(i);
|
|
TEST_EQUAL(mbedtls_mutex_lock(&mutex), 0);
|
|
TEST_EQUAL(mbedtls_mutex_unlock(&mutex), 0);
|
|
}
|
|
|
|
exit:
|
|
mbedtls_mutex_free(&mutex);
|
|
}
|
|
/* END_CASE */
|