mirror of https://github.com/ARMmbed/mbed-os.git
Adapt `tests-mbedmicro-rtos-mbed-mutex` test - use new lock(void) function instead of deprecated one.
parent
8482cdc70f
commit
f65bba9a23
|
@ -48,9 +48,9 @@ volatile bool mutex_defect = false;
|
||||||
bool manipulate_protected_zone(const int thread_delay)
|
bool manipulate_protected_zone(const int thread_delay)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
osStatus stat;
|
||||||
|
|
||||||
osStatus stat = stdio_mutex.lock();
|
stdio_mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
core_util_critical_section_enter();
|
core_util_critical_section_enter();
|
||||||
if (changing_counter == true) {
|
if (changing_counter == true) {
|
||||||
|
@ -118,8 +118,8 @@ void test_multiple_threads(void)
|
||||||
|
|
||||||
void test_dual_thread_nolock_lock_thread(Mutex *mutex)
|
void test_dual_thread_nolock_lock_thread(Mutex *mutex)
|
||||||
{
|
{
|
||||||
osStatus stat = mutex->lock(osWaitForever);
|
osStatus stat;
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
mutex->lock();
|
||||||
|
|
||||||
stat = mutex->unlock();
|
stat = mutex->unlock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
TEST_ASSERT_EQUAL(osOK, stat);
|
||||||
|
@ -161,8 +161,7 @@ void test_dual_thread_nolock(void)
|
||||||
|
|
||||||
void test_dual_thread_lock_unlock_thread(Mutex *mutex)
|
void test_dual_thread_lock_unlock_thread(Mutex *mutex)
|
||||||
{
|
{
|
||||||
osStatus stat = mutex->lock(osWaitForever);
|
mutex->lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Test dual thread lock unlock
|
/** Test dual thread lock unlock
|
||||||
|
@ -180,8 +179,7 @@ void test_dual_thread_lock_unlock(void)
|
||||||
osStatus stat;
|
osStatus stat;
|
||||||
Thread thread(osPriorityNormal, TEST_STACK_SIZE);
|
Thread thread(osPriorityNormal, TEST_STACK_SIZE);
|
||||||
|
|
||||||
stat = mutex.lock();
|
mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
thread.start(callback(test_dual_thread_lock_unlock_thread, &mutex));
|
thread.start(callback(test_dual_thread_lock_unlock_thread, &mutex));
|
||||||
|
|
||||||
|
@ -202,9 +200,9 @@ void test_dual_thread_lock_lock_thread(Mutex *mutex)
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
osStatus stat = mutex->lock(TEST_DELAY);
|
bool stat = mutex->trylock_for(TEST_DELAY);
|
||||||
TEST_ASSERT_EQUAL(osErrorTimeout, stat);
|
TEST_ASSERT_EQUAL(false, stat);
|
||||||
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY * 1000, timer.read_us());
|
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY*1000, timer.read_us());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Test dual thread lock
|
/** Test dual thread lock
|
||||||
|
@ -228,8 +226,7 @@ void test_dual_thread_lock(void)
|
||||||
osStatus stat;
|
osStatus stat;
|
||||||
Thread thread(osPriorityNormal, TEST_STACK_SIZE);
|
Thread thread(osPriorityNormal, TEST_STACK_SIZE);
|
||||||
|
|
||||||
stat = mutex.lock();
|
mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
thread.start(callback(F, &mutex));
|
thread.start(callback(F, &mutex));
|
||||||
|
|
||||||
|
@ -250,11 +247,9 @@ void test_single_thread_lock_recursive(void)
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
osStatus stat;
|
osStatus stat;
|
||||||
|
|
||||||
stat = mutex.lock();
|
mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
stat = mutex.lock();
|
mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
stat = mutex.unlock();
|
stat = mutex.unlock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
TEST_ASSERT_EQUAL(osOK, stat);
|
||||||
|
@ -291,8 +286,7 @@ void test_single_thread_lock(void)
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
osStatus stat;
|
osStatus stat;
|
||||||
|
|
||||||
stat = mutex.lock();
|
mutex.lock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
|
||||||
|
|
||||||
stat = mutex.unlock();
|
stat = mutex.unlock();
|
||||||
TEST_ASSERT_EQUAL(osOK, stat);
|
TEST_ASSERT_EQUAL(osOK, stat);
|
||||||
|
|
Loading…
Reference in New Issue