未验证 提交 6c0b0dde 编写于 作者: O openharmony_ci 提交者: Gitee

!1157 test:调整TDD测试用例

Merge pull request !1157 from zhangdengyu/fixTest0424
......@@ -113,10 +113,24 @@ group("unittest") {
# libc test
if (LOSCFG_USER_TEST_LIBC == true) {
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
deps += [ "libc:liteos_a_libc_unittest_door" ]
deps += [
"libc/io:liteos_a_libc_io_unittest_door",
"libc/misc:liteos_a_libc_misc_unittest_door",
"libc/posix:liteos_a_libc_posix_unittest_door",
"libc/sys:liteos_a_libc_sys_unittest_door",
"libc/time:liteos_a_libc_time_unittest_door",
"libc/util:liteos_a_libc_util_unittest_door",
]
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
deps += [ "libc:liteos_a_libc_unittest" ]
deps += [
"libc/io:liteos_a_libc_io_unittest",
"libc/misc:liteos_a_libc_misc_unittest",
"libc/posix:liteos_a_libc_posix_unittest",
"libc/sys:liteos_a_libc_sys_unittest",
"libc/time:liteos_a_libc_time_unittest",
"libc/util:liteos_a_libc_util_unittest",
]
}
}
......@@ -133,8 +147,11 @@ group("unittest") {
# process test
if (LOSCFG_USER_TEST_PROCESS_THREAD == true) {
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
deps += [ "process/basic:liteos_a_process_basic_unittest_door" ]
deps += [ "process/lock:liteos_a_process_lock_unittest_door" ]
deps += [
"process/basic/process:liteos_a_process_basic_process_unittest_door",
"process/basic/pthread:liteos_a_process_basic_pthread_unittest_door",
"process/lock:liteos_a_process_lock_unittest_door",
]
if (LOSCFG_USER_TEST_PROCESS_FS == true) {
deps += [ "process/fs:liteos_a_process_fs_unittest_door" ]
}
......@@ -143,8 +160,11 @@ group("unittest") {
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
deps += [ "process/basic:liteos_a_process_basic_unittest" ]
deps += [ "process/lock:liteos_a_process_lock_unittest" ]
deps += [
"process/basic/process:liteos_a_process_basic_process_unittest",
"process/basic/pthread:liteos_a_process_basic_pthread_unittest",
"process/lock:liteos_a_process_lock_unittest",
]
if (LOSCFG_USER_TEST_PROCESS_FS == true) {
deps += [ "process/fs:liteos_a_process_fs_unittest" ]
}
......
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-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:
......@@ -42,40 +42,52 @@ static int Testcase(void)
char *workingPath = "/usr/bin";
void *handle = nullptr;
int (*func)(int);
char curPath[1024] = { 0 }; /* 1024, buffer size */
handle = getcwd(curPath, sizeof(curPath));
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
ret = chdir(workingPath);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
handle = dlopen(NULL, RTLD_NOW | RTLD_LOCAL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */
ret = dlclose(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
handle = dlopen(LIBCSO_REAL_PATH, RTLD_NOW);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */
func = reinterpret_cast<int (*)(int)>(dlsym(handle, SYMBOL_TO_FIND));
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ICUNIT_GOTO_EQUAL(func, SYMBOL_TO_MATCH, func, EXIT);
ret = dlclose(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
handle = dlopen(LIBCSO_RELATIVE_PATH, RTLD_NOW);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */
func = reinterpret_cast<int (*)(int)>(dlsym(handle, SYMBOL_TO_FIND));
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = dlclose(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = chdir(curPath);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
return 0;
EXIT:
dlclose(handle);
return 0;
EXIT1:
ret = chdir(curPath);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return 1; /* 1, return value */
}
void ItTestDynload002(void)
......
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-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:
......@@ -64,11 +64,11 @@ LOSCFG_USER_TEST_MEM_VM = true
LOSCFG_USER_TEST_PROCESS_THREAD = true
# Module list
LOSCFG_USER_TEST_MUTEX = true
LOSCFG_USER_TEST_PROCESS = true
LOSCFG_USER_TEST_PTHREAD = true
LOSCFG_USER_TEST_RWLOCK = true
LOSCFG_USER_TEST_SPINLOCK = true
LOSCFG_USER_TEST_PROCESS_BASIC_PROCESS = true
LOSCFG_USER_TEST_PROCESS_BASIC_PTHREAD = true
LOSCFG_USER_TEST_PROCESS_LOCK_MUTEX = true
LOSCFG_USER_TEST_PROCESS_LOCK_RWLOCK = true
LOSCFG_USER_TEST_PROCESS_LOCK_SPINLOCK = true
########## extended test ##########
# Control switch for extended function test
......@@ -102,15 +102,15 @@ LOSCFG_USER_TEST_FS_VFAT = false
LOSCFG_USER_TEST_LIBC = true
# Module list
LOSCFG_USER_TEST_IO = true
LOSCFG_USER_TEST_MISC = true
LOSCFG_USER_TEST_POSIX_MEM = true
LOSCFG_USER_TEST_POSIX_MQUEUE = true
LOSCFG_USER_TEST_POSIX_PTHREAD = false
LOSCFG_USER_TEST_SYS = true
LOSCFG_USER_TEST_TIME_CLOCK = true
LOSCFG_USER_TEST_TIME_TIMER = true
LOSCFG_USER_TEST_UTIL = true
LOSCFG_USER_TEST_LIBC_IO = true
LOSCFG_USER_TEST_LIBC_MISC = true
LOSCFG_USER_TEST_LIBC_POSIX_MEM = true
LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE = true
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD = false
LOSCFG_USER_TEST_LIBC_SYS = true
LOSCFG_USER_TEST_LIBC_TIME_CLOCK = true
LOSCFG_USER_TEST_LIBC_TIME_TIMER = true
LOSCFG_USER_TEST_LIBC_UTIL = true
########## net test ##########
# Control switch for network function test
......
# 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,15 +31,15 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_POSIX_PTHREAD == true) {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_unittest_door") {
unittest("liteos_a_libc_io_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
......@@ -47,21 +47,21 @@ 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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_unittest") {
unittest("liteos_a_libc_io_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
......
# 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,20 +26,32 @@
# 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")
io_include_dirs = [ "$TEST_UNITTEST_DIR/libc/io" ]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
io_sources_entry = [ "$TEST_UNITTEST_DIR/libc/io/io_test.cpp" ]
sources_full = []
io_sources_smoke = [
libc_io_include_dirs = [ "$TEST_UNITTEST_DIR/libc/io" ]
libc_io_sources_entry = [ "$TEST_UNITTEST_DIR/libc/io/io_test.cpp" ]
libc_io_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_005.cpp",
"$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_008.cpp",
"$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_010.cpp",
"$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_013.cpp",
]
io_sources_full = [
libc_io_sources_full = [
"$TEST_UNITTEST_DIR/libc/io/full/IO_test_confstr_001.cpp",
"$TEST_UNITTEST_DIR/libc/io/full/IO_test_dcgettext_001.cpp",
"$TEST_UNITTEST_DIR/libc/io/full/IO_test_dcgettext_002.cpp",
......@@ -82,3 +94,11 @@ io_sources_full = [
"$TEST_UNITTEST_DIR/libc/io/full/IO_test_epoll_001.cpp",
"$TEST_UNITTEST_DIR/libc/io/full/IO_test_epoll_002.cpp",
]
# libc io module
if (LOSCFG_USER_TEST_LIBC_IO == true) {
common_include_dirs += libc_io_include_dirs
sources_entry += libc_io_sources_entry
sources_smoke += libc_io_sources_smoke
sources_full += libc_io_sources_full
}
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_misc_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_misc_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 += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
# 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,25 @@
# 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")
misc_include_dirs = [ "$TEST_UNITTEST_DIR/libc/misc" ]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
misc_sources_entry = [ "$TEST_UNITTEST_DIR/libc/misc/misc_test.cpp" ]
sources_full = []
misc_sources_smoke = [
libc_misc_include_dirs = [ "$TEST_UNITTEST_DIR/libc/misc" ]
libc_misc_sources_entry = [ "$TEST_UNITTEST_DIR/libc/misc/misc_test.cpp" ]
libc_misc_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_001.cpp",
"$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_002.cpp",
"$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_003.cpp",
......@@ -41,7 +53,7 @@ misc_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_014.cpp",
]
misc_sources_full = [
libc_misc_sources_full = [
"$TEST_UNITTEST_DIR/libc/misc/full/misc_test_006.cpp",
"$TEST_UNITTEST_DIR/libc/misc/full/misc_test_007.cpp",
"$TEST_UNITTEST_DIR/libc/misc/full/misc_test_008.cpp",
......@@ -51,3 +63,11 @@ misc_sources_full = [
"$TEST_UNITTEST_DIR/libc/misc/full/misc_test_012.cpp",
"$TEST_UNITTEST_DIR/libc/misc/full/misc_test_013.cpp",
]
# libc misc module
if (LOSCFG_USER_TEST_LIBC_MISC == true) {
common_include_dirs += libc_misc_include_dirs
sources_entry += libc_misc_sources_entry
sources_smoke += libc_misc_sources_smoke
sources_full += libc_misc_sources_full
}
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_posix_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_posix_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 += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
# 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:
......@@ -31,91 +31,38 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../../common/include",
]
sources_entry = [ "../common/osTest.cpp" ]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
sources_full = []
# io module
if (LOSCFG_USER_TEST_IO == true) {
import("./io/config.gni")
common_include_dirs += io_include_dirs
sources_entry += io_sources_entry
sources_smoke += io_sources_smoke
sources_full += io_sources_full
# libc posix mem module
if (LOSCFG_USER_TEST_LIBC_POSIX_MEM == true) {
import("./mem/config.gni")
common_include_dirs += libc_posix_mem_include_dirs
sources_entry += libc_posix_mem_sources_entry
sources_smoke += libc_posix_mem_sources_smoke
sources_full += libc_posix_mem_sources_full
}
# misc module
if (LOSCFG_USER_TEST_MISC == true) {
import("./misc/config.gni")
common_include_dirs += misc_include_dirs
sources_entry += misc_sources_entry
sources_smoke += misc_sources_smoke
sources_full += misc_sources_full
# libc posix mqueue module
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true) {
import("./mqueue/config.gni")
common_include_dirs += libc_posix_mqueue_include_dirs
sources_entry += libc_posix_mqueue_sources_entry
sources_smoke += libc_posix_mqueue_sources_smoke
sources_full += libc_posix_mqueue_sources_full
}
# posix mem module
if (LOSCFG_USER_TEST_POSIX_MEM == true) {
import("./posix/mem/config.gni")
common_include_dirs += posix_mem_include_dirs
sources_entry += posix_mem_sources_entry
sources_smoke += posix_mem_sources_smoke
sources_full += posix_mem_sources_full
}
# posix mqueue module
if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) {
import("./posix/mqueue/config.gni")
common_include_dirs += posix_mqueue_include_dirs
sources_entry += posix_mqueue_sources_entry
sources_smoke += posix_mqueue_sources_smoke
sources_full += posix_mqueue_sources_full
}
# posix pthread module
if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) {
import("./posix/pthread/config.gni")
common_include_dirs += posix_pthread_include_dirs
sources_entry += posix_pthread_sources_entry
sources_smoke += posix_pthread_sources_smoke
sources_full += posix_pthread_sources_full
}
# sys module
if (LOSCFG_USER_TEST_SYS == true) {
import("./sys/config.gni")
common_include_dirs += sys_include_dirs
sources_entry += sys_sources_entry
sources_smoke += sys_sources_smoke
sources_full += sys_sources_full
}
# time module
if (LOSCFG_USER_TEST_TIME_CLOCK == true) {
import("./time/clock/config.gni")
common_include_dirs += time_clock_include_dirs
sources_entry += time_clock_sources_entry
sources_smoke += time_clock_sources_smoke
sources_full += time_clock_sources_full
}
if (LOSCFG_USER_TEST_TIME_TIMER == true) {
import("./time/timer/config.gni")
common_include_dirs += time_timer_include_dirs
sources_entry += time_timer_sources_entry
sources_smoke += time_timer_sources_smoke
sources_full += time_timer_sources_full
}
# util module
if (LOSCFG_USER_TEST_UTIL == true) {
import("./util/config.gni")
common_include_dirs += util_include_dirs
sources_entry += util_sources_entry
sources_smoke += util_sources_smoke
sources_full += util_sources_full
# libc posix pthread module
if (LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
import("./pthread/config.gni")
common_include_dirs += libc_posix_pthread_include_dirs
sources_entry += libc_posix_pthread_sources_entry
sources_smoke += libc_posix_pthread_sources_smoke
sources_full += libc_posix_pthread_sources_full
}
# 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,16 +26,17 @@
# 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")
posix_mem_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mem" ]
libc_posix_mem_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mem" ]
posix_mem_sources_entry =
libc_posix_mem_sources_entry =
[ "$TEST_UNITTEST_DIR/libc/posix/mem/posix_mem_test.cpp" ]
posix_mem_sources_smoke = [
libc_posix_mem_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/posix/mem/smoke/It_posix_mem_001.cpp",
"$TEST_UNITTEST_DIR/libc/posix/mem/smoke/It_posix_mem_003.cpp",
]
posix_mem_sources_full = []
libc_posix_mem_sources_full = []
# 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")
posix_mqueue_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue" ]
libc_posix_mqueue_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue" ]
posix_mqueue_sources_entry =
libc_posix_mqueue_sources_entry =
[ "$TEST_UNITTEST_DIR/libc/posix/mqueue/posix_mqueue_test.cpp" ]
posix_mqueue_sources_smoke = [
libc_posix_mqueue_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_001.cpp",
"$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_003.cpp",
"$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_028.cpp",
......@@ -41,7 +42,7 @@ posix_mqueue_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_062.cpp",
]
posix_mqueue_sources_full = [
libc_posix_mqueue_sources_full = [
"$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_002.cpp",
"$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_005.cpp",
"$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_008.cpp",
......
# 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")
posix_pthread_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/pthread" ]
libc_posix_pthread_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/pthread" ]
posix_pthread_sources_entry =
libc_posix_pthread_sources_entry =
[ "$TEST_UNITTEST_DIR/libc/posix/pthread/posix_pthread_test.cpp" ]
posix_pthread_sources_smoke = [
libc_posix_pthread_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_003.cpp",
"$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_004.cpp",
"$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_005.cpp",
......@@ -45,7 +46,7 @@ posix_pthread_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_022.cpp",
]
posix_pthread_sources_full = [
libc_posix_pthread_sources_full = [
"$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_001.cpp",
"$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_002.cpp",
"$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_007.cpp",
......
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_sys_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_sys_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 += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
# 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,25 @@
# 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")
sys_include_dirs = [ "$TEST_UNITTEST_DIR/libc/sys" ]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
sys_sources_entry = [ "$TEST_UNITTEST_DIR/libc/sys/sys_unit_test.cpp" ]
sources_full = []
sys_sources_smoke = [
libc_sys_include_dirs = [ "$TEST_UNITTEST_DIR/libc/sys" ]
libc_sys_sources_entry = [ "$TEST_UNITTEST_DIR/libc/sys/sys_unit_test.cpp" ]
libc_sys_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_004.cpp",
"$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_005.cpp",
"$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_006.cpp",
......@@ -51,7 +63,7 @@ sys_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_031.cpp",
]
sys_sources_full = [
libc_sys_sources_full = [
"$TEST_UNITTEST_DIR/libc/sys/full/sys_test_001.cpp",
"$TEST_UNITTEST_DIR/libc/sys/full/sys_test_018.cpp",
"$TEST_UNITTEST_DIR/libc/sys/full/sys_test_019.cpp",
......@@ -65,3 +77,11 @@ sys_sources_full = [
"$TEST_UNITTEST_DIR/libc/sys/full/sys_test_027.cpp",
"$TEST_UNITTEST_DIR/libc/sys/full/sys_test_028.cpp",
]
# libc sys module
if (LOSCFG_USER_TEST_LIBC_SYS == true) {
common_include_dirs += libc_sys_include_dirs
sources_entry += libc_sys_sources_entry
sources_smoke += libc_sys_sources_smoke
sources_full += libc_sys_sources_full
}
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_time_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_time_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 += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
# 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")
time_clock_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/clock" ]
libc_time_clock_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/clock" ]
time_clock_sources_entry =
libc_time_clock_sources_entry =
[ "$TEST_UNITTEST_DIR/libc/time/clock/time_clock_test.cpp" ]
time_clock_sources_smoke =
libc_time_clock_sources_smoke =
[ "$TEST_UNITTEST_DIR/libc/time/clock/smoke/clock_test_smoke.cpp" ]
time_clock_sources_full = [
libc_time_clock_sources_full = [
"$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_001.cpp",
"$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_002.cpp",
"$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_003.cpp",
......
# 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,19 +40,20 @@ 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
# libc time clock module
if (LOSCFG_USER_TEST_LIBC_TIME_CLOCK == true) {
import("./clock/config.gni")
common_include_dirs += libc_time_clock_include_dirs
sources_entry += libc_time_clock_sources_entry
sources_smoke += libc_time_clock_sources_smoke
sources_full += libc_time_clock_sources_full
}
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
# libc time timer module
if (LOSCFG_USER_TEST_LIBC_TIME_TIMER == true) {
import("./timer/config.gni")
common_include_dirs += libc_time_timer_include_dirs
sources_entry += libc_time_timer_sources_entry
sources_smoke += libc_time_timer_sources_smoke
sources_full += libc_time_timer_sources_full
}
# 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")
time_timer_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/timer" ]
libc_time_timer_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/timer" ]
time_timer_sources_entry =
libc_time_timer_sources_entry =
[ "$TEST_UNITTEST_DIR/libc/time/timer/time_timer_test.cpp" ]
time_timer_sources_smoke = [
libc_time_timer_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_001.cpp",
"$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_002.cpp",
"$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_003.cpp",
......@@ -43,4 +44,4 @@ time_timer_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_tzset_002.cpp",
]
time_timer_sources_full = []
libc_time_timer_sources_full = []
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
config("libc_config") {
if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true ||
LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) {
cflags = [ "-O1" ]
cflags_cc = cflags
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
unittest("liteos_a_libc_util_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" ]
configs += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
unittest("liteos_a_libc_util_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 += [ ":libc_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
# 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,16 +26,28 @@
# 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")
util_include_dirs = [
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
sources_full = []
libc_util_include_dirs = [
"$TEST_UNITTEST_DIR/libc/util",
"$TEST_UNITTEST_DIR/libc/misc",
]
util_sources_entry = [ "$TEST_UNITTEST_DIR/libc/util/util_test.cpp" ]
libc_util_sources_entry = [ "$TEST_UNITTEST_DIR/libc/util/util_test.cpp" ]
util_sources_smoke = [
libc_util_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/util/smoke/it_test_util_100.cpp",
"$TEST_UNITTEST_DIR/libc/util/smoke/it_test_util_101.cpp",
"$TEST_UNITTEST_DIR/libc/util/smoke/util_test_001.cpp",
......@@ -47,4 +59,12 @@ util_sources_smoke = [
"$TEST_UNITTEST_DIR/libc/util/smoke/util_test_007.cpp",
]
util_sources_full = []
libc_util_sources_full = []
# libc util module
if (LOSCFG_USER_TEST_LIBC_UTIL == true) {
common_include_dirs += libc_util_include_dirs
sources_entry += libc_util_sources_entry
sources_smoke += libc_util_sources_smoke
sources_full += libc_util_sources_full
}
# 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" ]
}
}
# 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",
]
sources_entry = [ "../../../common/osTest.cpp" ]
sources_smoke = []
process_sources_entry =
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
}
# 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# 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")
import("./config.gni")
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_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" ]
}
}
# 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",
]
sources_entry = [ "../../../common/osTest.cpp" ]
sources_smoke = []
pthread_sources_entry =
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
}
......@@ -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;
}
......
# 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:
......
# 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
}
# 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",
......
# 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",
]
# 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 = []
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册