Compare commits

...

16 Commits

Author SHA1 Message Date
openharmony_ci
0bc453c2cd !1169 修复swtmr遍历不全导致的用例问题
Merge pull request !1169 from wangchen/0726_a
2023-07-26 02:39:24 +00:00
wangchen
73bcf0ec9a Fix: 修复swtmr只在当前核遍历链表的问题
Close #I7NZDT
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-07-26 09:35:58 +08:00
openharmony_ci
49bfc90a63 !1167 容器代码container目录位置变更
Merge pull request !1167 from zwx1232718/master
2023-06-09 09:21:56 +00:00
zwx1232718
b0708886fa container dir change
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-06-09 16:29:23 +08:00
openharmony_ci
a388a3f565 !1148 修复一些typo错误
Merge pull request !1148 from 景涛/master
2023-06-06 13:36:01 +00:00
openharmony_ci
280769ae42 !1163 GN脚本规范化
Merge pull request !1163 from zhushengle/GN
2023-05-23 08:43:40 +00:00
zhushengle
1f3a6c8143 feat: GN脚本规范化
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I80b055091a0ff333a859cd35447a851296a67103
2023-05-23 15:56:45 +08:00
openharmony_ci
6c0b0dde23 !1157 test:调整TDD测试用例
Merge pull request !1157 from zhangdengyu/fixTest0424
2023-05-18 12:14:47 +00:00
zhangdengyu
76228c3617 test: TDD用例调整
方案描述:
1、门禁流水线跑单个测试用例.bin文件有时间限制,将用时过长的bin按类型拆分;
2、缩短EDF测试用例的时间;
3、dynload用例改变当前工作路径未恢复导致执行结果的xml文件未生成,在用例结束退出之前恢复当前工作路径。

Close:#I6YIX6

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I8c6118f9589e8801000ccb0cae9b81e0925696f4
2023-05-18 15:46:12 +08:00
openharmony_ci
5de241eb2a !1160 部件化整改
Merge pull request !1160 from zhushengle/deps
2023-05-09 14:55:31 +00:00
zhushengle
5e68558280 feat: 部件化整改
Close #I71QQ2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6f4db7c3775907df06b7186310628fcdee71bdb6
2023-05-09 21:40:00 +08:00
openharmony_ci
9c71de6a2e !1158 Fix : 部件化需求整改
Merge pull request !1158 from yinjiaming/bundle
2023-05-05 08:33:35 +00:00
openharmony_ci
243b1e26a4 !1159 test:修复llvm升级导致tdd用例部分失败问题
Merge pull request !1159 from zhangdengyu/fixLlvmBug0428
2023-05-05 05:14:54 +00:00
yinjiaming
47a4fe030b fix:部件需求整改
修复了脚本扫描出的bundle.json的问题,整改了
不符合规范的路径引用

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I11c321f8707d3e44dd7ee40dac35cf99907fb864
2023-05-04 11:32:59 +08:00
zhangdengyu
577d29aaba test: 修复llvm升级导致tdd用例部分失败问题
方案描述:
1、llvm升级之后对while(1)死循环和给空指针赋值的场景有错误优化的情况;
   用例中在相关函数之前添加__attribute__((optnone))禁止编译器进行错误优化。

Close:#I6V2LN

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ic7150909c12a599aeeb0a55b983dfad7a0631cdc
2023-05-04 09:42:38 +08:00
”景涛“
24aa6858ee fix some typo errors
Signed-off-by: ”景涛“ <jingtao3@hust.edu.cn>
2023-04-15 22:16:32 +08:00
113 changed files with 1169 additions and 542 deletions

View File

