tests: kernel: mutex_error_case: move to new ztest API
Move mutex_error_case tests to new ztest API. Signed-off-by: Ming Shao <ming.shao@intel.com>
This commit is contained in:
parent
4a0ce498d1
commit
e77d233981
2 changed files with 13 additions and 18 deletions
|
@ -1,4 +1,5 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_ZTEST_NEW_API=y
|
||||
CONFIG_IRQ_OFFLOAD=y
|
||||
CONFIG_TEST_USERSPACE=y
|
||||
CONFIG_MP_NUM_CPUS=1
|
||||
|
|
|
@ -123,7 +123,7 @@ static int create_negative_test_thread(int choice)
|
|||
*
|
||||
* @see k_mutex_init()
|
||||
*/
|
||||
static void test_mutex_init_null(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_init_null)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_INIT_NULL);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ static void test_mutex_init_null(void)
|
|||
*
|
||||
* @see k_mutex_init()
|
||||
*/
|
||||
static void test_mutex_init_invalid_obj(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_init_invalid_obj)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_INIT_INVALID_OBJ);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ static void test_mutex_init_invalid_obj(void)
|
|||
*
|
||||
* @see k_mutex_lock()
|
||||
*/
|
||||
static void test_mutex_lock_null(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_lock_null)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_LOCK_NULL);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ static void test_mutex_lock_null(void)
|
|||
* @see k_mutex_lock()
|
||||
*/
|
||||
/* TESTPOINT: Pass a invalid kobject into the API k_mutex_lock */
|
||||
static void test_mutex_lock_invalid_obj(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_lock_invalid_obj)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_LOCK_INVALID_OBJ);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ static void test_mutex_lock_invalid_obj(void)
|
|||
*
|
||||
* @see k_mutex_unlock()
|
||||
*/
|
||||
static void test_mutex_unlock_null(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_unlock_null)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_UNLOCK_NULL);
|
||||
}
|
||||
|
@ -200,24 +200,18 @@ static void test_mutex_unlock_null(void)
|
|||
* @see k_mutex_unlock()
|
||||
*/
|
||||
/* TESTPOINT: Pass a invalid kobject into the API k_mutex_unlock */
|
||||
static void test_mutex_unlock_invalid_obj(void)
|
||||
ZTEST_USER(mutex_api_error, test_mutex_unlock_invalid_obj)
|
||||
{
|
||||
create_negative_test_thread(MUTEX_UNLOCK_INVALID_OBJ);
|
||||
}
|
||||
|
||||
/*test case main entry*/
|
||||
void test_main(void)
|
||||
static void *mutex_api_tests_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_USERSPACE
|
||||
k_thread_access_grant(k_current_get(), &tdata, &tstack,
|
||||
&mutex, &sem, &pipe, &queue);
|
||||
|
||||
ztest_test_suite(mutex_api_error,
|
||||
ztest_user_unit_test(test_mutex_init_null),
|
||||
ztest_user_unit_test(test_mutex_init_invalid_obj),
|
||||
ztest_user_unit_test(test_mutex_lock_null),
|
||||
ztest_user_unit_test(test_mutex_lock_invalid_obj),
|
||||
ztest_user_unit_test(test_mutex_unlock_null),
|
||||
ztest_user_unit_test(test_mutex_unlock_invalid_obj)
|
||||
);
|
||||
ztest_run_test_suite(mutex_api_error);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZTEST_SUITE(mutex_api_error, NULL, mutex_api_tests_setup, NULL, NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue