test: TDD用例调整

方案描述:
1、门禁流水线跑单个测试用例.bin文件有时间限制,将用时过长的bin按类型拆分;
2、缩短EDF测试用例的时间;
3、dynload用例改变当前工作路径未恢复导致执行结果的xml文件未生成,在用例结束退出之前恢复当前工作路径。

Close:#I6YIX6

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I8c6118f9589e8801000ccb0cae9b81e0925696f4
This commit is contained in:
zhangdengyu
2023-05-17 16:29:43 +08:00
parent 5de241eb2a
commit 76228c3617
38 changed files with 845 additions and 334 deletions
@@ -35,9 +35,9 @@ static int ChildProcess(void)
volatile unsigned int count = 0;
struct sched_param currSchedParam = { 0 };
struct sched_param param = {
.sched_deadline = 4000000, /* 4000000, 4s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = sched_getparam(getpid(), &currSchedParam);
@@ -58,23 +58,23 @@ static int ChildProcess(void)
ret = sched_getparam(getpid(), &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
printf("--- 1 edf thread start ---\n\r");
printf("--- 1 edf thread start --\n\r");
do {
for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */
for (volatile int j = 0; j < 10; j++) { /* 10, no special meaning */
for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */
for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */
int tmp = i - j;
}
}
if (count % 20 == 0) { /* 20, no special meaning */
printf("--- 2 edf thread running ---\n\r");
if (count % 3 == 0) { /* 3, no special meaning */
printf("--- 2 edf thread running --\n\r");
}
count++;
} while (count <= 100); /* 100, no special meaning */
printf("--- 3 edf thread end ---\n\r");
} while (count <= 6); /* 6, no special meaning */
printf("--- 3 edf thread end --\n\r");
return 0;
}
@@ -40,9 +40,9 @@ static void *ThreadFuncTest(void *args)
ret = pthread_getschedparam(pthread_self(), & currPolicy, &currSchedParam);
ICUNIT_GOTO_EQUAL(ret, 0, LOS_NOK, EXIT);
ICUNIT_GOTO_EQUAL( currPolicy, SCHED_DEADLINE, LOS_NOK, EXIT);
ICUNIT_GOTO_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK, EXIT); /* 3000000, 3s */
ICUNIT_GOTO_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK, EXIT); /* 200000, 200ms */
ICUNIT_GOTO_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK, EXIT); /* 5000000, 5s */
ICUNIT_GOTO_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK, EXIT); /* 1000000, 1s */
ICUNIT_GOTO_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK, EXIT); /* 20000, 20ms */
ICUNIT_GOTO_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK, EXIT); /* 1000000, 1s */
printf("--- 1 edf Tid[%d] PTid[%d] thread start ---\n\r", currTID, pt);
do {
@@ -51,11 +51,11 @@ static void *ThreadFuncTest(void *args)
volatile int tmp = i - j;
}
}
if (count % 20 == 0) { /* 20, no special meaning */
if (count % 3 == 0) { /* 3, no special meaning */
printf("--- 2 edf Tid[%d] PTid[%d] thread running ---\n\r", currTID, pt);
}
count++;
} while (count <= 100); /* 100, no special meaning */
} while (count <= 6); /* 6, no special meaning */
printf("--- 3 edf Tid[%d] PTid[%d] thread end ---\n\r", currTID, pt);
ret = LOS_OK;
@@ -74,9 +74,9 @@ static int ChildProcess(void)
struct sched_param currSchedParam = { 0 };
int currTID = Syscall(SYS_gettid, 0, 0, 0, 0);
struct sched_param param = {
.sched_deadline = 3000000, /* 3000000, 3s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = sched_setscheduler(getpid(), SCHED_DEADLINE, &param);
@@ -85,25 +85,25 @@ static int ChildProcess(void)
ret = pthread_getschedparam(pthread_self(), & currPolicy, &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
ret = pthread_create(&newUserThread, NULL, ThreadFuncTest, (void *)currTID);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
printf("--- 1 edf Tid[%d] thread start ---\n\r", currTID);
do {
for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */
for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */
for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */
int tmp = i - j;
}
}
if (count % 20 == 0) { /* 20, no special meaning */
if (count % 3 == 0) { /* 3, no special meaning */
printf("--- 2 edf Tid[%d] thread running ---\n\r", currTID);
}
count++;
} while (count <= 100); /* 100, no special meaning */
} while (count <= 6); /* 6, no special meaning */
printf("--- 3 edf Tid[%d] thread end ---\n\r", currTID);
ret = pthread_join(newUserThread, (void **)&childThreadRetval);
@@ -40,22 +40,22 @@ static int EdfProcess(void)
ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
printf("--- edf2 -- 1 -- Tid[%d] thread start ---\n\r", currTID);
do {
for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */
for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */
for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */
int tmp = i - j;
}
}
if (count % 20 == 0) { /* 20, no special meaning */
if (count % 3 == 0) { /* 3, no special meaning */
printf("--- edf2 -- 2 -- Tid[%d] thread running ---\n\r", currTID);
}
count++;
} while (count <= 100); /* 100, no special meaning */
} while (count <= 6); /* 6, no special meaning */
printf("--- edf2 -- 3 -- Tid[%d] thread end ---\n\r", currTID);
return 0;
@@ -71,9 +71,9 @@ static int ChildProcess(void)
struct sched_param currSchedParam = { 0 };
int currTID = Syscall(SYS_gettid, 0, 0, 0, 0);
struct sched_param param = {
.sched_deadline = 3000000, /* 3000000, 3s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = sched_setscheduler(getpid(), SCHED_DEADLINE, &param);
@@ -82,9 +82,9 @@ static int ChildProcess(void)
ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
pid = fork();
if (pid == 0) {
@@ -96,14 +96,14 @@ static int ChildProcess(void)
} else if (pid > 0) {
printf("--- edf1 -- 1 -- Tid[%d] thread start ---\n\r", currTID);
do {
for (volatile int i = 0; i < 500000; i++) { /* 500000, no special meaning */
for (volatile int i = 0; i < 50000; i++) { /* 50000, no special meaning */
int tmp = i + 1;
}
if (count % 20 == 0) { /* 20, no special meaning */
if (count % 5 == 0) { /* 5, no special meaning */
printf("--- edf1 -- 2 -- Tid[%d] thread running ---\n\r", currTID);
}
count++;
} while (count <= 100); /* 100, no special meaning */
} while (count <= 10); /* 10, no special meaning */
printf("--- edf1 -- 3 -- Tid[%d] thread end ---\n\r", currTID);
waitpid(pid, &status, 0);
} else {
@@ -46,9 +46,9 @@ static int ChildProcess(void)
struct sched_param currSchedParam = { 0 };
int currTID = Syscall(SYS_gettid, 0, 0, 0, 0);
struct sched_param param = {
.sched_deadline = 3000000, /* 3000000, 3s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = pthread_getschedparam(pthread_self(), &oldPolicy, &hpfparam);
@@ -60,9 +60,9 @@ static int ChildProcess(void)
ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
ret = pthread_attr_init(&a);
pthread_attr_setschedpolicy(&a, SCHED_RR);
@@ -45,9 +45,9 @@ static int ChildProcess(void)
volatile unsigned int count = 0;
int currTID = Syscall(SYS_gettid, 0, 0, 0, 0);
struct sched_param param = {
.sched_deadline = 3000000, /* 3000000, 3s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, &hpfparam);
@@ -49,9 +49,9 @@ static int ChildProcess(void)
struct sched_param currSchedParam = { 0 };
int currTID = Syscall(SYS_gettid, 0, 0, 0, 0);
struct sched_param param = {
.sched_deadline = 3000000, /* 3000000, 3s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, &hpfparam);
@@ -36,9 +36,9 @@ static int ChildProcess(void)
volatile unsigned int count = 0;
struct sched_param currSchedParam = { 0 };
struct sched_param param = {
.sched_deadline = 4000000, /* 4000000, 4s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = sched_getparam(getpid(), &currSchedParam);
@@ -59,22 +59,22 @@ static int ChildProcess(void)
ret = sched_getparam(getpid(), &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
printf("--- 1 edf thread start ---\n\r");
do {
for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */
for (volatile int j = 0; j < 10; j++) { /* 10, no special meaning */
for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */
for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */
int tmp = i - j;
}
}
if (count % 20 == 0) { /* 20, no special meaning */
if (count % 3 == 0) { /* 3, no special meaning */
printf("--- 2 edf thread running ---\n\r");
}
count++;
} while (count <= 100); /* 100, no special meaning */
} while (count <= 6); /* 6, no special meaning */
printf("--- 3 edf thread end ---\n\r");
return 0;
@@ -36,9 +36,9 @@ static int ChildProcess(void)
volatile unsigned int count = 0;
struct sched_param currSchedParam = { 0 };
struct sched_param param = {
.sched_deadline = 4000000, /* 4000000, 4s */
.sched_runtime = 200000, /* 200000, 200ms */
.sched_period = 5000000, /* 5000000, 5s */
.sched_deadline = 1000000, /* 1000000, 1s */
.sched_runtime = 20000, /* 20000, 20ms */
.sched_period = 1000000, /* 1000000, 1s */
};
ret = sched_getparam(getpid(), &currSchedParam);
@@ -59,9 +59,9 @@ static int ChildProcess(void)
ret = sched_getparam(getpid(), &currSchedParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */
ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */
return 0;
}