Zephyr Project API 3.7.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_mutex_error.c File Reference

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define THREAD_TEST_PRIORITY   5
 

Enumerations

enum  {
  MUTEX_INIT_NULL , MUTEX_INIT_INVALID_OBJ , MUTEX_LOCK_NULL , MUTEX_LOCK_INVALID_OBJ ,
  MUTEX_UNLOCK_NULL , MUTEX_UNLOCK_INVALID_OBJ , NOT_DEFINE
}
 

Functions

static K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
void ztest_post_fatal_error_hook (unsigned int reason, const struct arch_esf *pEsf)
 
static void tThread_entry_negative (void *p1, void *p2, void *p3)
 
static int create_negative_test_thread (int choice)
 
 ZTEST_USER (mutex_api_error, test_mutex_init_null)
 Test initializing mutex with a NULL pointer.
 
 ZTEST_USER (mutex_api_error, test_mutex_init_invalid_obj)
 Test initialize mutex with a invalid kernel object.
 
 ZTEST_USER (mutex_api_error, test_mutex_lock_null)
 Test locking mutex with a NULL pointer.
 
 ZTEST_USER (mutex_api_error, test_mutex_lock_invalid_obj)
 Test locking mutex with a invalid kernel object.
 
 ZTEST_USER (mutex_api_error, test_mutex_unlock_null)
 Test unlocking mutex with a NULL pointer.
 
 ZTEST_USER (mutex_api_error, test_mutex_unlock_invalid_obj)
 Test unlocking mutex with a invalid kernel object.
 
static void * mutex_api_tests_setup (void)
 
 ZTEST_SUITE (mutex_api_error, NULL, mutex_api_tests_setup, NULL, NULL, NULL)
 

Variables

static ZTEST_DMEM int case_type
 
static struct k_mutex mutex
 
static struct k_sem sem
 
static struct k_pipe pipe
 
static struct k_queue queue
 
static struct k_thread tdata
 
enum { ... }  neg_case
 
struct k_sem offload_sem
 

Macro Definition Documentation

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ THREAD_TEST_PRIORITY

#define THREAD_TEST_PRIORITY   5

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MUTEX_INIT_NULL 
MUTEX_INIT_INVALID_OBJ 
MUTEX_LOCK_NULL 
MUTEX_LOCK_INVALID_OBJ 
MUTEX_UNLOCK_NULL 
MUTEX_UNLOCK_INVALID_OBJ 
NOT_DEFINE 

Function Documentation

◆ create_negative_test_thread()

static int create_negative_test_thread ( int  choice)
static

◆ K_THREAD_STACK_DEFINE()

static K_THREAD_STACK_DEFINE ( tstack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ mutex_api_tests_setup()

static void * mutex_api_tests_setup ( void  )
static

◆ tThread_entry_negative()

static void tThread_entry_negative ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ ztest_post_fatal_error_hook()

void ztest_post_fatal_error_hook ( unsigned int  reason,
const struct arch_esf pEsf 
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( mutex_api_error  ,
NULL  ,
mutex_api_tests_setup  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_USER() [1/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_init_invalid_obj   
)

Test initialize mutex with a invalid kernel object.

Pass a invalid kobject as parameter, then see if the expected error happens.

See also
k_mutex_init()

◆ ZTEST_USER() [2/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_init_null   
)

Test initializing mutex with a NULL pointer.

Pass a null pointer as parameter, then see if the expected error happens.

See also
k_mutex_init()

◆ ZTEST_USER() [3/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_lock_invalid_obj   
)

Test locking mutex with a invalid kernel object.

Pass a invalid kobject as parameter, then see if the expected error happens.

See also
k_mutex_lock()

◆ ZTEST_USER() [4/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_lock_null   
)

Test locking mutex with a NULL pointer.

Pass a null pointer as parameter, then see if the expected error happens.

See also
k_mutex_lock()

◆ ZTEST_USER() [5/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_unlock_invalid_obj   
)

Test unlocking mutex with a invalid kernel object.

Pass a invalid kobject as parameter, then see if the expected error happens.

See also
k_mutex_unlock()

◆ ZTEST_USER() [6/6]

ZTEST_USER ( mutex_api_error  ,
test_mutex_unlock_null   
)

Test unlocking mutex with a NULL pointer.

Pass a null pointer as parameter, then see if the expected error happens.

See also
k_mutex_unlock()

Variable Documentation

◆ case_type

ZTEST_DMEM int case_type
static

◆ mutex

struct k_mutex mutex
static

◆ []

enum { ... } neg_case

◆ offload_sem

struct k_sem offload_sem
extern

◆ pipe

struct k_pipe pipe
static

◆ queue

struct k_queue queue
static

◆ sem

struct k_sem sem
static

◆ tdata

struct k_thread tdata
static