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

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -31,7 +31,7 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni")
import("./config.gni")
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_process_basic_unittest_door") {
unittest("liteos_a_process_basic_process_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
@@ -39,20 +39,20 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources += sources_smoke
sources_full = []
sources += sources_full
configs = [ "../..:public_config_for_door" ]
configs = [ "../../..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_process_basic_unittest") {
unittest("liteos_a_process_basic_process_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
sources += sources_smoke
sources += sources_full
configs = [ "../..:public_config_for_all" ]
configs = [ "../../..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -26,14 +26,27 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
process_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/process" ]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../../common/include",
]
process_sources_entry =
sources_entry = [ "../../../common/osTest.cpp" ]
sources_smoke = []
sources_full = []
process_basic_process_include_dirs =
[ "$TEST_UNITTEST_DIR/process/basic/process" ]
process_basic_process_sources_entry =
[ "$TEST_UNITTEST_DIR/process/basic/process/process_process_test.cpp" ]
process_sources_smoke = [
process_basic_process_sources_smoke = [
"$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_001.cpp",
"$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_002.cpp",
"$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_004.cpp",
@@ -81,7 +94,7 @@ process_sources_smoke = [
"$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_008.cpp",
]
process_sources_full = [
process_basic_process_sources_full = [
"$TEST_UNITTEST_DIR/process/basic/process/full/process_test_007.cpp",
"$TEST_UNITTEST_DIR/process/basic/process/full/process_test_031.cpp",
"$TEST_UNITTEST_DIR/process/basic/process/full/process_test_032.cpp",
@@ -112,3 +125,11 @@ process_sources_full = [
"$TEST_UNITTEST_DIR/process/basic/process/full/process_test_053.cpp",
"$TEST_UNITTEST_DIR/process/basic/process/full/process_test_062.cpp",
]
# process basic process module
if (LOSCFG_USER_TEST_PROCESS_BASIC_PROCESS == true) {
common_include_dirs += process_basic_process_include_dirs
sources_entry += process_basic_process_sources_entry
sources_smoke += process_basic_process_sources_smoke
sources_full += process_basic_process_sources_full
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -28,31 +28,31 @@
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
import("./config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
sources_full = []
# basic module
if (LOSCFG_USER_TEST_PROCESS == true) {
import("./process/config.gni")
common_include_dirs += process_include_dirs
sources_entry += process_sources_entry
sources_smoke += process_sources_smoke
sources_full += process_sources_full
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_process_basic_pthread_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
sources += sources_smoke
sources_full = []
sources += sources_full
configs = [ "../../..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_PTHREAD == true) {
import("./pthread/config.gni")
common_include_dirs += pthread_include_dirs
sources_entry += pthread_sources_entry
sources_smoke += pthread_sources_smoke
sources_full += pthread_sources_full
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_process_basic_pthread_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
sources += sources_smoke
sources += sources_full
configs = [ "../../..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -26,14 +26,27 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
pthread_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/pthread" ]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../../common/include",
]
pthread_sources_entry =
sources_entry = [ "../../../common/osTest.cpp" ]
sources_smoke = []
sources_full = []
process_basic_pthread_include_dirs =
[ "$TEST_UNITTEST_DIR/process/basic/pthread" ]
process_basic_pthread_sources_entry =
[ "$TEST_UNITTEST_DIR/process/basic/pthread/process_pthread_test.cpp" ]
pthread_sources_smoke = [
process_basic_pthread_sources_smoke = [
"$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_atfork_test_001.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_atfork_test_002.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_cond_test_001.cpp",
@@ -65,10 +78,18 @@ pthread_sources_smoke = [
"$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_027.cpp",
]
pthread_sources_full = [
process_basic_pthread_sources_full = [
"$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_001.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_002.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_004.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_005.cpp",
"$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_014.cpp",
]
# process basic pthread module
if (LOSCFG_USER_TEST_PROCESS_BASIC_PTHREAD == true) {
common_include_dirs += process_basic_pthread_include_dirs
sources_entry += process_basic_pthread_sources_entry
sources_smoke += process_basic_pthread_sources_smoke
sources_full += process_basic_pthread_sources_full
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -40,27 +40,29 @@ sources_smoke = []
sources_full = []
# lock module
if (LOSCFG_USER_TEST_MUTEX == true) {
# process lock mutex module
if (LOSCFG_USER_TEST_PROCESS_LOCK_MUTEX == true) {
import("./mutex/config.gni")
common_include_dirs += mutex_include_dirs
sources_entry += mutex_sources_entry
sources_smoke += mutex_sources_smoke
sources_full += mutex_sources_full
common_include_dirs += process_lock_mutex_include_dirs
sources_entry += process_lock_mutex_sources_entry
sources_smoke += process_lock_mutex_sources_smoke
sources_full += process_lock_mutex_sources_full
}
if (LOSCFG_USER_TEST_RWLOCK == true) {
# process lock rwlock module
if (LOSCFG_USER_TEST_PROCESS_LOCK_RWLOCK == true) {
import("./rwlock/config.gni")
common_include_dirs += rwlock_include_dirs
sources_entry += rwlock_sources_entry
sources_smoke += rwlock_sources_smoke
sources_full += rwlock_sources_full
common_include_dirs += process_lock_rwlock_include_dirs
sources_entry += process_lock_rwlock_sources_entry
sources_smoke += process_lock_rwlock_sources_smoke
sources_full += process_lock_rwlock_sources_full
}
if (LOSCFG_USER_TEST_SPINLOCK == true) {
# process lock spinlock module
if (LOSCFG_USER_TEST_PROCESS_LOCK_SPINLOCK == true) {
import("./spinlock/config.gni")
common_include_dirs += spinlock_include_dirs
sources_entry += spinlock_sources_entry
sources_smoke += spinlock_sources_smoke
sources_full += spinlock_sources_full
common_include_dirs += process_lock_spinlock_include_dirs
sources_entry += process_lock_spinlock_sources_entry
sources_smoke += process_lock_spinlock_sources_smoke
sources_full += process_lock_spinlock_sources_full
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -26,14 +26,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ]
process_lock_mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ]
mutex_sources_entry =
process_lock_mutex_sources_entry =
[ "$TEST_UNITTEST_DIR/process/lock/mutex/process_mutex_test.cpp" ]
mutex_sources_smoke = [
process_lock_mutex_sources_smoke = [
"$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_001.cpp",
"$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_002.cpp",
"$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_003.cpp",
@@ -57,7 +58,7 @@ mutex_sources_smoke = [
"$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_022.cpp",
]
mutex_sources_full = [
process_lock_mutex_sources_full = [
"$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_018.cpp",
"$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_023.cpp",
"$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_024.cpp",

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -26,17 +26,18 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/rwlock" ]
process_lock_rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/rwlock" ]
rwlock_sources_entry =
process_lock_rwlock_sources_entry =
[ "$TEST_UNITTEST_DIR/process/lock/rwlock/process_rwlock_test.cpp" ]
rwlock_sources_smoke = [
process_lock_rwlock_sources_smoke = [
"$TEST_UNITTEST_DIR/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp",
]
rwlock_sources_full = [
process_lock_rwlock_sources_full = [
"$TEST_UNITTEST_DIR/process/lock/rwlock/full/pthread_rwlock_test_002.cpp",
]

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -26,13 +26,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
spinlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/spinlock" ]
process_lock_spinlock_include_dirs =
[ "$TEST_UNITTEST_DIR/process/lock/spinlock" ]
spinlock_sources_entry =
process_lock_spinlock_sources_entry =
[ "$TEST_UNITTEST_DIR/process/lock/spinlock/process_spinlock_test.cpp" ]
spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp" ]
process_lock_spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp" ]
spinlock_sources_full = []
process_lock_spinlock_sources_full = []