From b447b4633cfdfb5698195eaca55da76db49e3817 Mon Sep 17 00:00:00 2001 From: Ahreum Jeong Date: Fri, 8 Sep 2017 14:03:39 +0900 Subject: [PATCH] Remove tc macro, TC_ASSERT_NOT_NULL and change all using it to TC_ASSERT_NEQ It is not nessasary because it can be represented as TC_ASSERT_NEQ(api, NULL) --- apps/examples/testcase/le_tc/kernel/tc_environ.c | 4 +- apps/examples/testcase/le_tc/kernel/tc_errno.c | 4 +- apps/examples/testcase/le_tc/kernel/tc_group.c | 24 +++++----- .../examples/testcase/le_tc/kernel/tc_libc_spawn.c | 6 +-- .../examples/testcase/le_tc/kernel/tc_libc_stdio.c | 4 +- .../testcase/le_tc/kernel/tc_libc_string.c | 52 +++++++++++----------- .../examples/testcase/le_tc/kernel/tc_libc_timer.c | 14 +++--- apps/examples/testcase/le_tc/kernel/tc_sched.c | 12 ++--- apps/examples/testcase/le_tc/kernel/tc_timer.c | 4 +- apps/examples/testcase/le_tc/kernel/tc_umm_heap.c | 14 +++--- .../ta_tc/arastorage/itc/itc_arastorage_main.c | 4 +- .../ta_tc/arastorage/utc/utc_arastorage_main.c | 10 ++--- .../testcase/ta_tc/systemio/itc/itc_gpio.c | 14 +++--- .../examples/testcase/ta_tc/systemio/itc/itc_i2c.c | 8 ++-- .../examples/testcase/ta_tc/systemio/itc/itc_pwm.c | 10 ++--- .../examples/testcase/ta_tc/systemio/itc/itc_spi.c | 4 +- .../testcase/ta_tc/systemio/itc/itc_uart.c | 12 ++--- .../testcase/ta_tc/systemio/utc/utc_gpio.c | 6 +-- .../examples/testcase/ta_tc/systemio/utc/utc_i2c.c | 2 +- .../examples/testcase/ta_tc/systemio/utc/utc_pwm.c | 2 +- .../examples/testcase/ta_tc/systemio/utc/utc_spi.c | 2 +- .../testcase/ta_tc/systemio/utc/utc_uart.c | 4 +- apps/examples/testcase/tc_common.h | 9 ---- 23 files changed, 108 insertions(+), 117 deletions(-) diff --git a/apps/examples/testcase/le_tc/kernel/tc_environ.c b/apps/examples/testcase/le_tc/kernel/tc_environ.c index bea045b..a5e55bd 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_environ.c +++ b/apps/examples/testcase/le_tc/kernel/tc_environ.c @@ -148,7 +148,7 @@ static void tc_environ_putenv(void) TC_ASSERT_EQ("putenv", ret_chk, OK); psz_getvalue = getenv("PATH"); - TC_ASSERT_NOT_NULL("getenv", psz_getvalue); + TC_ASSERT_NEQ("getenv", psz_getvalue, NULL); TC_ASSERT_EQ("getenv", strcmp(psz_getvalue, "C:"), 0); /* Changing the value of already existing PATH variable */ @@ -194,7 +194,7 @@ static void tc_environ_get_environ_ptr(void) } env_ptr = get_environ_ptr(&env_size); - TC_ASSERT_NOT_NULL("get_environ_ptr", env_ptr); + TC_ASSERT_NEQ("get_environ_ptr", env_ptr, NULL); /* env_size is set to length of all env name and val pair */ diff --git a/apps/examples/testcase/le_tc/kernel/tc_errno.c b/apps/examples/testcase/le_tc/kernel/tc_errno.c index 45adb77..f46e721 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_errno.c +++ b/apps/examples/testcase/le_tc/kernel/tc_errno.c @@ -66,12 +66,12 @@ static void tc_errno_set_get_errno_and_ptr(void) #endif ret_err = (char *)strerror(ret_chk); - TC_ASSERT_NOT_NULL("strerror", ret_err); + TC_ASSERT_NEQ("strerror", ret_err, NULL); TC_ASSERT_EQ("strerror", strncmp(ret_err, errstr_arr[err_index - 1], strlen(ret_err)), 0); #if !defined(CONFIG_BUILD_PROTECTED) ret_err = (char *)strerror(ret_ptr_chk); - TC_ASSERT_NOT_NULL("strerror", ret_err); + TC_ASSERT_NEQ("strerror", ret_err, NULL); TC_ASSERT_EQ("strerror", strncmp(ret_err, errstr_arr[err_index - 1], strlen(ret_err)), 0); #endif } diff --git a/apps/examples/testcase/le_tc/kernel/tc_group.c b/apps/examples/testcase/le_tc/kernel/tc_group.c index 9c1ea76..ff304cd 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_group.c +++ b/apps/examples/testcase/le_tc/kernel/tc_group.c @@ -54,13 +54,13 @@ static void tc_group_group_add_find_remove_child(void) pid_t child_pid; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); group = st_tcb->group; - TC_ASSERT_NOT_NULL("sched_self", group); + TC_ASSERT_NEQ("sched_self", group, NULL); child = group_allocchild(); - TC_ASSERT_NOT_NULL("group_allocchild", child); + TC_ASSERT_NEQ("group_allocchild", child, NULL); child_pid = -1; child->ch_flags = TCB_FLAG_TTYPE_TASK; @@ -101,13 +101,13 @@ static void tc_group_group_alloc_free_child(void) struct child_status_s child_dummy; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); group = st_tcb->group; - TC_ASSERT_NOT_NULL("sched_self", group); + TC_ASSERT_NEQ("sched_self", group, NULL); child = group_allocchild(); - TC_ASSERT_NOT_NULL("group_allocchild", child); + TC_ASSERT_NEQ("group_allocchild", child, NULL); TC_ASSERT_EQ("group_allocchild", child->flink, NULL); child->flink = &child_dummy; @@ -134,15 +134,15 @@ static void tc_group_group_exit_child(void) pid_t child_pid; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); group = st_tcb->group; - TC_ASSERT_NOT_NULL("sched_self", group); + TC_ASSERT_NEQ("sched_self", group, NULL); child_pid = task_create("group", SCHED_PRIORITY_DEFAULT, TASK_STACKSIZE, group_exitchild_func, (char *const *)NULL); child = group_findchild(group, child_pid); - TC_ASSERT_NOT_NULL("group_findchild", child); + TC_ASSERT_NEQ("group_findchild", child, NULL); sleep(3); @@ -173,13 +173,13 @@ static void tc_group_group_removechildren(void) pid_t child_pid; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); group = st_tcb->group; - TC_ASSERT_NOT_NULL("sched_self", group); + TC_ASSERT_NEQ("sched_self", group, NULL); child = group_allocchild(); - TC_ASSERT_NOT_NULL("group_allocchild", child); + TC_ASSERT_NEQ("group_allocchild", child, NULL); child_pid = -1; child->ch_flags = TCB_FLAG_TTYPE_TASK; diff --git a/apps/examples/testcase/le_tc/kernel/tc_libc_spawn.c b/apps/examples/testcase/le_tc/kernel/tc_libc_spawn.c index c22817e..e5bc24a 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_libc_spawn.c +++ b/apps/examples/testcase/le_tc/kernel/tc_libc_spawn.c @@ -354,7 +354,7 @@ static void tc_libc_spawn_posix_spawn_file_actions_destroy(void) ret_chk = posix_spawn_file_actions_addopen(&st_fileactions, 1, szfilepath, O_WRONLY, 0644); TC_ASSERT_EQ("posix_spawn_file_actions_addopen", ret_chk, OK); - TC_ASSERT_NOT_NULL("posix_spawn_file_actions_addopen", st_fileactions); + TC_ASSERT_NEQ("posix_spawn_file_actions_addopen", st_fileactions, NULL); ret_chk = posix_spawn_file_actions_destroy(&st_fileactions); TC_ASSERT_EQ("posix_spawn_file_actions_destroy", ret_chk, OK); @@ -425,14 +425,14 @@ static void tc_libc_spawn_add_file_action(void) /* Allocate the action list entry of this size */ entry1 = (struct spawn_open_file_action_s *)zalloc(alloc_num); - TC_ASSERT_NOT_NULL("zalloc", entry1); + TC_ASSERT_NEQ("zalloc", entry1, NULL); /* And add it to the file action list */ add_file_action(st_fileactions, (struct spawn_general_file_action_s *)entry1); entry2 = (struct spawn_open_file_action_s *)zalloc(alloc_num); - TC_ASSERT_NOT_NULL("zalloc", entry2); + TC_ASSERT_NEQ("zalloc", entry2, NULL); /* And add it to the file action list */ diff --git a/apps/examples/testcase/le_tc/kernel/tc_libc_stdio.c b/apps/examples/testcase/le_tc/kernel/tc_libc_stdio.c index 86aca09..8c2efa7 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_libc_stdio.c +++ b/apps/examples/testcase/le_tc/kernel/tc_libc_stdio.c @@ -96,7 +96,7 @@ static void tc_libc_stdio_avsprintf(const char *format, ...) va_start(args, format); ret_chk = avsprintf(&buffer, format, args); va_end(args); - TC_ASSERT_NOT_NULL("avsprintf", buffer); + TC_ASSERT_NEQ("avsprintf", buffer, NULL); TC_ASSERT_EQ_CLEANUP("avsprintf", ret_chk, strlen(printable_chars), TC_FREE_MEMORY(buffer)); @@ -547,7 +547,7 @@ static void tc_libc_stdio_asprintf(void) ret_chk = asprintf(&buffer, "%s", printable_chars); - TC_ASSERT_NOT_NULL("asprintf", buffer); + TC_ASSERT_NEQ("asprintf", buffer, NULL); TC_ASSERT_EQ_CLEANUP("asprintf", ret_chk, strlen(printable_chars), TC_FREE_MEMORY(buffer)); diff --git a/apps/examples/testcase/le_tc/kernel/tc_libc_string.c b/apps/examples/testcase/le_tc/kernel/tc_libc_string.c index 3b7acea..fd5c34d 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_libc_string.c +++ b/apps/examples/testcase/le_tc/kernel/tc_libc_string.c @@ -55,7 +55,7 @@ static void tc_libc_string_memcpy(void) char *res_ptr = NULL; res_ptr = (char *)memcpy(sz_dest, sz_src, BUFF_SIZE); - TC_ASSERT_NOT_NULL("memcpy", res_ptr); + TC_ASSERT_NEQ("memcpy", res_ptr, NULL); TC_ASSERT_EQ("memcpy", strncmp(sz_dest, res_ptr, BUFF_SIZE), 0); TC_ASSERT_EQ("memcpy", strncmp(sz_dest, sz_src, BUFF_SIZE), 0); @@ -78,7 +78,7 @@ static void tc_libc_string_memset(void) char *res_ptr = NULL; res_ptr = (char *)memset(buffer, 'a', BUFF_SIZE - 1); - TC_ASSERT_NOT_NULL("memset", res_ptr); + TC_ASSERT_NEQ("memset", res_ptr, NULL); TC_ASSERT_EQ("memset", strncmp(res_ptr, ctarget, BUFF_SIZE), 0); TC_ASSERT_EQ("memset", strncmp(ctarget, buffer, BUFF_SIZE), 0); @@ -101,7 +101,7 @@ static void tc_libc_string_memchr(void) char *res_ptr = NULL; res_ptr = (char *)memchr(buffer, 's', BUFF_SIZE); - TC_ASSERT_NOT_NULL("memchr", res_ptr); + TC_ASSERT_NEQ("memchr", res_ptr, NULL); TC_ASSERT_EQ("memchr", *res_ptr, 's'); TC_SUCCESS_RESULT(); @@ -154,12 +154,12 @@ static void tc_libc_string_memmove(void) char *res_ptr = NULL; res_ptr = (char *)memmove(buffer1, buffer2, sizeof(buffer1)); - TC_ASSERT_NOT_NULL("memmove", res_ptr); + TC_ASSERT_NEQ("memmove", res_ptr, NULL); TC_ASSERT_EQ("memmove", strncmp(res_ptr, buffer2, BUFF_SIZE), 0); TC_ASSERT_EQ("memmove", strncmp(buffer1, buffer2, BUFF_SIZE), 0); res_ptr = (char *)memmove(buffer2, buffer1, sizeof(buffer1)); - TC_ASSERT_NOT_NULL("memmove", res_ptr); + TC_ASSERT_NEQ("memmove", res_ptr, NULL); TC_ASSERT_EQ("memmove", strncmp(res_ptr, buffer1, BUFF_SIZE), 0); TC_ASSERT_EQ("memmove", strncmp(buffer2, buffer1, BUFF_SIZE), 0); @@ -183,7 +183,7 @@ static void tc_libc_string_stpcpy(void) char *res_ptr = NULL; res_ptr = stpcpy(dest_arr, src_buf); - TC_ASSERT_NOT_NULL("stpcpy", res_ptr); + TC_ASSERT_NEQ("stpcpy", res_ptr, NULL); TC_ASSERT_EQ("stpcpy", *(res_ptr - 1), 'd'); TC_ASSERT_EQ("stpcpy", strncmp(dest_arr, src, BUFF_SIZE), 0); @@ -236,7 +236,7 @@ static void tc_libc_string_strcat(void) char *res_ptr = NULL; res_ptr = strcat(dest_arr, src); - TC_ASSERT_NOT_NULL("strcat", res_ptr); + TC_ASSERT_NEQ("strcat", res_ptr, NULL); TC_ASSERT_EQ("strcat", strncmp(res_ptr, final_arr, BUFF_SIZE_10), 0); TC_ASSERT_EQ("strcat", strncmp(dest_arr, final_arr, BUFF_SIZE_10), 0); @@ -261,7 +261,7 @@ static void tc_libc_string_strchr(void) TC_ASSERT_EQ("strchr", res_ptr, NULL); res_ptr = strchr(dest_arr, 's'); - TC_ASSERT_NOT_NULL("strchr", res_ptr); + TC_ASSERT_NEQ("strchr", res_ptr, NULL); TC_ASSERT_EQ("strchr", *res_ptr, 's'); TC_SUCCESS_RESULT(); @@ -313,7 +313,7 @@ static void tc_libc_string_strcpy(void) char *res_ptr = NULL; res_ptr = strcpy(dest_arr, src); - TC_ASSERT_NOT_NULL("strcpy", res_ptr); + TC_ASSERT_NEQ("strcpy", res_ptr, NULL); TC_ASSERT_EQ("strcpy", strncmp(res_ptr, src, BUFF_SIZE), 0); TC_ASSERT_EQ("strcpy", strncmp(dest_arr, src, BUFF_SIZE), 0); @@ -367,7 +367,7 @@ static void tc_libc_string_strdup(void) char src[BUFF_SIZE] = "test"; dest_arr = strdup(src); - TC_ASSERT_NOT_NULL("strdup", dest_arr); + TC_ASSERT_NEQ("strdup", dest_arr, NULL); TC_ASSERT_EQ_CLEANUP("strdup", strncmp(dest_arr, src, BUFF_SIZE), OK, TC_FREE_MEMORY(dest_arr)); @@ -393,7 +393,7 @@ static void tc_libc_string_strerror(void) /* EFAULT is defined as 14 which gives Bad address in strerror */ dest_arr = (char *)strerror(EFAULT); - TC_ASSERT_NOT_NULL("strerror", dest_arr); + TC_ASSERT_NEQ("strerror", dest_arr, NULL); TC_ASSERT_EQ("strerror", strncmp(dest_arr, src, BUFF_SIZE_12), 0); TC_SUCCESS_RESULT(); @@ -467,7 +467,7 @@ static void tc_libc_string_strncat(void) char *res_ptr = NULL; res_ptr = strncat(dest_arr, src, BUFF_SIZE); - TC_ASSERT_NOT_NULL("strncat", res_ptr); + TC_ASSERT_NEQ("strncat", res_ptr, NULL); TC_ASSERT_EQ("strncat", strncmp(res_ptr, final_arr, BUFF_SIZE_10), 0); TC_ASSERT_EQ("strncat", strncmp(dest_arr, final_arr, BUFF_SIZE_10), 0); @@ -519,7 +519,7 @@ static void tc_libc_string_strncpy(void) char *res_ptr = NULL; res_ptr = strncpy(dest_arr, src, BUFF_SIZE); - TC_ASSERT_NOT_NULL("strncpy", res_ptr); + TC_ASSERT_NEQ("strncpy", res_ptr, NULL); TC_ASSERT_EQ("strncpy", strncmp(res_ptr, src, BUFF_SIZE), 0); TC_ASSERT_EQ("strncpy", strncmp(dest_arr, src, BUFF_SIZE), 0); @@ -543,7 +543,7 @@ static void tc_libc_string_strndup(void) char src[BUFF_SIZE] = "test"; dest_arr = strndup(src, BUFF_SIZE); - TC_ASSERT_NOT_NULL("strndup", dest_arr); + TC_ASSERT_NEQ("strndup", dest_arr, NULL); TC_ASSERT_EQ_CLEANUP("strndup", strncmp(dest_arr, src, BUFF_SIZE), 0, TC_FREE_MEMORY(dest_arr)); @@ -598,7 +598,7 @@ static void tc_libc_string_strpbrk(void) char *res_ptrstr = "mple"; res_ptr = strpbrk(dest_arr, cbuf); - TC_ASSERT_NOT_NULL("strpbrk", res_ptr); + TC_ASSERT_NEQ("strpbrk", res_ptr, NULL); TC_ASSERT_EQ("strpbrk", strncmp(res_ptr, res_ptrstr, BUFF_SIZE_10), 0); TC_ASSERT_EQ("strpbrk", *res_ptr, 'm'); @@ -625,7 +625,7 @@ static void tc_libc_string_strrchr(void) char *res_ptrstr = "es"; res_ptr = strrchr(dest_arr, 'e'); - TC_ASSERT_NOT_NULL("strrchr", res_ptr); + TC_ASSERT_NEQ("strrchr", res_ptr, NULL); TC_ASSERT_EQ("strrchr", strncmp(res_ptr, res_ptrstr, BUFF_SIZE), 0); TC_ASSERT_EQ("strrchr", *res_ptr, 'e'); @@ -681,12 +681,12 @@ static void tc_libc_string_strstr(void) char *psz = "str"; res_ptr = strstr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strstr", res_ptr); + TC_ASSERT_NEQ("strstr", res_ptr, NULL); TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0); psz = "test"; res_ptr = strstr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strstr", res_ptr); + TC_ASSERT_NEQ("strstr", res_ptr, NULL); TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr + 4, BUFF_SIZE_10), 0); psz = "notfound"; @@ -695,7 +695,7 @@ static void tc_libc_string_strstr(void) psz = ""; res_ptr = strstr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strstr", res_ptr); + TC_ASSERT_NEQ("strstr", res_ptr, NULL); TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0); TC_SUCCESS_RESULT(); @@ -720,7 +720,7 @@ static void tc_libc_string_strtok(void) int arr_idx = 0; char *res_ptr = NULL; res_ptr = strtok(szbuffer, " "); - TC_ASSERT_NOT_NULL("strtok", res_ptr); + TC_ASSERT_NEQ("strtok", res_ptr, NULL); while (res_ptr != NULL) { TC_ASSERT_EQ("strtok", strncmp(res_ptr, dest_arr[arr_idx], BUFF_SIZE_10), 0); @@ -753,8 +753,8 @@ static void tc_libc_string_strtok_r(void) char *psz_save; res_ptr = strtok_r(cbuf, " ", &psz_save); - TC_ASSERT_NOT_NULL("strtok_r", res_ptr); - TC_ASSERT_NOT_NULL("strtok_r", psz_save); + TC_ASSERT_NEQ("strtok_r", res_ptr, NULL); + TC_ASSERT_NEQ("strtok_r", psz_save, NULL); while (res_ptr != NULL) { TC_ASSERT_EQ("strtok_r", strncmp(res_ptr, dest_arr[arr_idx], BUFF_SIZE_10), 0); @@ -785,12 +785,12 @@ static void tc_libc_string_strcasestr(void) char *psz = "str"; res_ptr = strcasestr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strcasestr", res_ptr); + TC_ASSERT_NEQ("strcasestr", res_ptr, NULL); TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0); psz = "test"; res_ptr = strcasestr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strcasestr", res_ptr); + TC_ASSERT_NEQ("strcasestr", res_ptr, NULL); TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr + 4, BUFF_SIZE_10), 0); psz = "notfound"; @@ -799,7 +799,7 @@ static void tc_libc_string_strcasestr(void) psz = ""; res_ptr = strcasestr(dest_arr, psz); - TC_ASSERT_NOT_NULL("strcasestr", res_ptr); + TC_ASSERT_NEQ("strcasestr", res_ptr, NULL); TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0); TC_SUCCESS_RESULT(); @@ -815,7 +815,7 @@ static void tc_libc_string_memccpy(void) memset(some_str, 0, sizeof(some_str)); res_ptr = (char *)memccpy(some_str, test1_src, 'g', strlen(test1_src)); - TC_ASSERT_NOT_NULL("memccpy", res_ptr); + TC_ASSERT_NEQ("memccpy", res_ptr, NULL); TC_ASSERT_EQ("memccpy", strcmp(some_str, test_result), 0); TC_SUCCESS_RESULT(); diff --git a/apps/examples/testcase/le_tc/kernel/tc_libc_timer.c b/apps/examples/testcase/le_tc/kernel/tc_libc_timer.c index 97dfab4..c5948da 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_libc_timer.c +++ b/apps/examples/testcase/le_tc/kernel/tc_libc_timer.c @@ -109,7 +109,7 @@ static void tc_libc_timer_gmtime_r(void) /* verifying the structures returned and filled by comparing their parameters */ st_rettime = gmtime_r(&test_time, &st_time); - TC_ASSERT_NOT_NULL("gmtime_r", st_rettime); + TC_ASSERT_NEQ("gmtime_r", st_rettime, NULL); TC_ASSERT_EQ("gmtime_r", st_rettime->tm_year, st_time.tm_year); TC_ASSERT_EQ("gmtime_r", st_rettime->tm_mon, st_time.tm_mon); TC_ASSERT_EQ("gmtime_r", year, st_time.tm_year); @@ -139,10 +139,10 @@ static void tc_libc_timer_gmtime(void) TC_ASSERT_NEQ("time", ret_chk, (time_t)ERROR); st_rettime = gmtime(&time1); - TC_ASSERT_NOT_NULL("gmtime", st_rettime); + TC_ASSERT_NEQ("gmtime", st_rettime, NULL); st_localtime = localtime(&time1); - TC_ASSERT_NOT_NULL("localtime", st_localtime); + TC_ASSERT_NEQ("localtime", st_localtime, NULL); TC_ASSERT_EQ("localtime", st_rettime->tm_year, st_localtime->tm_year); TC_ASSERT_EQ("localtime", st_rettime->tm_mon, st_localtime->tm_mon); @@ -154,7 +154,7 @@ static void tc_libc_timer_gmtime(void) /* verifying the returned structure's parameter, year should not be negative, month range is 0-11 */ st_rettime = gmtime(&time2); - TC_ASSERT_NOT_NULL("gmtime", st_rettime); + TC_ASSERT_NEQ("gmtime", st_rettime, NULL); TC_ASSERT_GEQ("gtime", st_rettime->tm_year, 0); TC_ASSERT_GEQ("gtime", st_rettime->tm_mon, 0); TC_ASSERT_LT("gtime", st_rettime->tm_mon, 12); @@ -214,10 +214,10 @@ static void tc_libc_timer_localtime(void) time(&test_time); st_gmtime = gmtime(&test_time); - TC_ASSERT_NOT_NULL("gmtime", st_gmtime); + TC_ASSERT_NEQ("gmtime", st_gmtime, NULL); st_rettime = localtime(&test_time); - TC_ASSERT_NOT_NULL("localtime", st_gmtime); + TC_ASSERT_NEQ("localtime", st_gmtime, NULL); TC_ASSERT_EQ("localtime", st_rettime->tm_year, st_gmtime->tm_year); TC_ASSERT_EQ("localtime", st_rettime->tm_mon, st_gmtime->tm_mon); @@ -252,7 +252,7 @@ static void tc_libc_timer_localtime_r(void) /* verifying the structures "returned and filled" by comparing their parameters */ st_rettime = localtime_r(&test_time, &st_time); - TC_ASSERT_NOT_NULL("localtime_r", st_rettime); + TC_ASSERT_NEQ("localtime_r", st_rettime, NULL); TC_ASSERT_EQ("localtime_r", st_rettime->tm_year, st_time.tm_year); TC_ASSERT_EQ("localtime_r", st_rettime->tm_mon, st_time.tm_mon); TC_ASSERT_EQ("localtime_r", st_gettime.tm_year, st_time.tm_year); diff --git a/apps/examples/testcase/le_tc/kernel/tc_sched.c b/apps/examples/testcase/le_tc/kernel/tc_sched.c index 48a4bfb..46eea3d 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_sched.c +++ b/apps/examples/testcase/le_tc/kernel/tc_sched.c @@ -332,7 +332,7 @@ static void tc_sched_sched_gettcb(void) TC_ASSERT_EQ("sched_gettcb", tcb, NULL); tcb = sched_gettcb(PID_IDLE); - TC_ASSERT_NOT_NULL("sched_gettcb", tcb); + TC_ASSERT_NEQ("sched_gettcb", tcb, NULL); TC_ASSERT_EQ("sched_gettcb", tcb->pid, PID_IDLE); TC_SUCCESS_RESULT(); @@ -356,7 +356,7 @@ static void tc_sched_sched_lock_unlock(void) struct tcb_s *st_tcb = NULL; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); cntlock = st_tcb->lockcount; @@ -411,11 +411,11 @@ static void tc_sched_sched_self(void) /* get process id */ st_tcbpid = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcbpid); + TC_ASSERT_NEQ("sched_self", st_tcbpid, NULL); /* should return tcb for current process */ st_tcbself = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcbself); + TC_ASSERT_NEQ("sched_self", st_tcbself, NULL); TC_ASSERT_EQ("sched_self", st_tcbself->pid, st_tcbpid->pid); TC_SUCCESS_RESULT(); @@ -482,7 +482,7 @@ static void tc_sched_sched_lockcount(void) struct tcb_s *st_tcb = NULL; st_tcb = sched_self(); - TC_ASSERT_NOT_NULL("sched_self", st_tcb); + TC_ASSERT_NEQ("sched_self", st_tcb, NULL); prev_cnt = sched_lockcount(); ret_chk = sched_lock(); @@ -519,7 +519,7 @@ static void tc_sched_sched_getstreams(void) struct streamlist *stream; stream = sched_getstreams(); - TC_ASSERT_NOT_NULL("sched_getstreams", stream); + TC_ASSERT_NEQ("sched_getstreams", stream, NULL); TC_SUCCESS_RESULT(); } diff --git a/apps/examples/testcase/le_tc/kernel/tc_timer.c b/apps/examples/testcase/le_tc/kernel/tc_timer.c index 407ca7d..6209c87 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_timer.c +++ b/apps/examples/testcase/le_tc/kernel/tc_timer.c @@ -55,7 +55,7 @@ static void tc_timer_timer_create_delete(void) ret_chk = timer_create(clockid, &st_sigevent, &timer_id); TC_ASSERT_NEQ("timer_create", ret_chk, ERROR); - TC_ASSERT_NOT_NULL("timer_create", timer_id); + TC_ASSERT_NEQ("timer_create", timer_id, NULL); st_ret_prt = (struct posix_timer_s *)timer_id; TC_ASSERT_EQ_CLEANUP("timer_create", st_ret_prt->pt_value.sival_ptr, st_sigevent.sigev_value.sival_ptr, timer_delete(timer_id)); @@ -115,7 +115,7 @@ static void tc_timer_timer_set_get_time(void) st_sigevent.sigev_value.sival_ptr = &timer_id; ret_chk = timer_create(clockid, &st_sigevent, &timer_id); TC_ASSERT_NEQ("timer_create", ret_chk, ERROR); - TC_ASSERT_NOT_NULL("timer_create", timer_id); + TC_ASSERT_NEQ("timer_create", timer_id, NULL); st_timer_spec_set.it_interval.tv_sec = 1; st_timer_spec_set.it_interval.tv_nsec = 0; /* interval; */ diff --git a/apps/examples/testcase/le_tc/kernel/tc_umm_heap.c b/apps/examples/testcase/le_tc/kernel/tc_umm_heap.c index 50c7df8..9a26569 100644 --- a/apps/examples/testcase/le_tc/kernel/tc_umm_heap.c +++ b/apps/examples/testcase/le_tc/kernel/tc_umm_heap.c @@ -69,7 +69,7 @@ static void tc_umm_heap_malloc_free(struct tcb_s *st_tcb) for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) { for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) { mem_ptr[alloc_cnt] = (int *)malloc(ALLOC_SIZE_VAL * sizeof(int)); - TC_ASSERT_NOT_NULL("malloc", mem_ptr[alloc_cnt]); + TC_ASSERT_NEQ("malloc", mem_ptr[alloc_cnt], NULL); } TC_ASSERT_EQ_ERROR_CLEANUP("malloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES)); mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES); @@ -97,7 +97,7 @@ static void tc_umm_heap_calloc(struct tcb_s *st_tcb) for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) { for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) { mem_ptr[alloc_cnt] = (int *)calloc(ALLOC_SIZE_VAL, sizeof(int)); - TC_ASSERT_NOT_NULL("calloc", mem_ptr[alloc_cnt]); + TC_ASSERT_NEQ("calloc", mem_ptr[alloc_cnt], NULL); } TC_ASSERT_EQ_ERROR_CLEANUP("calloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES)); @@ -129,7 +129,7 @@ static void tc_umm_heap_realloc(struct tcb_s *st_tcb) for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) { for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) { mem_ptr[alloc_cnt] = (int *)realloc(val, ALLOC_SIZE_VAL * sizeof(int)); - TC_ASSERT_NOT_NULL("realloc", mem_ptr[alloc_cnt]); + TC_ASSERT_NEQ("realloc", mem_ptr[alloc_cnt], NULL); } TC_ASSERT_EQ_ERROR_CLEANUP("realloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES)); mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES); @@ -158,7 +158,7 @@ static void tc_umm_heap_memalign(struct tcb_s *st_tcb) for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) { for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) { mem_ptr[alloc_cnt] = (int *)memalign(sizeof(int), ALLOC_SIZE_VAL * sizeof(int)); - TC_ASSERT_NOT_NULL("memalign", mem_ptr[alloc_cnt]); + TC_ASSERT_NEQ("memalign", mem_ptr[alloc_cnt], NULL); } TC_ASSERT_EQ_ERROR_CLEANUP("memalign", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES)); mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES); @@ -203,7 +203,7 @@ static void tc_umm_heap_random_malloc(struct tcb_s *st_tcb) malloc will be successful and return the pointer of memory. Else, malloc will be failed and return NULL pointer */ if (info.mxordblk >= MM_ALIGN_UP(allocated[alloc_cnt] + SIZEOF_MM_ALLOCNODE)) { - TC_ASSERT_NOT_NULL("malloc", mem_ptr[alloc_cnt]); + TC_ASSERT_NEQ("malloc", mem_ptr[alloc_cnt], NULL); } else { TC_ASSERT_EQ("malloc", mem_ptr[alloc_cnt], NULL); allocated[alloc_cnt] = 0; @@ -244,7 +244,7 @@ static void tc_umm_heap_mallinfo(void) for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) { mem_ptr = (int *)malloc(sizeof(int)); - TC_ASSERT_NOT_NULL("malloc", mem_ptr); + TC_ASSERT_NEQ("malloc", mem_ptr, NULL); st_mallinfo = mallinfo(); TC_ASSERT_GT_CLEANUP("mallinfo", st_mallinfo.fordblks, 0, TC_FREE_MEMORY(mem_ptr)); @@ -258,7 +258,7 @@ static void tc_umm_heap_zalloc(void) int mem_idx; int *mem_ptr = NULL; mem_ptr = zalloc(sizeof(int) * 5); - TC_ASSERT_NOT_NULL("zalloc", mem_ptr); + TC_ASSERT_NEQ("zalloc", mem_ptr, NULL); for (mem_idx = 0; mem_idx < 5; mem_idx++) { TC_ASSERT_EQ_ERROR_CLEANUP("zalloc", mem_ptr[mem_idx], 0, get_errno(), TC_FREE_MEMORY(mem_ptr)); diff --git a/apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c b/apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c index 010437f..0660b11 100644 --- a/apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c +++ b/apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c @@ -231,7 +231,7 @@ void itc_arastorage_db_print_header_p(void) snprintf(g_query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 5;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME, g_attribute_set[0]); g_cursor = db_query(g_query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); ret = db_print_header(g_cursor); TC_ASSERT_EQ_CLEANUP("db_print_header", DB_ERROR(ret), 0, db_cursor_free(g_cursor)); db_cursor_free(g_cursor); @@ -257,7 +257,7 @@ void itc_arastorage_db_print_tuple_p(void) snprintf(g_query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 5;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME, g_attribute_set[0]); #endif g_cursor = db_query(g_query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); if (DB_SUCCESS(cursor_move_first(g_cursor))) { do { diff --git a/apps/examples/testcase/ta_tc/arastorage/utc/utc_arastorage_main.c b/apps/examples/testcase/ta_tc/arastorage/utc/utc_arastorage_main.c index 450b1a5..064f682 100644 --- a/apps/examples/testcase/ta_tc/arastorage/utc/utc_arastorage_main.c +++ b/apps/examples/testcase/ta_tc/arastorage/utc/utc_arastorage_main.c @@ -74,7 +74,7 @@ void check_query_result(char * query) { db_result_t res; g_cursor = db_query(query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); if (DB_SUCCESS(cursor_move_first(g_cursor))) { do { res = db_print_tuple(g_cursor); @@ -376,7 +376,7 @@ void utc_arastorage_db_query_tc_p(void) snprintf(query, QUERY_LENGTH, "SELECT id, date, fruit, value FROM %s WHERE value < 990;", RELATION_NAME1); #endif g_cursor = db_query(query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); res = db_cursor_free(g_cursor); TC_ASSERT("db_cursor_free", DB_SUCCESS(res)); @@ -419,7 +419,7 @@ void utc_arastorage_db_query_tc_p(void) snprintf(query, QUERY_LENGTH, "SELECT id, date, fruit FROM %s WHERE id > 0;", RELATION_NAME1); #endif g_cursor = db_query(query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); TC_SUCCESS_RESULT(); } @@ -976,7 +976,7 @@ void utc_arastorage_cursor_is_first_row_tc_n(void) snprintf(query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 0;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME1, g_attribute_set[0]); g_cursor = db_query(query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); res = cursor_move_last(g_cursor); TC_ASSERT("cursor_move_last", DB_SUCCESS(res)); /* Cursor is valid, but it isn't pointing first row */ @@ -1024,7 +1024,7 @@ void utc_arastorage_cursor_is_last_row_tc_n(void) snprintf(query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 0;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME1, g_attribute_set[0]); g_cursor = db_query(query); - TC_ASSERT_NOT_NULL("db_query", g_cursor); + TC_ASSERT_NEQ("db_query", g_cursor, NULL); res = cursor_move_first(g_cursor); TC_ASSERT("cursor_move_first", DB_SUCCESS(res)); /* Cursor is valid, but it isn't pointing last row */ diff --git a/apps/examples/testcase/ta_tc/systemio/itc/itc_gpio.c b/apps/examples/testcase/ta_tc/systemio/itc/itc_gpio.c index c87e7b9..5efca44 100644 --- a/apps/examples/testcase/ta_tc/systemio/itc/itc_gpio.c +++ b/apps/examples/testcase/ta_tc/systemio/itc/itc_gpio.c @@ -73,7 +73,7 @@ void itc_gpio_open_close_p(void) int gpiopin = 12; int ret; g_gpio = iotbus_gpio_open(gpiopin); - TC_ASSERT_NOT_NULL ("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ ("iotbus_gpio_open" , g_gpio, NULL); gpiopin = 14; g_gpio2 = iotbus_gpio_open(gpiopin); @@ -104,7 +104,7 @@ void itc_gpio_set_get_direction_p(void) bool check = true; gpiopin = 12; g_gpio = iotbus_gpio_open(gpiopin); - TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL); for (index = 0; index < ncount; index++) { ret = iotbus_gpio_set_direction(g_gpio, setDirection[index]); @@ -150,7 +150,7 @@ void itc_gpio_set_get_edge_mode_p(void) bool check = true; gpiopin = 12; g_gpio = iotbus_gpio_open(gpiopin); - TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL); for (index = 0; index < ncount; index++) { ret = iotbus_gpio_set_edge_mode(g_gpio, setEdge[index]); @@ -194,7 +194,7 @@ void itc_gpio_set_get_drive_mode_p(void) bool check = true; g_gpio = iotbus_gpio_open(gpiopin); - TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL); for (index = 0; index < ncount; index++) { ret = iotbus_gpio_set_drive_mode(g_gpio, setDrive[index]); @@ -233,7 +233,7 @@ void itc_gpio_get_pin_p(void) int gpioSetpin = 12; int gpioGetpin; iotbus_gpio_context_h m_gpio = iotbus_gpio_open(gpioSetpin); - TC_ASSERT_NOT_NULL("iotbus_gpio_open" , m_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open" , m_gpio, NULL); gpioGetpin = iotbus_gpio_get_pin(m_gpio); TC_ASSERT_EQ_CLEANUP("iotbus_gpio_get_pin", gpioGetpin, gpioSetpin, iotbus_gpio_close(m_gpio)); @@ -254,7 +254,7 @@ void itc_gpio_read_write_p(void) { int ret, gpiopin = 12; g_gpio = iotbus_gpio_open(gpiopin); - TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL); ret = iotbus_gpio_read(g_gpio); TC_ASSERT_EQ_CLEANUP("iotbus_gpio_read", (ret < 0), false, iotbus_gpio_close(g_gpio)); @@ -281,7 +281,7 @@ void itc_gpio_register_unregister_callback_p(void) int data = 0, gpio_pin2 = 57, gpio_pin1 = 41; g_gpio = iotbus_gpio_open(gpio_pin1); - TC_ASSERT_NOT_NULL ("iotbus_gpio_open" , g_gpio); + TC_ASSERT_NEQ ("iotbus_gpio_open" , g_gpio, NULL); g_gpio2 = iotbus_gpio_open(gpio_pin2); TC_ASSERT_NEQ_CLEANUP("iotbus_gpio_open", g_gpio2 , NULL , iotbus_gpio_close(g_gpio)); diff --git a/apps/examples/testcase/ta_tc/systemio/itc/itc_i2c.c b/apps/examples/testcase/ta_tc/systemio/itc/itc_i2c.c index bf12a41..ca4822a 100644 --- a/apps/examples/testcase/ta_tc/systemio/itc/itc_i2c.c +++ b/apps/examples/testcase/ta_tc/systemio/itc/itc_i2c.c @@ -44,7 +44,7 @@ void itc_iotbus_i2c_init_stop_p(void) { int ret = IOTBUS_ERROR_NONE; iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus); - TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c); + TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL); ret = iotbus_i2c_stop(h_i2c); TC_ASSERT_EQ("iotbus_i2c_stop", ret, IOTBUS_ERROR_NONE); @@ -67,7 +67,7 @@ void itc_iotbus_i2c_set_frequency_p(void) int numModes = sizeof(szFreqMode) / sizeof(int); int index = 0; iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus); - TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c); + TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL); for (index = 0; index < numModes; index++) { ret = iotbus_i2c_set_frequency(h_i2c, szFreqMode[index]); @@ -93,7 +93,7 @@ void itc_iotbus_i2c_set_address_p(void) int ret = IOTBUS_ERROR_NONE; uint8_t address = 0x08; iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus); - TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c); + TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL); ret = iotbus_i2c_set_address(h_i2c, address); TC_ASSERT_EQ_CLEANUP("iotbus_i2c_set_address", ret, IOTBUS_ERROR_NONE, iotbus_i2c_stop(h_i2c)); @@ -118,7 +118,7 @@ void itc_iotbus_i2c_write_read_p(void) uint8_t szCmd[2] = { 0x01, 0x02 }; uint8_t szReadBuf[10]; iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus); - TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c); + TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL); ret = iotbus_i2c_write(h_i2c, szCmd, 1); TC_ASSERT_EQ_CLEANUP("iotbus_i2c_write", (ret < 0), false, iotbus_i2c_stop(h_i2c)); diff --git a/apps/examples/testcase/ta_tc/systemio/itc/itc_pwm.c b/apps/examples/testcase/ta_tc/systemio/itc/itc_pwm.c index 89331b5..faccc6c 100644 --- a/apps/examples/testcase/ta_tc/systemio/itc/itc_pwm.c +++ b/apps/examples/testcase/ta_tc/systemio/itc/itc_pwm.c @@ -43,7 +43,7 @@ void itc_pwm_open_close_p(void) int channel = 1; int ret = 0; iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel); - TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm); + TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL); ret = iotbus_pwm_close(h_pwm); TC_ASSERT_EQ("iotbus_pwm_close", ret, OK); @@ -66,7 +66,7 @@ void itc_pwm_set_get_duty_cycle_p(void) int cycle = 20; int ret = 0; iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel); - TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm); + TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL); ret = iotbus_pwm_set_duty_cycle(h_pwm, cycle); TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_duty_cycle", ret, OK, iotbus_pwm_close(h_pwm)); @@ -95,7 +95,7 @@ void itc_pwm_set_get_period_p(void) int period = 1000; int ret = 0; iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel); - TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm); + TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL); ret = iotbus_pwm_set_period(h_pwm, period); TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_period", ret, OK, iotbus_pwm_close(h_pwm)); @@ -126,7 +126,7 @@ void itc_pwm_set_enabled_is_enabled_p(void) int default_state = 0; int get_state = 0; iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel); - TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm); + TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL); ret = iotbus_pwm_set_period(h_pwm, period); TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_period", ret, OK, iotbus_pwm_close(h_pwm)); @@ -160,7 +160,7 @@ void itc_pwm_set_enabled_is_enabled_p(void) } ret = iotbus_pwm_close(h_pwm); - TC_ASSERT_NOT_NULL("iotbus_pwm_close", h_pwm); + TC_ASSERT_NEQ("iotbus_pwm_close", h_pwm, NULL); TC_SUCCESS_RESULT(); } diff --git a/apps/examples/testcase/ta_tc/systemio/itc/itc_spi.c b/apps/examples/testcase/ta_tc/systemio/itc/itc_spi.c index b2e1e04..353d0c2 100644 --- a/apps/examples/testcase/ta_tc/systemio/itc/itc_spi.c +++ b/apps/examples/testcase/ta_tc/systemio/itc/itc_spi.c @@ -53,7 +53,7 @@ void itc_iotbus_spi_open_close_p(void) { int ret = IOTBUS_ERROR_NONE; iotbus_spi_context_h h_spi = iotbus_spi_open(gBus, &_g_st_config); - TC_ASSERT_NOT_NULL("iotbus_spi_open", h_spi); + TC_ASSERT_NEQ("iotbus_spi_open", h_spi, NULL); ret = iotbus_spi_close(h_spi); TC_ASSERT_EQ("iotbus_spi_close", ret, IOTBUS_ERROR_NONE); @@ -75,7 +75,7 @@ void itc_iotbus_spi_write_recv_trasfer_p(void) unsigned char sz_rxbuf[64] = { 0, }; int ret = IOTBUS_ERROR_NONE; iotbus_spi_context_h h_spi = iotbus_spi_open(gBus, &_g_st_config); - TC_ASSERT_NOT_NULL("iotbus_spi_open", h_spi); + TC_ASSERT_NEQ("iotbus_spi_open", h_spi, NULL); ret = iotbus_spi_write(h_spi, sz_txbuf, 8); TC_ASSERT_EQ_CLEANUP("iotbus_spi_write", ret, IOTBUS_ERROR_NONE, iotbus_spi_close(h_spi)); diff --git a/apps/examples/testcase/ta_tc/systemio/itc/itc_uart.c b/apps/examples/testcase/ta_tc/systemio/itc/itc_uart.c index 4943199..3f16816 100644 --- a/apps/examples/testcase/ta_tc/systemio/itc/itc_uart.c +++ b/apps/examples/testcase/ta_tc/systemio/itc/itc_uart.c @@ -53,7 +53,7 @@ void itc_iotbus_uart_init_stop_p(void) { int ret = IOTBUS_ERROR_NONE; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); ret = iotbus_uart_stop(h_uart); TC_ASSERT_EQ("iotbus_uart_stop", ret, IOTBUS_ERROR_NONE); @@ -74,7 +74,7 @@ void itc_iotbus_uart_set_baudrate_p(void) int i_baudrate = 115200; int ret = IOTBUS_ERROR_NONE; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); ret = iotbus_uart_set_baudrate(h_uart, i_baudrate); TC_ASSERT_EQ_CLEANUP("iotbus_uart_set_baudrate", ret, IOTBUS_ERROR_NONE, iotbus_uart_stop(h_uart)); @@ -102,7 +102,7 @@ void itc_iotbus_uart_set_mode_p(void) int i_modes = sizeof(mode) / sizeof(int); int index = 0; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); for (index = 0; index < i_modes; index++) { ret = iotbus_uart_set_mode(h_uart, i_bytesize, mode[index], i_stop_bits); @@ -130,7 +130,7 @@ void itc_iotbus_uart_set_flowcontrol_p(void) int rtscts[4][2] = { {1, 0}, {0, 1}, {1, 1}, {0, 0} }; int index = 0; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); for (index = 0; index < i_size; index++) { ret = iotbus_uart_set_flowcontrol(h_uart, rtscts[index][0], rtscts[index][1]); @@ -157,7 +157,7 @@ void itc_iotbus_uart_write_read_p(void) char szInputText[32] = "UART READ/WRITE ITC TESTING!"; char szOutputText[32]; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); ret = iotbus_uart_write(h_uart, szInputText, sizeof(szInputText)); TC_ASSERT_EQ_CLEANUP("iotbus_uart_write", ret < 0, false, iotbus_uart_stop(h_uart)); @@ -187,7 +187,7 @@ void itc_iotbus_uart_flush_p(void) { int ret = IOTBUS_ERROR_NONE; iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH); - TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart); + TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL); ret = iotbus_uart_flush(h_uart); TC_ASSERT_EQ_CLEANUP("iotbus_uart_flush", ret, IOTBUS_ERROR_NONE, iotbus_uart_stop(h_uart)); diff --git a/apps/examples/testcase/ta_tc/systemio/utc/utc_gpio.c b/apps/examples/testcase/ta_tc/systemio/utc/utc_gpio.c index f89adb7..74bed26 100644 --- a/apps/examples/testcase/ta_tc/systemio/utc/utc_gpio.c +++ b/apps/examples/testcase/ta_tc/systemio/utc/utc_gpio.c @@ -51,12 +51,12 @@ static void utc_gpio_open_p(void) { #ifdef CONFIG_ARCH_CHIP_STM32 iotbus_gpio_context_h m_gpio = iotbus_gpio_open(GPIO_PORTA_PIN5); - TC_ASSERT_NOT_NULL("iotbus_gpio_open", m_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open", m_gpio, NULL); gpio = m_gpio; TC_SUCCESS_RESULT(); #elif CONFIG_ARCH_CHIP_S5J iotbus_gpio_context_h m_gpio = iotbus_gpio_open(41); - TC_ASSERT_NOT_NULL("iotbus_gpio_open", m_gpio); + TC_ASSERT_NEQ("iotbus_gpio_open", m_gpio, NULL); gpio = m_gpio; TC_SUCCESS_RESULT(); #endif @@ -309,7 +309,7 @@ int utc_gpio_main(void) utc_gpio_open_p(); utc_gpio_open_n(); - + #ifdef CONFIG_ARCH_CHIP_STM32 utc_gpio_open2(GPIO_PORTA_PIN6); #elif CONFIG_ARCH_CHIP_S5J diff --git a/apps/examples/testcase/ta_tc/systemio/utc/utc_i2c.c b/apps/examples/testcase/ta_tc/systemio/utc/utc_i2c.c index 78c4d62..8cd7955 100644 --- a/apps/examples/testcase/ta_tc/systemio/utc/utc_i2c.c +++ b/apps/examples/testcase/ta_tc/systemio/utc/utc_i2c.c @@ -35,7 +35,7 @@ iotbus_i2c_context_h i2c; static void utc_i2c_init_p(void) { iotbus_i2c_context_h m_i2c = iotbus_i2c_init(1); - TC_ASSERT_NOT_NULL("iotbus_i2c_init", m_i2c); + TC_ASSERT_NEQ("iotbus_i2c_init", m_i2c, NULL); i2c = m_i2c; TC_SUCCESS_RESULT(); } diff --git a/apps/examples/testcase/ta_tc/systemio/utc/utc_pwm.c b/apps/examples/testcase/ta_tc/systemio/utc/utc_pwm.c index 9b4cceb..3e65808 100644 --- a/apps/examples/testcase/ta_tc/systemio/utc/utc_pwm.c +++ b/apps/examples/testcase/ta_tc/systemio/utc/utc_pwm.c @@ -35,7 +35,7 @@ iotbus_pwm_context_h pwm; static void utc_pwm_open_p(void) { iotbus_pwm_context_h m_pwm = iotbus_pwm_open(0, 1); - TC_ASSERT_NOT_NULL("iotbus_pwm_open", m_pwm); + TC_ASSERT_NEQ("iotbus_pwm_open", m_pwm, NULL); pwm = m_pwm; TC_SUCCESS_RESULT(); } diff --git a/apps/examples/testcase/ta_tc/systemio/utc/utc_spi.c b/apps/examples/testcase/ta_tc/systemio/utc/utc_spi.c index 3a4ee7b..f1ac31c 100644 --- a/apps/examples/testcase/ta_tc/systemio/utc/utc_spi.c +++ b/apps/examples/testcase/ta_tc/systemio/utc/utc_spi.c @@ -51,7 +51,7 @@ struct iotbus_spi_config_s config = { static void utc_spi_open_p(void) { iotbus_spi_context_h m_spi = iotbus_spi_open(bus, &config); - TC_ASSERT_NOT_NULL("iotbus_spi_open", m_spi); + TC_ASSERT_NEQ("iotbus_spi_open", m_spi, NULL); spi = m_spi; TC_SUCCESS_RESULT(); } diff --git a/apps/examples/testcase/ta_tc/systemio/utc/utc_uart.c b/apps/examples/testcase/ta_tc/systemio/utc/utc_uart.c index f084359..b586ff0 100644 --- a/apps/examples/testcase/ta_tc/systemio/utc/utc_uart.c +++ b/apps/examples/testcase/ta_tc/systemio/utc/utc_uart.c @@ -40,12 +40,12 @@ static void utc_uart_initialize_p(void) { #ifdef CONFIG_ARCH_CHIP_STM32 iotbus_uart_context_h m_uart = iotbus_uart_init("/dev/ttyS1"); - TC_ASSERT_NOT_NULL("iotbus_uart_init", m_uart); + TC_ASSERT_NEQ("iotbus_uart_init", m_uart, NULL); uart = m_uart; TC_SUCCESS_RESULT(); #elif CONFIG_ARCH_CHIP_S5J iotbus_uart_context_h m_uart = iotbus_uart_init("/dev/ttyS2"); - TC_ASSERT_NOT_NULL("iotbus_uart_init", m_uart); + TC_ASSERT_NEQ("iotbus_uart_init", m_uart, NULL); uart = m_uart; TC_SUCCESS_RESULT(); #endif diff --git a/apps/examples/testcase/tc_common.h b/apps/examples/testcase/tc_common.h index c09a68c..b9bf978 100644 --- a/apps/examples/testcase/tc_common.h +++ b/apps/examples/testcase/tc_common.h @@ -127,15 +127,6 @@ int total_fail; #define TC_ASSERT_LEQ(api_name, var, ref) TC_ASSERT_LEQ_CLEANUP(api_name, var, ref, ) -#define TC_ASSERT_NOT_NULL(api_name, handle) \ -{\ - if ((handle) == NULL) {\ - printf("\n[%s][Line : %d] FAIL , %s : API returned NULL ", __func__, __LINE__, api_name); \ - total_fail++; \ - return; \ - } \ -} - #define TC_SUCCESS_RESULT() \ {\ printf("\n[%s] PASS \n", __func__); \ -- 2.7.4