Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
test_mutex_error.c File Reference
#include <ztest.h>
#include <irq_offload.h>
#include <ztest_error_hook.h>

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#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_STACKSIZE))
 
void ztest_post_fatal_error_hook (unsigned int reason, const z_arch_esf_t *pEsf)
 
static void tThread_entry_negative (void *p1, void *p2, void *p3)
 
static int create_negative_test_thread (int choice)
 
static void test_mutex_init_null (void)
 Test initializing mutex with a NULL pointer. More...
 
static void test_mutex_init_invalid_obj (void)
 Test initialize mutex with a invalid kernel object. More...
 
static void test_mutex_lock_null (void)
 Test locking mutex with a NULL pointer. More...
 
static void test_mutex_lock_invalid_obj (void)
 Test locking mutex with a invalid kernel object. More...
 
static void test_mutex_unlock_null (void)
 Test unlocking mutex with a NULL pointer. More...
 
static void test_mutex_unlock_invalid_obj (void)
 Test unlocking mutex with a invalid kernel object. More...
 
void test_main (void)
 

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_STACKSIZE)

◆ 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_STACKSIZE)   
)
static

◆ test_main()

void test_main ( void  )

test case main entry

◆ test_mutex_init_invalid_obj()

static void test_mutex_init_invalid_obj ( void  )
static

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()

◆ test_mutex_init_null()

static void test_mutex_init_null ( void  )
static

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()

◆ test_mutex_lock_invalid_obj()

static void test_mutex_lock_invalid_obj ( void  )
static

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()

◆ test_mutex_lock_null()

static void test_mutex_lock_null ( void  )
static

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()

◆ test_mutex_unlock_invalid_obj()

static void test_mutex_unlock_invalid_obj ( void  )
static

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()

◆ test_mutex_unlock_null()

static void test_mutex_unlock_null ( void  )
static

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()

◆ 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 z_arch_esf_t *  pEsf 
)

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