#if (INCLUDE__UBINOS__UBIK_TEST == 1)
#if !(UBINOS__UBIK_TEST__EXCLUDE_TASKTESTSET2 == 1)
#include <stdio.h>
#define TASKWORKINGTIMEMS 5
static void tasktest06_task1func(void * arg) {
}
int r;
int r2;
unsigned int i;
unsigned int j;
unsigned int size_old;
unsigned int count_old;
unsigned int size;
unsigned int count;
printf("\n");
printf("<test>\n");
printf("<name>ubik_test_tasktest06</name>\n");
printf("<description>Test for memory leak by task</description>\n");
printf("<message>\n");
if (0 != r) {
printf("fail at heap_getallocatedsize\n");
goto end0;
}
if (0 != r) {
printf("fail at heap_getallocatedcount\n");
goto end0;
}
if (0 != r) {
printf("fail at mutex_create(), err=%d\n", r);
r = -1;
goto end0;
}
task_p = malloc(
sizeof(
task_pt) * UBINOS__UBIK_TEST__MEMLEAK_TASKCOUNT);
printf("fail at malloc()\n");
r = -1;
goto end1;
}
r = 0;
printf("|----------|\n ");
for (i=0; i<UBINOS__UBIK_TEST__MEMLEAK_TESTCOUNT; i++) {
for (j=0; j<UBINOS__UBIK_TEST__MEMLEAK_TASKCOUNT; j++) {
if (0 != r) {
printf("\n");
printf("test %d, task %d\n", i, j);
printf("fail at task_create(), err=%d\n", r);
r = -1;
break;
}
}
}
if (0 != r) {
break;
}
if (0 == i%(UBINOS__UBIK_TEST__MEMLEAK_TESTCOUNT/10)) {
printf("+");
}
}
if (0 == r) {
printf("\n");
printf("pass %d tests creating and deleting %d tasks\n", i, j);
}
free(task_p);
end1:
if (0 != r2) {
printf("fail at mutex_delete(), err=%d\n", r2);
r = -1;
}
if (0 == r) {
if (0 != r2) {
printf("fail at heap_getallocatedsize\n");
r = -1;
goto end0;
}
if (0 != r2) {
printf("fail at heap_getallocatedcount\n");
r = -1;
goto end0;
}
if (size_old != size || count_old != count) {
printf("memory leak was detected\n");
r = -1;
goto end0;
}
}
end0:
if (0 != r) {
r = -1;
}
else {
r = 0;
}
printf("</message>\n");
printf("<result>");
if (0 == r) {
printf("pass");
}
else {
printf("fail");
}
printf("</result>\n");
printf("</test>\n");
printf("\n");
return r;
}
#endif
#endif
void bsp_busywait(unsigned int count)
unsigned int bsp_getbusywaitcountperms(void)
int heap_getallocatedcount(heap_pt heap, unsigned int *count_p)
int heap_getallocatedsize(heap_pt heap, unsigned int *size_p)
int mutex_unlock(mutex_pt mutex)
int mutex_create(mutex_pt *mutex_p)
int mutex_delete(mutex_pt *mutex_p)
int mutex_lock(mutex_pt mutex)
stdlib (Standard Library) API
int task_sleep(unsigned int tick)
int task_getpriority(task_pt task)
int task_create(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name)
#define NULL
Definition: type.h:42
int ubik_collectgarbage(void)
unsigned int ubik_timemstotick(unsigned int timems)
volatile unsigned int _g_ubik_test_count1
태스크 별 시험 진행 상황을 저장하는 전역 변수 1
mutex_pt _g_ubik_test_mutex
시험 용 뮤택스
int ubik_test_tasktest06(void)
Test for memory leak by task.