@@ -299,7 +299,7 @@ config("public") {
configs += [
"$HDFTOPDIR:public",
"//drivers/liteos:public",
"$DRIVERS_LITEOS_DIR:public",
]
if (HAVE_DEVICE_SDK) {
@@ -324,8 +324,8 @@ group("modules") {
]
deps += [
"//drivers/liteos",
HDFTOPDIR,
"$DRIVERS_LITEOS_DIR",
"$HDFTOPDIR",
]
if (HAVE_DEVICE_SDK) {
@@ -351,7 +351,7 @@ group("liteos_a") {
deps += [
":apps",
":tests",
"//third_party/musl/scripts/build_lite:strip",
"$THIRDPARTY_MUSL_DIR/scripts/build_lite:strip",
]
if (liteos_skip_make == false) {
deps += [ ":make" ]

View File

@@ -73,5 +73,5 @@ executable("sample_usr_lms") {
"-Wl,--wrap=strcpy",
"-Wl,--wrap=strcat",
]
deps = [ "//kernel/liteos_a/kernel/extended/lms/usr:usrlmslib" ]
deps = [ "$LITEOSTOPDIR/kernel/extended/lms/usr:usrlmslib" ]
}

View File

@@ -29,7 +29,7 @@
import("//build/lite/config/component/lite_component.gni")
import("//kernel/liteos_a/liteos.gni")
import("//third_party/mksh/mksh.gni")
import("$THIRDPARTY_MKSH_DIR/mksh.gni")
group("mksh") {
deps = [ ":build_mksh" ]
@@ -42,7 +42,7 @@ copy("copy_mksh_src") {
build_ext_component("build_mksh") {
deps = [ ":copy_mksh_src" ]
deps += [ "//third_party/musl:sysroot_lite" ]
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/mksh_build")
cflags = [

View File

@@ -29,7 +29,7 @@
import("//build/lite/config/component/lite_component.gni")
import("//kernel/liteos_a/liteos.gni")
import("//third_party/toybox/toybox.gni")
import("$THIRDPARTY_TOYBOX_DIR/toybox.gni")
group("toybox") {
deps = [ ":build_toybox" ]
@@ -51,7 +51,7 @@ build_ext_component("build_toybox") {
":copy_toybox_config",
":copy_toybox_src",
]
deps += [ "//third_party/musl:sysroot_lite" ]
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/toybox_build")
cflags = [

View File

@@ -28,10 +28,10 @@
"name": "liteos_a",
"subsystem": "kernel",
"syscap": [
"SystemCapability.Kernel.liteos-a"
"SystemCapability.Kernel.Liteos-A"
],
"features": [],
"adated_system_type": [
"adapted_system_type": [
"small"
],
"rom": "1.5MB",

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_FS_VFS_BLOCK_DEVICE)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_DRIVERS_VIDEO)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/FatFs/FatFs.gni")
import("$THIRDPARTY_FATFS_DIR/FatFs.gni")
module_switch = defined(LOSCFG_FS_FAT)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -31,7 +31,7 @@ import("//kernel/liteos_a/liteos.gni")
module_switch = defined(LOSCFG_FS_JFFS)
module_name = get_path_info(rebase_path("."), "name")
linux_path = rebase_path("//kernel/linux/linux-5.10")
linux_path = rebase_path("$KERNEL_LINUX_DIR")
out_path = rebase_path(target_out_dir)
kernel_module(module_name) {

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_FS_NFS)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_FS_RAMFS)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_FS_ROMFS)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,17 +28,14 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_FS_VFS)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [
"$LITEOSTOPDIR/fs/vfs/epoll/fs_epoll.c",
"$LITEOSTOPDIR/fs/vfs/mount.c",
"$LITEOSTOPDIR/fs/vfs/path_cache.c",
"$LITEOSTOPDIR/fs/vfs/vnode.c",
"$LITEOSTOPDIR/fs/vfs/vnode_hash.c",
"epoll/fs_epoll.c",
"mount.c",
"operation/fullpath.c",
"operation/vfs_chattr.c",
"operation/vfs_check.c",
@@ -55,7 +52,10 @@ kernel_module(module_name) {
"operation/vfs_readv.c",
"operation/vfs_utime.c",
"operation/vfs_writev.c",
"path_cache.c",
"vfs_cmd/vfs_shellcmd.c",
"vnode.c",
"vnode_hash.c",
]
sources += NUTTX_FS_DIRENT_SRC_FILES
sources += NUTTX_FS_DRIVER_SRC_FILES

View File

@@ -67,51 +67,6 @@ config PAGE_TABLE_FINE_LOCK
help
This option will enable fine lock for page table.
######################### config options of container ####################
config KERNEL_CONTAINER
bool "Enable container Feature"
default n
depends on KERNEL_VM
config PID_CONTAINER
bool "Enable pid container Feature"
default n
depends on KERNEL_CONTAINER
config UTS_CONTAINER
bool "Enable uts container Feature"
default n
depends on KERNEL_CONTAINER
config MNT_CONTAINER
bool "Enable mnt container Feature"
default n
depends on KERNEL_CONTAINER
config CHROOT
bool "Enable chroot"
default n
depends on MNT_CONTAINER
config IPC_CONTAINER
bool "Enable ipc container Feature"
default n
depends on KERNEL_CONTAINER
config TIME_CONTAINER
bool "Enable time container"
default n
depends on KERNEL_CONTAINER
config USER_CONTAINER
bool "Enable user container"
default n
depends on KERNEL_CONTAINER
config NET_CONTAINER
bool "Enable net container"
default n
depends on KERNEL_CONTAINER
######################### config options of extended #####################
source "kernel/extended/Kconfig"

View File

@@ -32,15 +32,6 @@ import("//kernel/liteos_a/liteos.gni")
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [
"container/los_container.c",
"container/los_credentials.c",
"container/los_ipc_container.c",
"container/los_mnt_container.c",
"container/los_net_container.c",
"container/los_pid_container.c",
"container/los_time_container.c",
"container/los_user_container.c",
"container/los_uts_container.c",
"core/los_bitmap.c",
"core/los_info.c",
"core/los_process.c",

View File

@@ -39,7 +39,6 @@ LOCAL_SRCS := $(wildcard ipc/*.c) $(wildcard core/*.c) $(wildcard mem/membox/*.
$(wildcard mp/*.c) \
$(wildcard sched/*.c) \
$(wildcard vm/*.c) \
$(wildcard container/*.c)
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK) -Wno-frame-address

View File

@@ -583,7 +583,7 @@ STATIC INLINE BOOL SwtmrRunqueueFind(SortLinkAttribute *swtmrSortLink, SCHED_TL_
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
{
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[ArchCurrCpuid()].swtmrSortLink;
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[cpuid].swtmrSortLink;
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
return TRUE;
}

View File

@@ -32,6 +32,7 @@ import("//kernel/liteos_a/liteos.gni")
group("extended") {
deps = [
"blackbox",
"container",
"cppsupport",
"cpup",
"dynload",
@@ -52,6 +53,7 @@ group("extended") {
config("public") {
configs = [
"blackbox:public",
"container:public",
"cpup:public",
"dynload:public",
"hidumper:public",

View File

@@ -113,6 +113,54 @@ config KERNEL_HOOK
default n
depends on KERNEL_EXTKERNEL && DEBUG_VERSION
######################### config options of container ####################
config KERNEL_CONTAINER
bool "Enable container Feature"
default n
depends on KERNEL_VM
config PID_CONTAINER
bool "Enable pid container Feature"
default n
depends on KERNEL_CONTAINER
config UTS_CONTAINER
bool "Enable uts container Feature"
default n
depends on KERNEL_CONTAINER
config MNT_CONTAINER
bool "Enable mnt container Feature"
default n
depends on KERNEL_CONTAINER
config CHROOT
bool "Enable chroot"
default n
depends on MNT_CONTAINER
config IPC_CONTAINER
bool "Enable ipc container Feature"
default n
depends on KERNEL_CONTAINER
config TIME_CONTAINER
bool "Enable time container"
default n
depends on KERNEL_CONTAINER
config USER_CONTAINER
bool "Enable user container"
default n
depends on KERNEL_CONTAINER
config NET_CONTAINER
bool "Enable net container"
default n
depends on KERNEL_CONTAINER
######################### config options of trace #########################
source "kernel/extended/trace/Kconfig"

View File

@@ -0,0 +1,65 @@
# Copyright (c) 2023-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("//kernel/liteos_a/liteos.gni")
module_switch = defined(LOSCFG_KERNEL_CONTAINER)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [ "los_container.c" ]
if (defined(LOSCFG_IPC_CONTAINER)) {
sources += [ "los_ipc_container.c" ]
}
if (defined(LOSCFG_MNT_CONTAINER)) {
sources += [ "los_mnt_container.c" ]
}
if (defined(LOSCFG_NET_CONTAINER)) {
sources += [ "los_net_container.c" ]
}
if (defined(LOSCFG_PID_CONTAINER)) {
sources += [ "los_pid_container.c" ]
}
if (defined(LOSCFG_TIME_CONTAINER)) {
sources += [ "los_time_container.c" ]
}
if (defined(LOSCFG_USER_CONTAINER)) {
sources += [
"los_credentials.c",
"los_user_container.c",
]
}
if (defined(LOSCFG_UTS_CONTAINER)) {
sources += [ "los_uts_container.c" ]
}
public_configs = [ ":public" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,63 @@
# Copyright (c) 2023-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.
include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard *.c)
ifneq ($(LOSCFG_IPC_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_ipc_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_MNT_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_mnt_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_NET_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_net_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_PID_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_pid_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_TIME_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_time_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_USER_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_credentials.c los_user_container.c, $(LOCAL_SRCS))
endif
ifneq ($(LOSCFG_UTS_CONTAINER), y)
LOCAL_SRCS += $(filter-out los_uts_container.c, $(LOCAL_SRCS))
endif
include $(MODULE)

View File

@@ -33,7 +33,7 @@ module_switch = defined(LOSCFG_BASE_CORE_HILOG)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [
"//base/hiviewdfx/hilog_lite/frameworks/featured/hiview_log.c",
"$HIVIEWDFX_HILOG_LITE_DIR/frameworks/featured/hiview_log.c",
"los_hilog.c",
]
@@ -42,8 +42,8 @@ kernel_module(module_name) {
config("public") {
include_dirs = [
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog",
"$HIVIEWDFX_HILOG_LITE_DIR/interfaces/native/kits",
"$HIVIEWDFX_HILOG_LITE_DIR/interfaces/native/kits/hilog",
".",
]
}

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/NuttX/NuttX.gni")
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
module_switch = defined(LOSCFG_KERNEL_PIPE)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,11 +28,8 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
MUSLDIR = "$LITEOSTHIRDPARTY/musl"
import("//third_party/optimized-routines/optimized-routines.gni")
import("$MUSLDIR/porting/liteos_a/kernel/musl.gni")
import("$THIRDPARTY_MUSL_DIR/porting/liteos_a/kernel/musl.gni")
import("$THIRDPARTY_OPTIMIZED_ROUTINES_DIR/optimized-routines.gni")
module_switch = defined(LOSCFG_LIBC_MUSL)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -27,7 +27,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/musl/porting/liteos_a_newlib/kernel/newlib.gni")
import("$THIRDPARTY_MUSL_DIR/porting/liteos_a_newlib/kernel/newlib.gni")
module_switch = defined(LOSCFG_LIBC_NEWLIB)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/FreeBSD/FreeBSD.gni")
import("$THIRDPARTY_FREEBSD_DIR/FreeBSD.gni")
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
import("//third_party/bounds_checking_function/libsec_src.gni")
import("$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR/libsec_src.gni")
module_switch = defined(LOSCFG_LIB_LIBC)
module_name = get_path_info(rebase_path("."), "name")

View File

@@ -32,6 +32,19 @@ import("$root_out_dir/config.gni")
LITEOSTOPDIR = "//kernel/liteos_a"
LITEOSTHIRDPARTY = "//third_party"
HDFTOPDIR = "//drivers/hdf_core/adapter/khdf/liteos"
HIVIEWDFX_HILOG_LITE_DIR = "//base/hiviewdfx/hilog_lite"
DRIVERS_LITEOS_DIR = "//drivers/liteos"
THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR =
"//third_party/bounds_checking_function"
THIRDPARTY_FATFS_DIR = "//third_party/FatFs"
THIRDPARTY_NUTTX_DIR = "//third_party/NuttX"
THIRDPARTY_MUSL_DIR = "//third_party/musl"
THIRDPARTY_TOYBOX_DIR = "//third_party/toybox"
THIRDPARTY_MKSH_DIR = "//third_party/mksh"
THIRDPARTY_FREEBSD_DIR = "//third_party/FreeBSD"
THIRDPARTY_OPTIMIZED_ROUTINES_DIR = "//third_party/optimized-routines"
THIRDPARTY_GOOGLETEST_DIR = "//third_party/googletest"
KERNEL_LINUX_DIR = "//kernel/linux/linux-5.10"
ARCH = ""
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
@@ -135,8 +148,8 @@ set_defaults("kernel_module") {
"$LITEOSTOPDIR:los_config",
]
visibility = [
"$LITEOSTOPDIR:*",
":*",
"$LITEOSTOPDIR:*",
"..:*",
"../..:*",
]

View File

@@ -39,21 +39,21 @@ declare_args() {
config("liteos_kernel_test_public") {
cflags = [ "-Wno-error" ]
include_dirs = [
"//kernel/liteos_a/kernel/include",
"//kernel/liteos_a/kernel/base/include",
"//kernel/liteos_a/kernel/common",
"//kernel/liteos_a/arch/arm/arm/include",
"//kernel/liteos_a/arch/arm/include",
"//kernel/liteos_a/extended/include",
"//third_party/musl/porting/liteos_a/kernel/include",
"//third_party/bounds_checking_function/include/",
"//kernel/liteos_a/lib/libscrew/include",
"//kernel/liteos_a/fs/vfs",
"//kernel/liteos_a/fs/proc/include",
"//kernel/liteos_a/fs/jffs2/include",
"//kernel/liteos_a/fs/nfs/include",
"//kernel/liteos_a/bsd/compat/linuxkpi/include",
"//kernel/liteos_a/testsuites/kernel/include",
"$LITEOSTOPDIR/kernel/include",
"$LITEOSTOPDIR/kernel/base/include",
"$LITEOSTOPDIR/kernel/common",
"$LITEOSTOPDIR/arch/arm/arm/include",
"$LITEOSTOPDIR/arch/arm/include",
"$LITEOSTOPDIR/extended/include",
"$THIRDPARTY_MUSL_DIR/porting/liteos_a/kernel/include",
"$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR/include/",
"$LITEOSTOPDIR/lib/libscrew/include",
"$LITEOSTOPDIR/fs/vfs",
"$LITEOSTOPDIR/fs/proc/include",
"$LITEOSTOPDIR/fs/jffs2/include",
"$LITEOSTOPDIR/fs/nfs/include",
"$LITEOSTOPDIR/bsd/compat/linuxkpi/include",
"include",
]
if (LOSCFG_TEST_KERNEL_BASE) {

View File

@@ -260,5 +260,5 @@ kernel_module("test_core") {
]
public_configs =
[ "//kernel/liteos_a/testsuites/kernel:liteos_kernel_test_public" ]
[ "$LITEOSTOPDIR/testsuites/kernel:liteos_kernel_test_public" ]
}

View File

@@ -107,5 +107,5 @@ kernel_module("test_ipc") {
]
public_configs =
[ "//kernel/liteos_a/testsuites/kernel:liteos_kernel_test_public" ]
[ "$LITEOSTOPDIR/testsuites/kernel:liteos_kernel_test_public" ]
}

View File

@@ -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" ]
}

View File

@@ -26,8 +26,6 @@
# 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) {
@@ -40,7 +38,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources_full = []
sources += sources_full
configs = [ "..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -53,6 +51,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
sources += sources_smoke
sources += sources_full
configs = [ "..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
]

View File

@@ -1,6 +1,6 @@
/*
* 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)

View File

@@ -30,7 +30,7 @@
*/
#include "it_test_exc.h"
static int TestCase(void)
__attribute__((optnone)) static int TestCase(void)
{
int ret;
int status = 0;

View File

@@ -31,7 +31,7 @@
#include "it_test_exc.h"
#include "pthread.h"
static void *ThreadFunc2(void *arg)
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
{
while (1) {
}
@@ -39,7 +39,7 @@ static void *ThreadFunc2(void *arg)
return nullptr;
}
static void *ThreadFunc1(void *arg)
__attribute__((optnone)) static void *ThreadFunc1(void *arg)
{
int *test = nullptr;
*test = 0x1;
@@ -77,7 +77,8 @@ static int TestThread(void)
return 0;
}
static int TestCase(void)
__attribute__((optnone)) static int TestCase(void)
{
int *test = nullptr;
int count = 5;

View File

@@ -34,14 +34,15 @@
#define TEST_THREAD_COUNT 5
static volatile int g_testCondFlag;
static int g_count[TEST_THREAD_COUNT];
static void *ThreadFunc2(void *arg)
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
{
int count = *(int *)arg;
int *test = nullptr;
g_testCondFlag++;
while (g_testCondFlag < 2) {
while (g_testCondFlag < 2) { /* 2, no special meaning */
}
*test = 0x1;
@@ -83,7 +84,7 @@ static int TestThread(void)
return 0;
}
static int TestCase(void)
__attribute__((optnone)) static int TestCase(void)
{
int *test = nullptr;
int count = 5;

View File

@@ -33,7 +33,7 @@
#define TEST_THREAD_COUNT 5
static int TestThread(void)
__attribute__((optnone)) static int TestThread(void)
{
int ret;
int *test = nullptr; // For triggering an exceptioin
@@ -53,7 +53,7 @@ static int TestThread(void)
return 0;
}
static int TestCase(void)
__attribute__((optnone)) static int TestCase(void)
{
int count = 5;
int status = 0;

View File

@@ -30,7 +30,7 @@
*/
#include "it_test_exc.h"
static void Child(void)
__attribute__((optnone)) static void Child(void)
{
while (1) {
printf("@@@@@@@@@@@@@ pid : %d getppid : %d @@@@@@@@@@@@@@@@\n", getpid(), getppid());
@@ -41,7 +41,7 @@ static void TestKill(int sig)
exit(0);
}
static int TestCase(void)
__attribute__((optnone)) static int TestCase(void)
{
int ret;
void (*retptr)(int) = NULL;

View File

@@ -1,5 +1,5 @@
# 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

View File

@@ -26,8 +26,6 @@
# 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("container_config") {
@@ -69,7 +67,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
"..:public_config_for_door",
":container_config",
]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -85,6 +83,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
"..:public_config_for_all",
":container_config",
]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -26,10 +26,12 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
"$TEST_UNITTEST_DIR/container",
]

View File

@@ -26,8 +26,6 @@
# 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) {
@@ -40,7 +38,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources_full = []
sources += sources_full
configs = [ "..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -53,6 +51,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
sources += sources_smoke
sources += sources_full
configs = [ "..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
]

View File

@@ -26,8 +26,6 @@
# 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) {
@@ -40,7 +38,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources_full = []
sources += sources_full
configs = [ "..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -53,6 +51,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
sources += sources_smoke
sources += sources_full
configs = [ "..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
]

View File

@@ -53,7 +53,7 @@ static UINT32 Testcase(VOID)
ret = write(pipeFd[1], "hello world", 12); // 12, "hello world" length and '\0'
printf("write first status: %d\n", ret);
if (ret != 12) { // 12, "hello world" length and '\0'
exit(11); // 11, the value of son process unexpect exit, convenient to debug
exit(11); // 11, the value of son process unexpected exit, convenient to debug
}
*sharedflag = 1;
close(pipeFd[1]);

View File

@@ -55,7 +55,7 @@ static UINT32 Testcase(VOID)
ret = write(pipeFd[1], "Hello world", TAR_STR_LEN);
printf("write first status: %d\n", ret);
if (ret != TAR_STR_LEN) {
exit(11); // 11, the value of son process unexpect exit, convenient to debug
exit(11); // 11, the value of son process unexpected exit, convenient to debug
}
*sharedflag = 1;
close(pipeFd[1]);

View File

@@ -69,7 +69,7 @@ static UINT32 Testcase(VOID)
ret = sigaction(SIGCHLD, &oldact, NULL);
if (ret == -1) {
exit(6); // 6, the value of son process unexpect exit, convenient to debug
exit(6); // 6, the value of son process unexpected exit, convenient to debug
}
sleep(1);
printf("---son--cnt check----%d--------\n", g_actionCnt1);

View File

@@ -90,31 +90,31 @@ static int TestCase(void)
printf("errline = %d\n", __LINE__);
exit(-1);
}
ret = kill(10, 31); // 10, kill process pid; 31, sigal.
ret = kill(10, 31); // 10, kill process pid; 31, signal.
if (retValue != -1 || errno != EINVAL) {
printf("errline = %d\n", __LINE__);
exit(-1);
}
ret = kill(10, 32); // 10, kill process pid; 32, sigal.
ret = kill(10, 32); // 10, kill process pid; 32, signal.
if (retValue != -1 || errno != EINVAL) {
printf("errline = %d\n", __LINE__);
exit(-1);
}
ret = kill(2, 32); // 2, kill process pid; 32, sigal.
ret = kill(2, 32); // 2, kill process pid; 32, signal.
if (retValue != -1 || errno != EINVAL) {
printf("errline = %d\n", __LINE__);
exit(-1);
}
printf("test EPERM begin\n");
ret = kill(2, 5); // 2, kill process pid; 5, sigal.
ret = kill(2, 5); // 2, kill process pid; 5, signal.
if (retValue != -1 || errno != EPERM) {
printf("errline = %d\n", __LINE__);
exit(-1);
}
ret = kill(3, 5); // 3, kill process pid; 5, sigal.
ret = kill(3, 5); // 3, kill process pid; 5, signal.
if (retValue != -1 || errno != EPERM) {
printf("errline = %d\n", __LINE__);
exit(-1);
@@ -126,7 +126,7 @@ static int TestCase(void)
exit(-1);
}
ret = kill(1, 5); // 5, kill sigal num .
ret = kill(1, 5); // 5, kill signal num .
if (retValue != -1 || errno != EPERM) {
printf("errline = %d\n", __LINE__);
exit(-1);

View File

@@ -40,7 +40,7 @@ static void SigChildResponse(int signo)
wait(nullptr);
}
/* Register SIGCHLD, through signal to restore the child memery */
/* Register SIGCHLD, through signal to restore the child memory */
static int TestSigKillResp()
{
void (*ret)(int) = nullptr;

View File

@@ -38,7 +38,7 @@ void SigChildResponse(int signo)
wait(nullptr);
}
/* Register SIGCHLD, through signal to restore the child memery */
/* Register SIGCHLD, through signal to restore the child memory */
static int TestSigKillWaitFromSigChild()
{
void (*ret)(int);

View File

@@ -88,7 +88,7 @@ static int TestBlock()
printf("\n\n");
printf("Signal Pause(2)\n");
printf("To test whether pause can relese the signal\n");
printf("To test whether pause can release the signal\n");
alarm(clock);
retValue = sighold(sig);
if (retValue != 0) {

View File

@@ -67,7 +67,7 @@ static UINT32 TestCase()
sigemptyset(&set);
sigprocmask(SIG_SETMASK, &set, NULL);
printf("check invlid sigset ...\n");
printf("check invalid sigset ...\n");
int rt = sigaddset(&set, 0);
ICUNIT_ASSERT_EQUAL(rt, -1, rt);
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
@@ -79,19 +79,19 @@ static UINT32 TestCase()
siginfo_t si;
time1.tv_sec = -1;
printf("check invlid timespec: tv_sec=-1 ...\n");
printf("check invalid timespec: tv_sec=-1 ...\n");
ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
time1.tv_sec = 1;
time1.tv_nsec = -1;
printf("check invlid timespec: tv_nsec=-1 ...\n");
printf("check invalid timespec: tv_nsec=-1 ...\n");
ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
time1.tv_sec = 1;
time1.tv_nsec = 1000 * 1000 * 1000 + 1; // 1000, set the nsec of time.
printf("check invlid timespec: tv_nsec overflow ...\n");
printf("check invalid timespec: tv_nsec overflow ...\n");
ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);

View File

@@ -27,8 +27,6 @@
# 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) {
@@ -43,7 +41,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources_pressure = []
sources += sources_pressure
configs = [ "..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -58,7 +56,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
sources_pressure = []
sources += sources_pressure
configs = [ "..:public_config_for_all" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -74,6 +72,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) {
sources += sources_full
sources += sources_pressure
configs = [ "..:public_config_for_pressure" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
]

View File

@@ -1,121 +0,0 @@
# Copyright (c) 2022-2022 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")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
]
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
}
# 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
}
# 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
}

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,20 +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")
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,22 +45,22 @@ 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" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,20 +26,33 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
io_include_dirs = [ "$TEST_UNITTEST_DIR/libc/io" ]
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../../common/include",
]
io_sources_entry = [ "$TEST_UNITTEST_DIR/libc/io/io_test.cpp" ]
sources_entry = [ "../../common/osTest.cpp" ]
io_sources_smoke = [
sources_smoke = []
sources_full = []
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 +95,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
}

View File

@@ -0,0 +1,66 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,13 +26,26 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
misc_include_dirs = [ "$TEST_UNITTEST_DIR/libc/misc" ]
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../../common/include",
]
misc_sources_entry = [ "$TEST_UNITTEST_DIR/libc/misc/misc_test.cpp" ]
sources_entry = [ "../../common/osTest.cpp" ]
misc_sources_smoke = [
sources_smoke = []
sources_full = []
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 +54,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 +64,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
}

View File

@@ -0,0 +1,66 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -0,0 +1,69 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../../common/include",
]
sources_entry = [ "../../common/osTest.cpp" ]
sources_smoke = []
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
}
# 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
}
# 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
}

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,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 = []

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")
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",

View File

@@ -30,7 +30,7 @@
*/
#include "It_posix_queue.h"
static VOID *PthreadF01(VOID *argument)
__attribute__((optnone)) static VOID *PthreadF01(VOID *argument)
{
INT32 i;
INT32 ret;
@@ -54,7 +54,7 @@ EXIT:
return NULL;
}
static VOID *PthreadF02(VOID *argument)
__attribute__((optnone)) static VOID *PthreadF02(VOID *argument)
{
INT32 j, ret;
@@ -79,7 +79,7 @@ EXIT:
return NULL;
}
static UINT32 Testcase(VOID)
__attribute__((optnone)) static UINT32 Testcase(VOID)
{
pthread_t newTh1, newTh2;
UINT32 ret;

View File

@@ -53,7 +53,6 @@ EXIT:
static UINT32 Testcase(VOID)
{
INT32 ret;
UINT32 uret;
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
pthread_t pthread1;
@@ -92,7 +91,6 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2);
usleep(0);
ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2);
ret = pthread_join(pthread1, NULL);
ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2);

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")
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",

View File

@@ -0,0 +1,66 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,13 +26,26 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
sys_include_dirs = [ "$TEST_UNITTEST_DIR/libc/sys" ]
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../../common/include",
]
sys_sources_entry = [ "$TEST_UNITTEST_DIR/libc/sys/sys_unit_test.cpp" ]
sources_entry = [ "../../common/osTest.cpp" ]
sys_sources_smoke = [
sources_smoke = []
sources_full = []
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 +64,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 +78,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
}

View File

@@ -0,0 +1,66 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,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",

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:
@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../../common/include",
]
@@ -40,19 +41,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
}

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")
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 = []

View File

@@ -0,0 +1,66 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,16 +26,29 @@
# 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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
util_include_dirs = [
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/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 +60,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
}

View File

@@ -26,8 +26,6 @@
# 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("net_config") {
@@ -55,7 +53,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources += sources_full
configs = [ "..:public_config_for_door" ]
configs += [ ":net_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}
@@ -69,6 +67,6 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
sources += sources_full
configs = [ "..:public_config_for_all" ]
configs += [ ":net_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR:libsec_shared" ]
}
}

View File

@@ -27,10 +27,11 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("//kernel/liteos_a/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
common_include_dirs = [
"//third_party/googletest/googletest/include",
"$THIRDPARTY_GOOGLETEST_DIR/googletest/include",
"../common/include",
]

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,12 +26,10 @@
# 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_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 +37,20 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
sources += sources_smoke
sources_full = []
sources += sources_full
configs = [ "../..:public_config_for_door" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "../../..:public_config_for_door" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "../../..:public_config_for_all" ]
deps = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
process_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/process" ]
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/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 +95,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 +126,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

@@ -32,19 +32,19 @@
static const int TEST_COUNT = 10;
static void *ThreadFunc2(void *arg)
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
{
printf("111111111111111: exit\n");
exit(254); // 254, exit args
}
static void *ThreadFunc3(void *arg)
__attribute__((optnone)) static void *ThreadFunc3(void *arg)
{
while (1) {
}
}
static int ProcessTest001(void)
__attribute__((optnone)) static int ProcessTest001(void)
{
int ret;
int status;
@@ -81,7 +81,7 @@ static int ProcessTest001(void)
return 0;
}
static int Testcase(void)
__attribute__((optnone)) static int Testcase(void)
{
int ret;
int status;

View File

@@ -0,0 +1,56 @@
# 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("./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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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 = [ "$THIRDPARTY_BOUNDS_CHECKING_FUNCTION_DIR: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,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/liteos.gni")
import("//kernel/liteos_a/testsuites/unittest/config.gni")
pthread_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/pthread" ]
common_include_dirs = [
"$THIRDPARTY_GOOGLETEST_DIR/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 +79,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

@@ -46,7 +46,7 @@ void child1(void)
while (1) {
ret = pthread_getschedparam(pthread, &newPolicy, &param);
if (ret != 0) {
printf("pthread_getschedparam failed ! %d erro: %d\n", __LINE__, errno);
printf("pthread_getschedparam failed ! %d error: %d\n", __LINE__, errno);
exit(255); // 255, set a special exit code.
}

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

Some files were not shown because too many files have changed in this diff Show More