#if (INCLUDE__UBINOS__UBIK_TEST == 1)
#if !(UBINOS__UBIK_TEST__EXCLUDE_CONDVTESTSET == 1)
#include <stdio.h>
static void condvtest02_task1func(void * arg) {
int r;
int i;
for (i=0; i<(UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1); i++) {
printf("1");
}
printf("\n");
printf("Task 1 waits signal\n");
if (0 != r) {
printf("Task 1: fail at condv_wait(), err=%d\n", r);
goto end0;
}
printf("Task 1 receives signal\n");
for (i=0; i<(UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1); i++) {
printf("1");
}
printf("\n");
end0:
printf("Task 1 ends\n");
}
static void condvtest02_task2func(void * arg) {
int i;
for (i=0; i<(UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1); i++) {
printf("2");
}
printf("\n");
printf("Task 2 ends\n");
}
static void condvtest02_task3func(void * arg) {
int r;
int i;
for (i=0; i<(UBINOS__UBIK_TEST__TASKLOOPCOUNT * 3); i++) {
printf("3");
}
printf("\n");
printf("Task 3 sends signal\n");
if (0 != r) {
printf("Task 3: fail at condv_signal(), err=%d\n", r);
goto end0;
}
for (i=0; i<(UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1); i++) {
printf("3");
}
printf("\n");
end0:
printf("Task 3 ends\n");
}
int r;
int r2;
unsigned int count1;
unsigned int count2;
unsigned int count3;
unsigned int sleepvalue =
ubik_timemstotick(UBINOS__UBIK_TEST__TASKWAITTIMEMS) * UBINOS__UBIK_TEST__TASKLOOPCOUNT / 3;
printf("\n");
printf("<test>\n");
printf("<name>ubik_test_condvtest02</name>\n");
printf("<description>Priority inversion test of condition variable</description>\n");
printf("<message>\n");
if (0 != r) {
printf("fail at condv_create(), err=%d\n", r);
r = -1;
goto end0;
}
if (0 != r) {
printf("fail at mutex_create(), err=%d\n", r);
r = -1;
goto end1;
}
printf("Task 3 begins\n");
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end2;
}
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 01: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Task 1 begins\n");
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end3;
}
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 02: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 03: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Task 2 begins\n");
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end3;
}
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 04: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 05: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 06: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
printf("\n");
printf("Checking\n");
printf("\n");
printf("Check point 07: ");
printf("fail\n");
r = -1;
goto end3;
}
printf("pass\n");
r = 0;
end3:
if (0 != r2) {
printf("fail at task_join_and_delete(), err=%d\n", r2);
r = -1;
}
end2:
if (0 != r2) {
printf("fail at mutex_delete(), err=%d\n", r2);
r = -1;
}
end1:
if (0 != r2) {
printf("fail at condv_delete(), err=%d\n", r2);
r = -1;
}
end0:
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 condv_delete(condv_pt *condv_p)
int condv_signal(condv_pt condv)
int condv_create(condv_pt *condv_p)
int condv_wait(condv_pt condv, mutex_pt mutex)
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_create_noautodel(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name)
int task_join_and_delete(task_pt *task_p, int *result_p, int count)
int task_sleep(unsigned int tick)
int task_getpriority(task_pt task)
#define NULL
Definition: type.h:42
unsigned int ubik_timemstotick(unsigned int timems)
volatile unsigned int _g_ubik_test_count1
태스크 별 시험 진행 상황을 저장하는 전역 변수 1
task_pt _g_ubik_test_task_a[4]
시험 용 태스크 배열
volatile unsigned int _g_ubik_test_count2
태스크 별 시험 진행 상황을 저장하는 전역 변수 2
condv_pt _g_ubik_test_condv
시험 용 상태변수
volatile unsigned int _g_ubik_test_count3
태스크 별 시험 진행 상황을 저장하는 전역 변수 3
int ubik_test_condvtest02(void)
Test for priority inversion situation by condition variable.
volatile unsigned int _g_ubik_test_result
시험 결과를 저장하는 전역 변수
mutex_pt _g_ubik_test_mutex
시험 용 뮤택스