Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kernel testcases #6177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/examples/testcase/le_tc/kernel/itc_environ.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* Preconditions :none
* Postconditions :none
*/
static void itc_environ_setenv_p(void)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check _p and _n internally in the automation tool. Do you have any reason to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check _p and _n internally in the automation tool. Do you have any reason to change?

In some functions the _p and _n are at the middle and others are at the end of the function name, this is not identified properly in the TCM tool. So, I have changed the names as _pos and _neg at the end of the function for better identification and uniformity.

static void itc_environ_setenv_pos(void)
{
char *buffer = "";
char *result;
Expand Down Expand Up @@ -74,7 +74,7 @@ static void itc_environ_setenv_p(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_environ_getenv_n(void)
static void itc_environ_getenv_neg(void)
{
int exec_index;
char var_buf[BUFF_LEN];
Expand Down Expand Up @@ -103,8 +103,8 @@ static void itc_environ_getenv_n(void)

int itc_environ_main(void)
{
itc_environ_setenv_p();
itc_environ_getenv_n();
itc_environ_setenv_pos();
itc_environ_getenv_neg();

return 0;
}
4 changes: 2 additions & 2 deletions apps/examples/testcase/le_tc/kernel/itc_libc_semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @Preconditions :NA
* @Postconditions :NA
*/
static void itc_libc_semaphore_getprotocol_n_no_sem_init(void)
static void itc_libc_semaphore_getprotocol_no_sem_init_neg(void)
{
sem_t sem;
int protocol;
Expand All @@ -62,6 +62,6 @@ static void itc_libc_semaphore_getprotocol_n_no_sem_init(void)

int itc_libc_semaphore_main(void)
{
itc_libc_semaphore_getprotocol_n_no_sem_init();
itc_libc_semaphore_getprotocol_no_sem_init_neg();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous

u/itc_module_feature_function_n/p_details

This is what we use in the naming and automation tool parses.
Please let me know why you change the naming.

return 0;
}
24 changes: 12 additions & 12 deletions apps/examples/testcase/le_tc/kernel/itc_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void *task_thread(void *param)
* Preconditions :none
* Postconditions :none
*/
static void itc_pthread_pthread_kill_n_rekill(void)
static void itc_pthread_pthread_kill_rekill_neg(void)
{
int ret_chk;
pthread_t thread;
Expand Down Expand Up @@ -208,7 +208,7 @@ static void itc_pthread_pthread_kill_n_rekill(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_pthread_pthread_cond_init_destroy_n(void)
static void itc_pthread_pthread_cond_init_destroy_neg(void)
{
int ret_chk;
pthread_condattr_t attr;
Expand Down Expand Up @@ -242,7 +242,7 @@ static void itc_pthread_pthread_cond_init_destroy_n(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_pthread_setgetname_np_p_reset_name(void)
static void itc_pthread_setgetname_np_reset_name_pos(void)
{
int ret_chk;
int exec_index;
Expand Down Expand Up @@ -280,7 +280,7 @@ static void itc_pthread_setgetname_np_p_reset_name(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_pthread_equal_pthread_self_p(void)
static void itc_pthread_equal_pthread_self_pos(void)
{
int ret_chk;

Expand All @@ -304,7 +304,7 @@ static void itc_pthread_equal_pthread_self_p(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_pthread_mutex_init_destroy_p_multitime(void)
static void itc_pthread_mutex_init_destroy_multitime_pos(void)
{
pthread_mutexattr_t attr;
int ret_chk;
Expand Down Expand Up @@ -342,7 +342,7 @@ static void itc_pthread_mutex_init_destroy_p_multitime(void)
* Preconditions :pthread_key_create
* Postconditions :none
*/
static void itc_pthread_key_create_set_get_delete_specific_p_multitime(void)
static void itc_pthread_key_create_set_get_delete_specific_multitime_pos(void)
{
int ret_chk;
g_flag = false;
Expand All @@ -363,11 +363,11 @@ static void itc_pthread_key_create_set_get_delete_specific_p_multitime(void)

int itc_pthread_main(void)
{
itc_pthread_pthread_kill_n_rekill();
itc_pthread_pthread_cond_init_destroy_n();
itc_pthread_setgetname_np_p_reset_name();
itc_pthread_equal_pthread_self_p();
itc_pthread_mutex_init_destroy_p_multitime();
itc_pthread_key_create_set_get_delete_specific_p_multitime();
itc_pthread_pthread_kill_rekill_neg();
itc_pthread_pthread_cond_init_destroy_neg();
itc_pthread_setgetname_np_reset_name_pos();
itc_pthread_equal_pthread_self_pos();
itc_pthread_mutex_init_destroy_multitime_pos();
itc_pthread_key_create_set_get_delete_specific_multitime_pos();
return 0;
}
39 changes: 35 additions & 4 deletions apps/examples/testcase/le_tc/kernel/itc_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void thread_cleanup(pthread_t* array, int thread_cnt)
* Preconditions :none
* Postconditions :none
*/
static void itc_sched_setget_scheduler_param_p_all_priority(void)
static void itc_sched_setget_scheduler_param_all_priority_pos(void)
{
int ret_chk = ERROR;
struct sched_param st_setparam;
Expand Down Expand Up @@ -140,6 +140,35 @@ static void itc_sched_setget_scheduler_param_p_all_priority(void)
TC_SUCCESS_RESULT();
}

static void itc_sched_set_scheduler_invalid_pid_neg(void)
{
int ret_chk = ERROR;
pid_t pid = -1;
struct sched_param st_setparam;
int policy = SCHED_FIFO;


ret_chk = sched_setscheduler(pid, policy, &st_setparam);
TC_ASSERT_NEQ("sched_setscheduler", ret_chk, ESRCH);

TC_SUCCESS_RESULT();
}

static void itc_sched_set_scheduler_invalid_policy_neg(void)
{
int ret_chk = ERROR;
struct sched_param *st_setparam = NULL;
int policy = -1;


ret_chk = sched_setscheduler(getpid(), policy, st_setparam);
TC_ASSERT_NEQ("sched_setscheduler", ret_chk, ESRCH);

TC_SUCCESS_RESULT();
}



/**
* @fn :itc_sched_self_p
* @brief :Return current thread tcb
Expand All @@ -148,7 +177,7 @@ static void itc_sched_setget_scheduler_param_p_all_priority(void)
* Preconditions :none
* Postconditions :none
*/
static void itc_sched_self_p(void)
static void itc_sched_self_pos(void)
{
pthread_t thread_id[THREAD_CNT];
int ret_chk;
Expand All @@ -171,8 +200,10 @@ static void itc_sched_self_p(void)

int itc_sched_main(void)
{
itc_sched_setget_scheduler_param_p_all_priority();
itc_sched_self_p();
itc_sched_setget_scheduler_param_all_priority_pos();
itc_sched_set_scheduler_invalid_policy_neg();
itc_sched_set_scheduler_invalid_pid_neg();
itc_sched_self_pos();

return 0;
}
4 changes: 2 additions & 2 deletions apps/examples/testcase/le_tc/kernel/itc_semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Preconditions :none
* Postconditions :none
*/
static void itc_semaphore_sem_init_destroy_p_multitime(void)
static void itc_semaphore_sem_init_destroy_multitime_pos(void)
{
sem_t sem;
int ret_chk;
Expand All @@ -62,7 +62,7 @@ static void itc_semaphore_sem_init_destroy_p_multitime(void)

int itc_semaphore_main(void)
{
itc_semaphore_sem_init_destroy_p_multitime();
itc_semaphore_sem_init_destroy_multitime_pos();

return 0;
}
8 changes: 4 additions & 4 deletions apps/examples/testcase/le_tc/kernel/itc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Preconditions :Creation of timer_id(timer_create)
* Postconditions :none
*/
static void itc_timer_set_time_n_after_delete(void)
static void itc_timer_set_time_after_delete_neg(void)
{
int ret_chk = ERROR;
clockid_t clockid = CLOCK_REALTIME;
Expand Down Expand Up @@ -72,7 +72,7 @@ static void itc_timer_set_time_n_after_delete(void)
* Preconditions :Creation of timer_id(timer_create)
* Postconditions :none
*/
static void itc_timer_get_time_n_after_delete(void)
static void itc_timer_get_time_after_delete_neg(void)
{
int ret_chk = ERROR;
clockid_t clockid = CLOCK_REALTIME;
Expand Down Expand Up @@ -111,8 +111,8 @@ static void itc_timer_get_time_n_after_delete(void)

int itc_timer_main(void)
{
itc_timer_set_time_n_after_delete();
itc_timer_get_time_n_after_delete();
itc_timer_set_time_after_delete_neg();
itc_timer_get_time_after_delete_neg();

return 0;
}
Loading