add testsuites

Change-Id: Ice1193d1ae7f2e0d12a2a38a306a6399407f5037
This commit is contained in:
lnlan
2021-04-25 12:37:35 +08:00
parent dc90400456
commit 778c5e17c3
2720 changed files with 335022 additions and 0 deletions

142
testsuites/kernel/BUILD.gn Normal file
View File

@@ -0,0 +1,142 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 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/component/lite_component.gni")
static_library("test_base") {
sources = [
"src/ChipTest.c",
"src/iCunit.c",
"src/osTest.c",
"src/testrun_shellcmd.c",
"src/testusb_shellcmd.c",
]
include_dirs = [
"../kernel/base/includ",
"../kernel/include",
"../kernel/extended/include",
"include",
"../fs/vfs",
"../fs/proc/include",
"../fs/jffs2/include",
"../fs/nfs/include",
"../bsd/compat/linuxkpi/include",
]
}
lite_component("test") {
features = [ ":test_base" ]
# KERNEL BASE TEST
if (LOSCFG_TEST_KERNEL_BASE_IPC) {
features += [ "sample/kernel_base/ipc:test_ipc" ]
}
if (LOSCFG_TEST_KERNEL_BASE_CORE) {
features += [ "sample/kernel_base/core:test_core" ]
}
if (LOSCFG_TEST_KERNEL_BASE_MP) {
features += [ "sample/kernel_base/mp:test_mp" ]
}
if (LOSCFG_TEST_KERNEL_BASE_MEM) {
features += [ "sample/kernel_base/mem:test_mem" ]
}
if (LOSCFG_TEST_KERNEL_BASE_MISC) {
features += [ "sample/kernel_base/misc:test_misc" ]
}
if (LOSCFG_TEST_KERNEL_BASE_OM) {
features += [ "sample/kernel_base/om:test_om" ]
}
if (LOSCFG_TEST_KERNEL_BASE_ATOMIC) {
features += [ "sample/kernel_base/atomic:test_atomic" ]
}
# KERNEL EXTEND TEST
if (LOSCFG_TEST_KERNEL_EXTEND_CPP) {
features += [ "sample/kernel_extend/cpp:test_cpp" ]
}
if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) {
features += [ "sample/kernel_extend/cpup:test_cpup" ]
}
if (LOSCFG_TEST_KERNEL_EXTEND_MMU) {
features += [ "sample/kernel_extend/mmu:test_mmu" ]
}
# COMPAT TEST
if (LOSCFG_TEST_POSIX) {
features += [
"sample/posix:test_posix",
# "sample/posix/smp:test_posix_smp",
]
}
# if (LOSCFG_TEST_POSIX_MEM) {
# features += [ "sample/posix/mem:test_posix_mem" ]
# }
# if (LOSCFG_TEST_POSIX_MQUEUE) {
# features += [ "sample/posix/mqueue:test_posix_mqueue" ]
# }
# if (LOSCFG_TEST_POSIX_MUTEX) {
# features += [ "sample/posix/mutex:test_posix_mutex" ]
# }
# if (LOSCFG_TEST_POSIX_PTHREAD) {
# features += [ "sample/posix/pthread:test_posix_pthread" ]
# }
# if (LOSCFG_TEST_POSIX_SCHED) {
# features += [ "sample/posix/sched:test_posix_sched" ]
# }
# if (LOSCFG_TEST_POSIX_SEM) {
# features += [ "sample/posix/sem:test_posix_sem" ]
# }
# if (LOSCFG_TEST_POSIX_SWTMR) {
# features += [ "sample/posix/swtmr:test_posix_swtmr" ]
# }
if (LOSCFG_TEST_LINUX) {
features += [ "sample/linux:test_linux" ]
}
#if (LOSCFG_TEST_LINUX_HRTIMER) {
# features += [ "sample/linux/hrtimer:test_linux_hrtimer" ]
#}
# LIBC TEST
if (LOSCFG_TEST_LIBC) {
features += [ "sample/libc:test_libc" ]
}
# LIBM TEST
if (LOSCFG_TEST_LIBM) {
features += [ "sample/libm:test_libm" ]
}
# SHELL TEST
if (LOSCFG_TEST_SHELL) {
features += [ "sample/shell:test_shell" ]
}
}

426
testsuites/kernel/Kconfig Normal file
View File

@@ -0,0 +1,426 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 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.
config TEST_LEVEL
bool "Enable Test Level"
default y
depends on TEST
config TEST_SMOKE
bool "Enable Test smoke"
default y
depends on TEST && TEST_LEVEL
config TEST_FULL
bool "Enable Test full"
default y
depends on TEST && TEST_LEVEL
config TEST_PRESSURE
bool "Enable Test Pressure"
default n
depends on TEST && TEST_LEVEL
config TEST_LLT
bool "Enable Test LLT"
default n
depends on TEST && TEST_LEVEL
config TEST_MUTIL
bool "Enable Multi Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_KERNEL_BASE
bool "Enable Kernel Testsuit"
default y
depends on KERNEL_TEST && TEST
config TEST_KERNEL_BASE_IPC
bool "Enable IPC Testsuit"
default y
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_CORE
bool "Enable CORE Testsuit"
default y
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_MP
bool "Enable MP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST && KERNEL_SMP
config TEST_KERNEL_BASE_MEM
bool "Enable MEM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_VM
bool "Enable VM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_MISC
bool "Enable MISC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_OM
bool "Enable OM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_ATOMIC
bool "Enable ATOMIC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_EXTEND
bool "Enable Extended Kernel Testsuit"
default y
depends on KERNEL_TEST && TEST
config TEST_KERNEL_EXTEND_CPP
bool "Enable CPP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_CPUP
bool "Enable CPUP Testsuit"
default y
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_EXC
bool "Enable EXC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_UNALIGNACCESS
bool "Enable UNALIGNACCESS Testsuit"
default n
depends on KERNEL_TEST && DO_ALIGN && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_MMU
bool "Enable MMU Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_DYNLOAD
bool "Enable DYNLOAD Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_MPU
bool "Enable MPU Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_RUNSTOP
bool "Enable RUNSTOP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_RUNSTOP && TEST
config TEST_KERNEL_EXTEND_SCATTER
bool "Enable SCATTER Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_SCATTER && TEST
config TEST_KERNEL_EXTEND_TICKLESS
bool "Enable TICKLESS Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_TRACE
bool "Enable TRACE Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_POSIX
bool "Enable Posix Testsuit"
default y
depends on KERNEL_TEST && TEST
config TEST_POSIX_MEM
bool "Enable Mem Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_MQUEUE
bool "Enable Mqueue Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_MUTEX
bool "Enable Mutex Testsuit"
default y
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_PTHREAD
bool "Enable Pthread Testsuit"
default y
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SCHED
bool "Enable Sched Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SEM
bool "Enable Sem Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SWTMR
bool "Enable Swtmr Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_LINUX
bool "Enable Linux Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LINUX_HRTIMER
bool "Enable Hrtimer Testsuit"
default n
depends on KERNEL_TEST && TEST_LINUX && TEST
config TEST_FS
bool "Enable FS Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_FS_VFS
bool "Enable VFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_JFFS
bool "Enable JFFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_RAMFS
bool "Enable RAMFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_FAT
bool "Enable FAT Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_FAT_FAT32
bool "Enable FAT32 Test"
default n
depends on KERNEL_TEST && TEST_FS_FAT && TEST
config TEST_FAT32_FSCK
bool "Enable FAT32 Fsck Test"
default n
depends on KERNEL_TEST && TEST_FS_FAT && TEST
config TEST_FS_VIRPART
bool "Enable FAT virtual partition test"
default n
depends on KERNEL_TEST && FS_FAT_VIRTUAL_PARTITION && TEST_FS && TEST
config TEST_FS_PROC
bool "Enable PROC Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_NFS
bool "Enable NFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_MTD
bool "Enable MTD Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_MTD_JFFS
bool "Enable JFFS MTD Testsuit"
default n
depends on KERNEL_TEST && TEST_MTD && TEST
config TEST_MTD_FAT
bool "Enable FAT MTD Testsuit"
default n
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_MTD_DISK
bool "Enable FAT MTD DISK Test"
default n
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_MTD_FAT_VIRPART
bool "Enable FAT virtual partition MTD test"
default n
depends on KERNEL_TEST && TEST_MTD && FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_DRIVERBASE
bool "Enable DriverBase Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LIBC
bool "Enable LIBC Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LIBM
bool "Enable LIBM Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_SHELL
bool "Enable Shell Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_USB
bool "Enable Usb Manual Testsuit"
default n
depends on KERNEL_TEST && TEST && DRIVERS_USB
help
config TEST_HOST_MASS_DEVICE
bool "Enable Host Mass Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE && TEST
config TEST_HOST_UVC
bool "Enable Host UVC Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HOST_UVC && TEST
config TEST_DEVICE_MASS_GADGET
bool "Enable Device Mass Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE_GADGET && TEST
config TEST_UVC_GADGET
bool "Enable UVC Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UVC_GADGET && TEST
config TEST_UAC_GADGET
bool "Enable UAC Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UAC_GADGET && TEST
config TEST_CAMERA_GADGET
bool "Enable Camera Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_CAMERA_GADGET && TEST
config TEST_HUB_GADGET
bool "Enable HUB Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_SERIAL_GADGET
bool "Enable Serial Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_SERIAL_GADGET && TEST
config TEST_HID_GADGET
bool "Enable HID Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HID_GADGET && TEST
config TEST_ETHERNET_GADGET
bool "Enable Ethernet Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETHERNET_GADGET && TEST
config TEST_MULTI_GADGET
bool "Enable Ethernet & Serial Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETH_SER_GADGET && TEST
config TEST_DFU_GADGET
bool "Enable Drivers DFU Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_DFU_GADGET && TEST
config TEST_MUTILDEVICE_GADGET
bool "Enable Drivers Multidevices Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_SMP_USB
bool "Enable Usb SMP Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST && KERNEL_SMP
config TEST_HOST_ETH
bool "Enable Host Eth Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_AUTO_USB
bool "Enable Usb Auto Testsuit"
default n
depends on KERNEL_TEST && TEST && DRIVERS_USB
config TEST_MMC
bool "Enable MMC Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST
config TEST_SD
bool "Enable SD Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
config TEST_SDIO
bool "Enable SDIO Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
comment "Only one platform can be selected"
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
config TEST_SDIO_1131S
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
bool "1131s"
config TEST_SDIO_RTL8189
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
bool "RTL8189"
config TEST_PERFORMANCE
bool "Enable Performance Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_PERFORMANCE_CORE
bool "Enable Performance CORE Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_MEM
bool "Enable Performance MEM Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_FS
bool "Enable Performance FS Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_USB
bool "Enable Performance USB Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_NET
bool "Enable Performance NET Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_NET
bool "Enable NET Test"
default n
depends on KERNEL_TEST && TEST
help
Attention: if this option turns on, other test suits will be ignored.
config TEST_LWIP
bool "Enable LWIP Testsuit"
default n
depends on KERNEL_TEST && TEST_NET && TEST
config AR6K3_WIFI_TEST
bool "Enable AR6K3_WIFI Test"
default n
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_QRD
help
Attention: if this option turns on, other test suits will be ignored.
config BCM_WIFI_TEST
bool "Enable BCM_WIFI Test"
default n
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_BCM
help
Attention: if this option turns on, other test suits will be ignored.
config TEST_PLATFORM
bool "Enable Platform Testsuit"
default n
depends on KERNEL_TEST && TEST
config 3RDPARTY_TEST
bool "Enable 3rdParty Test"
default n
depends on KERNEL_TEST && TEST && 3RDPARTY
help
Attention: 3rdParty tools and libs test

View File

@@ -0,0 +1,387 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 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.
config LOSCFG_TEST_LEVEL
int "Test Level"
default 2
depends on LOSCFG_TESTSUIT_SHELL
help
Attention:
0:smoke test
1:llt test
2:full test
3:presssure test
config LOSCFG_TEST_KERNEL_BASE
bool "Enable Kernel Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_IPC
bool "Enable IPC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_CORE
bool "Enable CORE Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_MEM
bool "Enable MEM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_VM
bool "Enable VM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_MISC
bool "Enable MISC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_OM
bool "Enable OM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_ATOMIC
bool "Enable ATOMIC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND
bool "Enable Extended Kernel Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_CPP
bool "Enable CPP Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_CPUP
bool "Enable CPUP Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_EXC
bool "Enable EXC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_UNALIGNACCESS
bool "Enable UNALIGNACCESS Testsuit"
default n
depends on LOSCFG_DO_ALIGN && LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_MMU
bool "Enable MMU Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_DYNLOAD
bool "Enable DYNLOAD Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_MPU
bool "Enable MPU Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_TICKLESS
bool "Enable TICKLESS Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_TRACE
bool "Enable TRACE Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX
bool "Enable Posix Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MEM
bool "Enable Mem Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MQUEUE
bool "Enable Mqueue Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MUTEX
bool "Enable Mutex Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_PTHREAD
bool "Enable Pthread Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SCHED
bool "Enable Sched Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SEM
bool "Enable Sem Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SWTMR
bool "Enable Swtmr Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LINUX
bool "Enable Linux Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LINUX_HRTIMER
bool "Enable Hrtimer Testsuit"
default n
depends on LOSCFG_TEST_LINUX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS
bool "Enable FS Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_VFS
bool "Enable VFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_JFFS
bool "Enable JFFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_RAMFS
bool "Enable RAMFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT
bool "Enable FAT Test"
default n
depends on LOSCFG_TEST_FS && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT_FAT32
bool "Enable FAT32 Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT_EXFAT
bool "Enable exFAT Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FAT32_FSCK
bool "Enable FAT32 Fsck Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_VIRPART
bool "Enable FAT virtual partition test"
default n
depends on LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_PROC
bool "Enable PROC Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_NFS
bool "Enable NFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD
bool "Enable MTD Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_JFFS
bool "Enable JFFS MTD Testsuit"
default n
depends on LOSCFG_TEST_MTD && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_FAT
bool "Enable FAT MTD Testsuit"
default n
depends on LOSCFG_TEST_MTD && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_FAT_VIRPART
bool "Enable FAT virtual partition MTD test"
default n
depends on LOSCFG_TEST_MTD && LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DRIVERBASE
bool "Enable DriverBase Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LIBC
bool "Enable LIBC Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LIBM
bool "Enable LIBM Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SHELL
bool "Enable Shell Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_USB
bool "Enable Usb Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_USB
help
config LOSCFG_TEST_HOST_MASS_DEVICE
bool "Enable Host Mass Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DEVICE_MASS_GADGET
bool "Enable Device Mass Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_UVC_GADGET
bool "Enable UVC Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UVC_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_UAC_GADGET
bool "Enable UAC Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UAC_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_CAMERA_GADGET
bool "Enable Camera Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_CAMERA_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_HUB_GADGET
bool "Enable HUB Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SERIAL_GADGET
bool "Enable Serial Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_SERIAL_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_ETHERNET_GADGET
bool "Enable Ethernet Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETHERNET_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MULTI_GADGET
bool "Enable Ethernet & Serial Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETH_SER_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DFU_GADGET
bool "Enable Drivers DFU Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MUTILDEVICE_GADGET
bool "Enable Drivers Multidevices Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_HOST_ETH
bool "Enable Host Eth Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_AUTO_USB
bool "Enable Usb auto Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MMC
bool "Enable MMC Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_MMC
config LOSCFG_TEST_SD
bool "Enable SD Testsuit"
default n
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SDIO
bool "Enable SDIO Testsuit"
default n
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
comment "Only one platform can be selected"
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SDIO_1131S
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
bool "1131s"
config LOSCFG_TEST_SDIO_RTL8189
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
bool "RTL8189"
config LOSCFG_TEST_PERFORMANCE
bool "Enable Performance Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_CORE
bool "Enable Performance CORE Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_MEM
bool "Enable Performance MEM Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_FS
bool "Enable Performance FS Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_USB
bool "Enable Performance USB Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_NET
bool "Enable Performance NET Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PLATFORM
bool "Enable Platform Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_NET
bool "Enable NET Test"
default n
depends on LOSCFG_TESTSUIT_SHELL
help
Attention: if this option turns on, other test suits will be ignored.
config LOSCFG_TEST_LWIP
bool "Enable LWIP Testsuit"
default n
depends on LOSCFG_TEST_NET && LOSCFG_TESTSUIT_SHELL
config AR6K3_WIFI_TEST
bool "Enable AR6K3_WIFI Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_QRD
help
Attention: if this option turns on, other test suits will be ignored.
config BCM_WIFI_TEST
bool "Enable BCM_WIFI Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_BCM
help
Attention: if this option turns on, other test suits will be ignored.
config LOSCFG_3RDPARTY_TEST
bool "Enable 3rdParty Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_3RDPARTY
help
Attention: 3rdParty tools and libs test
config LOSCFG_TEST_MANUAL_SHELL
bool "Enable Manual Test"
default n
depends on LOSCFG_TESTSUIT_SHELL

View File

@@ -0,0 +1,48 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 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 $(LITEOSTESTTOPDIR)/config.mk
MODULE_NAME := ktest
LOCAL_INCLUDE := -I $(LITEOSTESTTOPDIR)/kernel/include
LOCAL_SRCS := $(wildcard src/osTest.c) \
$(wildcard src/runstop_osTest.c) \
$(wildcard src/scatter_osTest.c) \
$(wildcard src/iCunit.c) \
$(wildcard src/ChipTest.c) \
$(wildcard src/testusb_shellcmd.c) \
$(wildcard src/testrun_shellcmd.c)
LOCAL_FLAGS := $(LOCAL_INCLUDE) -Wno-error -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include \
-I $(LITEOSTOPDIR)/fs/fat/os_adapt
include $(MODULE)

View File

@@ -0,0 +1,574 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef _UNI_ICUNIT_H
#define _UNI_ICUNIT_H
#include <string.h>
#include <stdio.h>
#include "los_typedef.h"
#include "los_spinlock.h"
#ifdef TST_DRVPRINT
#include "VOS_typdef.h"
#include "uartdriver.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
typedef unsigned short iUINT16;
typedef unsigned int iUINT32;
typedef signed short iINT16;
typedef signed long iINT32;
typedef char iCHAR;
typedef void iVOID;
typedef unsigned long iiUINT32;
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define FUNCTION_TEST (1 << 0)
#define PRESSURE_TEST (1 << 1)
#define PERFORMANCE_TEST (1 << 2)
#define TEST_MODE (FUNCTION_TEST)
#define TEST_LESSER_MEM NO
typedef iUINT32 (*CASE_FUNCTION)(void);
typedef struct {
const iCHAR *pcCaseID;
CASE_FUNCTION pstCaseFunc;
iUINT16 testcase_layer;
iUINT16 testcase_module;
iUINT16 testcase_level;
iUINT16 testcase_type;
iiUINT32 retCode;
iUINT16 errLine;
} ICUNIT_CASE_S;
typedef struct {
iUINT16 uwCaseCnt;
iCHAR *pcSuitID;
iCHAR *pucFilename;
ICUNIT_CASE_S *pstCaseList;
iUINT16 passCnt;
iUINT16 failCnt;
} ICUNIT_SUIT_S;
typedef enum {
TEST_TASK = 0,
TEST_MEM,
TEST_VM,
TEST_SEM,
TEST_MUX,
TEST_RWLOCK,
TEST_EVENT,
TEST_QUE,
TEST_SWTMR,
TEST_HWI,
TEST_MP,
TEST_ATO,
TEST_CPUP,
TEST_SCATTER,
TEST_RUNSTOP,
TEST_TIMER,
TEST_MMU,
TEST_ROBIN,
TEST_LIBC,
TEST_WAIT,
TEST_VFAT,
TEST_JFFS,
TEST_RAMFS,
TEST_NFS,
TEST_PROC,
TEST_FS,
TEST_UART,
TEST_PTHREAD,
TEST_COMP,
TEST_HWI_HALFBOTTOM,
TEST_WORKQ,
TEST_WAKELOCK,
TEST_TIMES,
TEST_LIBM,
TEST_SUPPORT,
TEST_STL,
TEST_MAIL,
TEST_MSG,
TEST_CP,
TEST_SIGNAL,
TEST_SCHED,
TEST_MTDCHAR,
TEST_TIME,
TEST_WRITE,
TEST_READ,
TEST_DYNLOAD,
TEST_REGISTER,
TEST_UNAME,
TEST_ERR,
TEST_CMD,
TEST_TICKLESS,
TEST_TRACE,
TEST_UNALIGNACCESS,
TEST_EXC,
TEST_REQULATOR,
TEST_DEVFREQ,
TEST_CPUFREQ,
TEST_MISC,
#if defined(LOSCFG_3RDPARTY_TEST)
TEST_THTTPD,
TEST_BIDIREFC,
TEST_CJSON,
TEST_CURL,
TEST_FFMPEG,
TEST_FREETYPE,
TEST_INIPARSER,
TEST_JSONCPP,
TEST_LIBICONV,
TEST_LIBJPEG,
TEST_LIBPNG,
TEST_OPENEXIF,
TEST_OPENSSL,
TEST_OPUS,
TEST_SQLITE,
TEST_TINYXML,
TEST_XML2,
TEST_ZBAR,
TEST_HARFBUZZ,
#endif
TEST_DRIVERBASE,
TEST_UDP,
TEST_TCP,
TEST_MODULE_ALL,
} LiteOS_test_module;
typedef enum {
TEST_LOS = 0,
TEST_POSIX,
TEST_LIB,
TEST_VFS,
TEST_EXTEND,
TEST_PARTITION,
TEST_CPP,
TEST_SHELL,
TEST_LINUX,
TEST_USB,
#if defined(LOSCFG_3RDPARTY_TEST)
TEST_3RDPARTY,
#endif
TEST_DRIVERFRAME,
TEST_NET_LWIP,
TEST_LAYER_ALL,
} LiteOS_test_layer;
typedef enum {
TEST_LEVEL0 = 0,
TEST_LEVEL1,
TEST_LEVEL2,
TEST_LEVEL3,
TEST_LEVEL4,
TEST_LEVEL_ALL,
} LiteOS_test_level;
typedef enum {
TEST_FUNCTION = 0,
TEST_PRESSURE,
TEST_PERFORMANCE,
TEST_TYPE_ALL,
} LiteOS_test_type;
typedef enum {
TEST_SEQUENCE = 0,
TEST_RANDOM
} LiteOS_test_sequence;
extern iUINT16 g_iCunitErrLineNo;
extern iiUINT32 g_iCunitErrCode;
extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
#define ICUNIT_UNINIT 0x0EF00000
#define ICUNIT_OPENFILE_FAILED 0x0EF00001
#define ICUNIT_ALLOC_FAIL 0x0EF00002
#define ICUNIT_SUIT_FULL 0x0EF00002
#define ICUNIT_CASE_FULL 0x0EF00003
#define ICUNIT_SUIT_ALL 0x0EF0FFFF
#define ICUNIT_SUCCESS 0x00000000
#if 1
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
} \
} while (0)
#define ICUNIT_TRACK_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL_NULL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return NULL; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL_NULL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return NULL; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_WITHIN_EQUAL(param, value1, value2, retcode) \
do { \
if ((param) < (value1) || (param) > (value2)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_WITHIN_EQUAL_VOID(param, value1, value2, retcode) \
do { \
if ((param) < (value1) || (param) > (value2)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_WITHIN_EQUAL_NULL(param, value1, value2, retcode) \
do { \
if ((param) < (value1) || (param) > (value2)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_SIZE_STRING_EQUAL(str1, str2, strsize, retcode) \
do { \
if (strncmp((str1), (str2), (strsize)) != 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL_TIME(param, g_value, retcode, label) \
do { \
if ((param) < (g_value - 1) || (param) > (g_value + 1)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) != 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_EQUAL_VOID(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) != 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) == 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
} \
} while (0)
#define ICUNIT_GOTO_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) != (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_EQUAL_IN(param, value1, value2, retcode, label) \
do { \
if (((param) != (value1)) && ((param) != (value2))) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_NOT_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) == (g_value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_WITHIN_EQUAL(param, value1, value2, retcode, label) \
do { \
if ((param) < (value1) || (param) > (value2)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) != 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) == 0) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
goto label; \
} \
} while (0)
#else
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
} \
} while (0)
#define ICUNIT_TRACK_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) != 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) == 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_GOTO_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_NOT_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) != 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) == 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#endif
#if (LOSCFG_KERNEL_SMP == YES)
extern SPIN_LOCK_S g_testSuitSpin;
#define TESTSUIT_LOCK(state) LOS_SpinLockSave(&g_testSuitSpin, &(state))
#define TESTSUIT_UNLOCK(state) LOS_SpinUnlockRestore(&g_testSuitSpin, state)
#endif
extern iUINT32 iCunitAddSuit_F(iCHAR *suitName, iCHAR *pfileName);
#define iCunitAddSuit(suitName) iCunitAddSuit_F(suitName, __FILE__)
extern iUINT32 ICunitAddCase(const iCHAR *caseName, CASE_FUNCTION caseFunc, iUINT16 testcaseLayer,
iUINT16 testcaseModule, iUINT16 testcaseLevel, iUINT16 testcaseType);
extern iUINT32 ICunitRunTestOne(const char *tcId);
extern INT32 ICunitRunTestArray(const char *tcSequence, const char *tcNum, const char *tcLayer, const char *tcModule,
const char *tcLevel, const char *tcType);
extern iUINT32 ICunitRunTestArraySequence(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUINT32 testcaseModule,
iUINT32 testcaseLevel, iUINT32 testcaseType);
extern iUINT32 ICunitRunTestArrayRandom(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUINT32 testcaseModule,
iUINT32 testcaseLevel, iUINT32 testcaseType);
extern iUINT32 ICunitRunTestcaseSatisfied(ICUNIT_CASE_S *testCase, iUINT32 testcaseLayer, iUINT32 testcaseModule,
iUINT32 testcaseLevel, iUINT32 testcaseType);
extern iUINT32 ICunitInit(void);
extern iUINT32 ICunitRunSingle(ICUNIT_CASE_S *psubCase);
extern iUINT32 ICunitRunF(ICUNIT_CASE_S *psubCase);
extern iUINT32 iCunitPrintReport(void);
#define TEST_ADD_CASE(name, casefunc, testcase_layer, testcase_module, testcase_level, testcase_type) \
do { \
iUINT32 uwRet = 1; \
uwRet = ICunitAddCase(name, (CASE_FUNCTION)casefunc, testcase_layer, testcase_module, testcase_level, \
testcase_type); \
ICUNIT_ASSERT_EQUAL_VOID(uwRet, ICUNIT_SUCCESS, uwRet); \
} while (0)
#define TEST_RUN_SUITE() \
do { \
UINT32 uiRet; \
uiRet = iCunitRun(); \
ICUNIT_ASSERT_NOT_EQUAL_VOID(uiRet, ICUNIT_UNINIT, ICUNIT_UNINIT); \
} while (0)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* _UNI_ICUNIT_H */

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef _ICUNIT_ICUNIT_INC
#define _ICUNIT_ICUNIT_INC
#include "iCunit_config.h"
#include "los_builddef.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
ICUNIT_CASE_S g_iCunitRandArray[1];
ICUNIT_CASE_S g_iCunitCaseArray[ICUNIT_CASE_SIZE];
iUINT32 g_iCunitInitSuccess = 0x0000FFFF;
iUINT32 g_iCunitCaseCnt = 0xFFFF;
iUINT32 g_iCunitCaseFailedCnt = 0;
iUINT32 g_iCunitErrLogAddCase = 0;
iUINT16 g_iCunitErrLineNo;
iiUINT32 g_iCunitErrCode;
iUINT32 g_iCunitCaseRun = 0;
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* _UNI_ICUNIT_INC */

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "los_builddef.h"
#ifndef _ICUNIT_CONFIG_H
#define _ICUNIT_CONFIG_H
#include "los_builddef.h"
#include "los_config.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if defined(LITEOS_TEST_AUTO) && !defined(LOSCFG_TEST_MUTIL)
#define ICUNIT_CASE_SIZE LOSCFG_BASE_CORE_TSK_LIMIT
#else
#define ICUNIT_CASE_SIZE 20000
#endif
#define ICUNIT_SUIT_SIZE 1
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef _LOS_TEST_PRI_H
#define _LOS_TEST_PRI_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern UINT32 OsTestInit(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_TEST_PRI_H */

View File

@@ -0,0 +1,374 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef _OSTEST_H
#define _OSTEST_H
#ifndef SWTMR_TEST
#define SWTMR_TEST
#endif
#include "test_menuconfig.h"
#include "stdarg.h"
#include "los_config.h"
#include "iCunit.h"
#include "stdio.h"
#include "stdlib.h"
#include "limits.h"
#include "string.h"
#include "los_base.h"
#include "los_config.h"
#include "los_typedef.h"
#include "los_hwi.h"
#include "los_vm_map.h"
#include "los_task.h"
#include "los_sched_pri.h"
#include "los_task_pri.h"
#include "los_sys_pri.h"
#include "los_sem_pri.h"
#include "los_event.h"
#include "los_memory.h"
#include "los_queue.h"
#include "los_swtmr.h"
#include "los_mux.h"
#include "los_queue_pri.h"
#include "los_atomic.h"
#if !defined(TEST1980) && !defined(TESTISP)
#include "console.h"
#endif
#ifndef LOSCFG_AARCH64
#ifdef LOSCFG_LIB_LIBC
#include "time.h"
#endif
#include "target_config.h"
#endif
#include "los_process_pri.h"
#include "pthread.h"
#ifdef LOSCFG_PLATFORM_HI3516DV300
#define TEST3516DV300
#elif LOSCFG_PLATFORM_HI3518EV300
#define TEST3518EV300
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
do { \
memset(&testTask, 0, sizeof(TSK_INIT_PARAM_S)); \
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
testTask.uwStackSize = LOS_TASK_MIN_STACK_SIZE; \
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
} while (0)
#if (LOSCFG_KERNEL_SMP == YES)
#define TEST_TASK_PARAM_INIT_AFFI(testTask, task_name, entry, prio, affi) \
TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
testTask.usCpuAffiMask = affi;
#else
#define TEST_TASK_PARAM_INIT_AFFI(stTestTask, task_name, entry, prio, affi) \
TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio)
#endif
#define JFFS_BASE_MTD_ADDR 0x100000
#define JFFS_BASE_MTD_LEN 0x600000
#define TASK_PRIO_TEST 25
#define TASK_PRIO_TEST_TASK 4
#define TASK_PRIO_TEST_SWTMR 4
#ifdef LOSCFG_AARCH64
#define TASK_STACK_SIZE_TEST (LOS_TASK_MIN_STACK_SIZE * 3)
#else
#define TASK_STACK_SIZE_TEST LOS_TASK_MIN_STACK_SIZE
#endif
#define LOS_MS_PER_TICK (OS_SYS_MS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND)
#define HWI_NUM_INTVALID OS_HWI_MAX_NUM
#define writel(g_value, address) WRITE_UINT32(g_value, address)
#ifdef TESTPBXA9
extern int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
#endif
#if defined(LOSCFG_TEST_POSIX)
extern UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri);
extern UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread);
#endif
extern UINT32 TaskCountGetTest(VOID);
extern UINT32 SemCountGetTest(VOID);
extern UINT32 QueueCountGetTest(VOID);
extern UINT32 SwtmrCountGetTest(VOID);
extern void hal_interrupt_set_affinity(uint32_t irq, uint32_t cpuMask);
#define TASK_EXISTED_NUM (TaskCountGetTest())
#define QUEUE_EXISTED_NUM (QueueCountGetTest())
#define SWTMR_EXISTED_NUM (SwtmrCountGetTest())
#define SEM_EXISTED_NUM (SemCountGetTest())
extern void TestTestHwiDelete(unsigned int irq, void *devId);
extern void TestHwiTrigger(unsigned int irq);
extern void TestExtraTaskDelay(UINT32 tick);
extern UINT64 TestTickCountGet(void);
extern UINT64 TestTickCountByCurrCpuid(void);
extern void TestBusyTaskDelay(UINT32 tick);
extern void *malloc(size_t size);
extern void TestDumpCpuid(void);
extern u_long TRandom(void);
#define TEST_HwiDelete(ID) TestTestHwiDelete(ID, NULL)
#define TEST_HwiClear(ID) HalIrqMask(ID)
#define TEST_HwiTriggerDelay LOS_TaskDelay(200 * LOSCFG_BASE_CORE_TICK_PER_SECOND / 1000)
#define TEST_HwiCreate(ID, prio, mode, Func, arg) LOS_HwiCreate(ID, prio, mode, Func, arg)
#define HWI_NUM_INT0 0
#define HWI_NUM_INT1 1
#define HWI_NUM_INT2 2
#define HWI_NUM_INT3 3
#define HWI_NUM_INT4 4
#define HWI_NUM_INT5 5
#define HWI_NUM_INT6 6
#define HWI_NUM_INT7 7
#define HWI_NUM_INT11 11
#define HWI_NUM_INT12 12
#define HWI_NUM_INT13 13
#define HWI_NUM_INT14 14
#define HWI_NUM_INT15 15
#define HWI_NUM_INT16 16
#define HWI_NUM_INT17 17
#define HWI_NUM_INT18 18
#define HWI_NUM_INT19 19
#define HWI_NUM_INT21 21
#define HWI_NUM_INT22 22
#define HWI_NUM_INT23 23
#define HWI_NUM_INT24 24
#define HWI_NUM_INT25 25
#define HWI_NUM_INT26 26
#define HWI_NUM_INT27 27
#define HWI_NUM_INT28 28
#define HWI_NUM_INT30 30
#define HWI_NUM_INT31 31
#define HWI_NUM_INT32 32
#define HWI_NUM_INT33 33
#define HWI_NUM_INT34 34
#define HWI_NUM_INT35 35
#define HWI_NUM_INT42 42
#define HWI_NUM_INT45 45
#define HWI_NUM_INT46 46
#define HWI_NUM_INT50 50
#define HWI_NUM_INT55 55
#define HWI_NUM_INT56 56
#define HWI_NUM_INT57 57
#define HWI_NUM_INT58 58
#define HWI_NUM_INT59 59
#define HWI_NUM_INT60 60
#define HWI_NUM_INT61 61
#define HWI_NUM_INT63 63
#define HWI_NUM_INT62 62
#define HWI_NUM_INT68 68
#define HWI_NUM_INT69 69
#define HWI_NUM_INT95 95
#define HWI_NUM_INT114 114
#define HWI_NUM_INT169 169
#if defined TESTPBXA9
#define HWI_NUM_TEST HWI_NUM_INT56
#define HWI_NUM_TEST1 HWI_NUM_INT57
#define HWI_NUM_TEST0 HWI_NUM_INT58
#define HWI_NUM_TEST2 HWI_NUM_INT59
#define HWI_NUM_TEST3 HWI_NUM_INT60
#elif defined TEST3518EV300
#define HWI_NUM_TEST0 HWI_NUM_INT58
#define HWI_NUM_TEST HWI_NUM_INT59
#define HWI_NUM_TEST1 HWI_NUM_INT60
#define HWI_NUM_TEST2 HWI_NUM_INT61
#define HWI_NUM_TEST3 HWI_NUM_INT68
#elif defined TEST3516DV300
#define HWI_NUM_TEST HWI_NUM_INT56
#define HWI_NUM_TEST1 HWI_NUM_INT57
#define HWI_NUM_TEST0 HWI_NUM_INT58
#define HWI_NUM_TEST2 HWI_NUM_INT59
#define HWI_NUM_TEST3 HWI_NUM_INT60
#endif
#define TEST_TASKDELAY_1TICK 1
#define TEST_TASKDELAY_2TICK 2
#define TEST_TASKDELAY_4TICK 4
#define TEST_TASKDELAY_10TICK 10
#define TEST_TASKDELAY_20TICK 20
#define TEST_TASKDELAY_50TICK 50
#ifdef TEST3731
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER1_REG_BASE + TIMER_VALUE)
#elif defined TEST3559
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER3_REG_BASE + TIMER_VALUE)
#else
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER2_REG_BASE + TIMER_VALUE)
#endif
#define REALTIME(time) (UINT32)((UINT64)(0xffffffff - time) * 1000 / OS_SYS_CLOCK) /* accuracy:ms */
#define HW_TMI(time) (UINT32)((UINT64)(0xffffffff - time) * 1000 / (OS_SYS_CLOCK / 1000000)) /* accuracy:ns */
#define uart_printf_func dprintf
#ifndef VFS_STAT_PRINTF
#define VFS_STAT_PRINTF 0
#endif
#ifndef VFS_STATFS_PRINTF
#define VFS_STATFS_PRINTF 0
#endif
#define OPEN_FILE_MAX 20
#define HUAWEI_ENV_NFS 0
#ifndef TEST_RESOURCELEAK_CHECK
#define TEST_RESOURCELEAK_CHECK YES
#endif
#ifndef TEST_MODULE_CHECK
#define TEST_MODULE_CHECK YES
#endif
#define OS_PROCESS_STATUS_PEND OS_PROCESS_STATUS_PENDING
#define OS_TASK_STATUS_SUSPEND OS_TASK_STATUS_SUSPENDED
#define OS_TASK_STATUS_PEND OS_TASK_STATUS_PENDING
extern UINT32 volatile g_testCount;
extern UINT32 g_testCount1;
extern UINT32 g_testCount2;
extern UINT32 g_testCount3;
extern UINT32 g_flowcheck;
extern UINT32 g_failResult;
extern UINT32 g_passResult;
extern UINT32 g_testTskHandle;
extern UINT32 g_testTaskID01;
extern UINT32 g_testTaskID02;
extern UINT32 g_testTaskID03;
extern UINT32 g_testTaskID04;
extern UINT32 g_hwiNum1;
extern UINT32 g_hwiNum2;
extern UINT32 g_semID;
extern UINT32 g_semID2;
extern LosMux g_mutexkernelTest;
extern UINT32 g_cpupTestCount;
extern UINT16 g_swTmrID;
extern UINT32 g_semID;
extern UINT32 g_testQueueID01;
extern UINT32 g_testQueueID02;
extern UINT32 g_testQueueID03;
extern UINT32 g_testTskHandle;
extern UINT32 g_leavingTaskNum;
extern UINT32 g_semID3[];
extern EVENT_CB_S g_eventCB;
extern EVENT_CB_S g_event;
extern UINT32 g_testPeriod;
extern BOOL g_isAddArray;
extern BOOL g_isSdInit;
extern BOOL g_isSpinorInit;
extern UINT32 g_getTickConsume;
extern UINT32 g_waitTestCount;
extern INT32 g_libFileSystem;
extern UINT32 LosMuxCreate(LosMux *mutex);
extern INT32 g_performanceStart;
extern void msleep(unsigned int msecs);
extern unsigned int sleep(unsigned int seconds);
extern int usleep(unsigned useconds);
#define OS_TASK_STATUS_DETACHED OS_TASK_FLAG_DETACHED
extern UINT32 LOS_MemTotalUsedGet(VOID *pool);
extern VOID ptestTickConsume(VOID);
extern UINT32 TEST_TskDelete(UINT32 taskID);
extern UINT32 TEST_SemDelete(UINT32 semHandle);
extern VOID ItSuiteLosQueue(VOID);
extern VOID ItSuiteLosSwtmr(VOID);
extern VOID ItSuiteLosTask(VOID);
extern VOID ItSuiteLosEvent(VOID);
extern VOID ItSuiteLosMux(VOID);
extern VOID ItSuiteLosRwlock(VOID);
extern VOID ItSuiteLosSem(VOID);
extern VOID ItSuiteSmpHwi(VOID);
extern VOID ItSuiteHwiNesting(VOID);
extern VOID ItSuiteExtendCpup(VOID);
extern VOID ItSuitePosixMutex(VOID);
extern VOID ItSuitePosixPthread(VOID);
extern VOID TestRunShell(VOID);
extern UINT32 OsTestInit(VOID);
extern void TEST_DT_COMMON(void);
extern VOID dprintf(const char *fmt, ...);
#define BIG_FD 512
typedef struct testrunParam {
CHAR testcase_sequence[16];
CHAR testcase_num[16];
CHAR testcase_layer[32];
CHAR testcase_module[32];
CHAR testcase_level[16];
CHAR testcase_type[16];
CHAR testcase_id[128];
} TEST_RUN_PARAM;
#define LOSCFG_BASE_CORE_TSK_CONFIG LOSCFG_BASE_CORE_TSK_LIMIT
#define LOSCFG_BASE_IPC_SEM_CONFIG LOSCFG_BASE_IPC_SEM_LIMIT
#define LOSCFG_BASE_IPC_QUEUE_CONFIG LOSCFG_BASE_IPC_QUEUE_LIMIT
#define LOSCFG_BASE_CORE_SWTMR_CONFIG LOSCFG_BASE_CORE_SWTMR_LIMIT
#define HAL_READ_UINT8(addr, data) READ_UINT8(data, addr)
#define HAL_WRITE_UINT8(addr, data) WRITE_UINT8(data, addr)
#define HAL_READ_UINT32(addr, data) READ_UINT32(data, addr)
#define HAL_WRITE_UINT32(addr, data) WRITE_UINT32(data, addr)
extern void InitRebootHook(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* _OSTEST_H */

View File

@@ -0,0 +1,35 @@
static_library("test_core") {
sources = [
"task/It_los_task.c",
"swtmr/It_los_swtmr.c",
"hwi/It_smp_hwi.c",
"hwi_nesting/It_hwi_nesting.c",
]
if (LOSCFG_TEST_SMOKE) {
sources += [
"task/smoke/It_los_task_045.c",
"task/smoke/It_los_task_046.c",
"task/smoke/It_los_task_049.c",
"task/smoke/It_los_task_081.c",
"task/smoke/It_los_task_089.c",
"task/smoke/It_los_task_097.c",
"task/smoke/It_los_task_099.c",
"task/smoke/It_los_task_101.c",
"task/smoke/It_los_task_105.c",
"task/smoke/It_los_task_timeslice_001.c",
"swtmr/smoke/It_los_swtmr_053.c",
"swtmr/smoke/It_los_swtmr_058.c",
]
}
include_dirs = [
"../../../include/",
"task",
"swtmr",
"hwi",
"hwi_nesting",
]
cflags = [ "-Wno-error" ]
}

View File

@@ -0,0 +1,46 @@
include $(LITEOSTESTTOPDIR)/config.mk
MODULE_NAME := coretest
LOCAL_INCLUDE := \
-I $(LITEOSTESTTOPDIR)/kernel/include \
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/task \
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/swtmr \
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/hwi \
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/hwi_nesting
SRC_MODULES := task swtmr hwi hwi_nesting
ifeq ($(LOSCFG_KERNEL_SMP), y)
SMP_MODULES := task/smp swtmr/smp hwi/smp task/float
endif
ifeq ($(LOSCFG_TEST_LLT), y)
LLT_MODULES := task/llt swtmr/llt
endif
ifeq ($(LOSCFG_TEST_PRESSURE), y)
PRESSURE_MODULES := task/pressure swtmr/pressure
endif
ifeq ($(LOSCFG_TEST_SMOKE), y)
SMOKE_MODULES := task/smoke swtmr/smoke
endif
ifeq ($(LOSCFG_TEST_FULL), y)
FULL_MODULES := task/full swtmr/full hwi_nesting/full
endif
ifeq ($(LOSCFG_TEST_MANUAL_SHELL), y)
MANUAL_MODULES :=task/manual
endif
LOCAL_MODULES := $(SRC_MODULES) $(LLT_MODULES) $(PRESSURE_MODULES) $(SMOKE_MODULES) $(FULL_MODULES) $(SMP_MODULES) $(MANUAL_MODULES)
LOCAL_SRCS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.c))
LOCAL_CHS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.h))
LOCAL_FLAGS := $(LOCAL_INCLUDE) -Wno-error
include $(MODULE)

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
VOID ItSuiteSmpHwi(VOID)
{
#if (LOSCFG_KERNEL_SMP == YES)
ItSmpLosHwi001();
ItSmpLosHwi002();
ItSmpLosHwi003();
ItSmpLosHwi004();
ItSmpLosHwi005();
ItSmpLosHwi006();
ItSmpLosHwi007();
ItSmpLosHwi008();
ItSmpLosHwi009();
ItSmpLosHwi010();
ItSmpLosHwi011();
ItSmpLosHwi012();
ItSmpLosHwi013();
#ifndef LOSCFG_NO_SHARED_IRQ
ItSmpLosHwiShare001();
ItSmpLosHwiShare002();
ItSmpLosHwiShare003();
ItSmpLosHwiShare004();
ItSmpLosHwiShare005();
ItSmpLosHwiShare006();
ItSmpLosHwiShare007();
ItSmpLosHwiShare008();
ItSmpLosHwiShare009();
ItSmpLosHwiShare010();
#endif
ItSmpLosHwiIpi001();
ItSmpLosHwiIpi002();
ItSmpLosHwiIpi003();
ItSmpLosHwiIpi004();
ItSmpLosHwiIpi005();
ItSmpLosHwiIpi006();
ItSmpLosHwiIpi007();
ItSmpLosHwiIpi008();
ItSmpLosHwiNest001();
ItSmpLosHwiNest002();
ItSmpLosHwiNest003();
ItSmpLosHwiNest004();
ItSmpLosHwiNest005();
ItSmpLosHwiNest006();
ItSmpLosHwiNest007();
ItSmpLosHwiNest008();
#endif
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, 1);
HalIrqSetAffinity(HWI_NUM_TEST1, 1);
HalIrqSetAffinity(HWI_NUM_TEST2, 1);
HalIrqSetAffinity(HWI_NUM_TEST3, 1);
#endif
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,98 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef LOS_SMP_HWI_H
#define LOS_SMP_HWI_H
#include "los_hwi.h"
#include "osTest.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define LOOP 100
#if defined(LOSCFG_TEST_SMP)
VOID ItSmpLosHwi001(VOID);
VOID ItSmpLosHwi002(VOID);
VOID ItSmpLosHwi003(VOID);
VOID ItSmpLosHwi004(VOID);
VOID ItSmpLosHwi005(VOID);
VOID ItSmpLosHwi006(VOID);
VOID ItSmpLosHwi007(VOID);
VOID ItSmpLosHwi008(VOID);
VOID ItSmpLosHwi009(VOID);
VOID ItSmpLosHwi010(VOID);
VOID ItSmpLosHwi011(VOID);
VOID ItSmpLosHwi012(VOID);
VOID ItSmpLosHwi013(VOID);
#ifndef LOSCFG_NO_SHARED_IRQ
VOID ItSmpLosHwiShare001(VOID);
VOID ItSmpLosHwiShare002(VOID);
VOID ItSmpLosHwiShare003(VOID);
VOID ItSmpLosHwiShare004(VOID);
VOID ItSmpLosHwiShare005(VOID);
VOID ItSmpLosHwiShare006(VOID);
VOID ItSmpLosHwiShare007(VOID);
VOID ItSmpLosHwiShare008(VOID);
VOID ItSmpLosHwiShare009(VOID);
VOID ItSmpLosHwiShare010(VOID);
#endif
VOID ItSmpLosHwiIpi001(VOID);
VOID ItSmpLosHwiIpi002(VOID);
VOID ItSmpLosHwiIpi003(VOID);
VOID ItSmpLosHwiIpi004(VOID);
VOID ItSmpLosHwiIpi005(VOID);
VOID ItSmpLosHwiIpi006(VOID);
VOID ItSmpLosHwiIpi007(VOID);
VOID ItSmpLosHwiIpi008(VOID);
VOID ItSmpLosHwiNest001(VOID);
VOID ItSmpLosHwiNest002(VOID);
VOID ItSmpLosHwiNest003(VOID);
VOID ItSmpLosHwiNest004(VOID);
VOID ItSmpLosHwiNest005(VOID);
VOID ItSmpLosHwiNest006(VOID);
VOID ItSmpLosHwiNest007(VOID);
VOID ItSmpLosHwiNest008(VOID);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* LOS_SMP_HWI_H */

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_testTimes;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi001(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(0));
#endif
TestHwiTrigger(HWI_NUM_TEST);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
do {
__asm__ volatile("nop");
} while (g_testCount != 1);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi002(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_testTimes;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
#ifndef LOSCFG_NO_SHARED_IRQ
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_SHARED_ERROR, ret);
#else
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret);
#endif
return;
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi003(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_testTimes;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
#ifndef LOSCFG_NO_SHARED_IRQ
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_SHARED_ERROR, ret);
#else
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret);
#endif
return;
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi004(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
TEST_HwiDelete(HWI_NUM_TEST);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi005(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
TEST_HwiDelete(HWI_NUM_TEST);
LOS_AtomicInc(&g_testCount);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test runing count
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi006(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static VOID TaskF02(void)
{
UINT32 ret;
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret;
g_testCount = 0;
TEST_TASK_PARAM_INIT(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1);
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
TEST_TASK_PARAM_INIT(testTask, "it_hwi_007_task02", TaskF02, TASK_PRIO_TEST + 1);
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi007(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_ret = 0;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
g_ret |= ret;
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, i, j;
for (j = 0; j < LOOP; j++) {
g_testCount = 0;
g_ret = 0;
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1,
CPUID_TO_AFFI_MASK(i));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(1);
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
TEST_HwiDelete(HWI_NUM_TEST);
}
EXIT:
LOS_TaskDelete(g_testTaskID01);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwi008(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_ret = 0;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01(void)
{
UINT32 ret;
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
g_ret |= ret;
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, i, j;
for (j = 0; j < LOOP; j++) {
g_testCount = 0;
g_ret = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1,
CPUID_TO_AFFI_MASK(i));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(2); // 2, set delay time
#ifdef TEST1980
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
}
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, NULL);
return LOS_OK;
}
VOID ItSmpLosHwi009(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,121 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret;
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static VOID HwiF02(void)
{
UINT32 ret;
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
UINT32 ret, i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
for (i = 0; i < LOOP; i++) {
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST1);
TestHwiTrigger(HWI_NUM_TEST);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
#endif
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
ret = LOS_SwtmrDelete(g_szId[0]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_szId[1]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
}
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(g_szId[0]);
LOS_SwtmrDelete(g_szId[1]);
LOS_HwiDelete(HWI_NUM_TEST, NULL);
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
return LOS_OK;
}
VOID ItSmpLosHwi010(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi010", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,190 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST);
ret = LOS_SwtmrStart(g_szId[0]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestDumpCpuid();
return;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, NULL);
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
LOS_SwtmrDelete(g_szId[0]);
LOS_SwtmrDelete(g_szId[1]);
return;
}
static VOID HwiF02(void)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST1);
ret = LOS_SwtmrStart(g_szId[1]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestDumpCpuid();
return;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, NULL);
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
LOS_SwtmrDelete(g_szId[0]);
LOS_SwtmrDelete(g_szId[1]);
return;
}
static VOID HwiF03(void)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST2);
ret = LOS_SwtmrStop(g_szId[1]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestDumpCpuid();
return;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, NULL);
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
LOS_SwtmrDelete(g_szId[0]);
LOS_SwtmrDelete(g_szId[1]);
return;
}
static VOID HwiF04(void)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST3);
ret = LOS_SwtmrStop(g_szId[0]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestDumpCpuid();
return;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, NULL);
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
LOS_SwtmrDelete(g_szId[0]);
LOS_SwtmrDelete(g_szId[1]);
return;
}
static UINT32 Testcase(void)
{
UINT32 ret, i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
ret = LOS_HwiCreate(HWI_NUM_TEST2, 1, 0, (HWI_PROC_FUNC)HwiF03, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST2, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST3, 1, 0, (HWI_PROC_FUNC)HwiF04, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST3, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
for (i = 0; i < LOOP; i++) {
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST1); // start swtmrs
TestHwiTrigger(HWI_NUM_TEST);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
#endif
LOS_TaskDelay(g_testPeriod + 1);
ICUNIT_GOTO_EQUAL(g_testCount, 2 * (i + 1), g_testCount, EXIT); // 2 * (i + 1),Compared to the expected value.
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST3); // stop swtmrs
TestHwiTrigger(HWI_NUM_TEST2);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST3);
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST2);
#endif
LOS_TaskDelay(g_testPeriod + 1);
ICUNIT_GOTO_EQUAL(g_testCount, 2 * (i + 1), g_testCount, EXIT); // 2 * (i + 1),Compared to the expected value.
}
EXIT:
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST2, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST3, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_szId[0]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_szId[1]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
}
VOID ItSmpLosHwi011(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi011", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,125 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret;
ret = LOS_SwtmrDelete(g_szId[0]);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static VOID HwiF02(void)
{
UINT32 ret;
ret = LOS_SwtmrDelete(g_szId[1]);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
UINT32 ret, i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
for (i = 0; i < LOOP; i++) {
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_SwtmrStart(g_szId[0]);
LOS_SwtmrStart(g_szId[1]);
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST1);
TestHwiTrigger(HWI_NUM_TEST);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
#endif
LOS_TaskDelay(g_testPeriod + 1);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
}
EXIT:
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_szId[0]);
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_szId[1]);
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
}
VOID ItSmpLosHwi012(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi012", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret, i;
for (i = 0; i < TRandom() % 100; i++) { // Get a random number between 0 and 100
}
ret = LOS_SwtmrDelete(g_swTmrID);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
UINT32 ret, i, j;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
for (i = 0; i < LOOP; i++) {
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_swTmrID, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST); // delete swtmr in hwi on other cpu
for (j = 0; j < TRandom() % 500; j++) { // Get a random number between 0 and 500
LOS_SwtmrStart(g_swTmrID); // start swtmr in task on current cpu
}
LOS_TaskDelay(g_testPeriod + 1);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
}
EXIT:
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(g_swTmrID);
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
}
VOID ItSmpLosHwi013(VOID)
{
TEST_ADD_CASE("ItSmpLosHwi013", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
ICUNIT_GOTO_EQUAL(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid(), EXIT);
return;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid(); // currernt cpu
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
LOS_TaskDelay(1);
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11); // 01:0kernel,10:1kernel,11:0kernel& 1kernel
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
}
VOID ItSmpLosHwiIpi001(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_targetCpuid = 0;
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqUnmask(HWI_NUM_INT11);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; // other cpu
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
LOS_TaskDelay(1);
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
LOS_TaskDelay(1);
TEST_HwiDelete(HWI_NUM_INT11);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
return LOS_OK;
}
VOID ItSmpLosHwiIpi002(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
UINT32 i;
g_testCount = 0;
g_targetCpuid = 0;
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqUnmask(HWI_NUM_INT11);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
g_targetCpuid = currCpuid; // other cpu
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1, CPUID_TO_AFFI_MASK(currCpuid));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
}
VOID ItSmpLosHwiIpi003(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
UINT32 i;
g_testCount = 0;
g_targetCpuid = 0;
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqUnmask(HWI_NUM_INT11);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM); // other cpu
g_targetCpuid = ArchCurrCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1, CPUID_TO_AFFI_MASK(currCpuid));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
}
VOID ItSmpLosHwiIpi004(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
LOS_TaskDelay(1);
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM, g_testCount, EXIT);
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
}
VOID ItSmpLosHwiIpi005(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret, index;
index = ArchCurrCpuid();
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[index], 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i, j;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(1);
for (j = 0; j < LOOP; j++) {
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (j + 1), g_testCount, EXIT);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
ret = LOS_SwtmrDelete(g_szId[i]);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
}
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
LOS_SwtmrDelete(g_szId[i]);
}
return LOS_OK;
}
VOID ItSmpLosHwiIpi006(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,143 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
/* for debugging */
STATIC UINT32 g_ipiTriggerTimes = 0;
STATIC UINT32 g_ipiRecieveTimes[LOSCFG_KERNEL_CORE_NUM] = { 0 };
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
static VOID SwtmrF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret, index;
index = ArchCurrCpuid();
g_ipiRecieveTimes[index]++;
ret = LOS_SwtmrDelete(g_szId[index]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i, j;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(1);
for (j = 0; j < LOOP; j++) {
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[i], 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_ipiTriggerTimes++;
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
LOS_TaskDelay(1);
PRINTK("sent %u time\n", g_ipiTriggerTimes);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
PRINTK(" cpu%d recieved %u times\n", i, g_ipiRecieveTimes[i]);
}
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (j + 1), g_testCount, EXIT);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
ret = LOS_SwtmrDelete(g_szId[i]);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
}
}
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
PRINT_DEBUG("---%d---\n", g_szId[i]);
LOS_SwtmrDelete(g_szId[i]);
}
return LOS_OK;
}
VOID ItSmpLosHwiIpi007(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID SwtmrF01(void)
{
LOS_AtomicDec(&g_testCount);
}
static VOID HwiF01(void)
{
UINT32 ret, id;
id = ArchCurrCpuid() % 3; // 3, Get the current CPU
switch (id) {
case 0:
LOS_SwtmrStart(g_swTmrID);
break;
case 1:
LOS_SwtmrDelete(g_swTmrID);
break;
case 2: // 2, when id is 2
LOS_SwtmrStop(g_swTmrID);
break;
default:
break;
}
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
LOS_TaskDelay(1);
for (i = 0; i < LOOP; i++) {
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_swTmrID, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (i + 1), g_testCount, EXIT);
LOS_SwtmrDelete(g_swTmrID);
}
TEST_HwiDelete(HWI_NUM_INT11);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
LOS_SwtmrDelete(g_swTmrID);
return LOS_OK;
}
VOID ItSmpLosHwiIpi008(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiIpi008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
TestHwiTrigger(HWI_NUM_TEST);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT12);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT12);
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid();
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT12); // currernt cpu;
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_INT12);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT12);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItSmpLosHwiNest001(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
extern EVENT_CB_S g_event;
static VOID HwiF02(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
TestHwiTrigger(HWI_NUM_TEST);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT12);
LOS_EventWrite(&g_event, 0x1 << (ArchCurrCpuid()));
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
LOS_EventInit(&g_event);
HalIrqUnmask(HWI_NUM_INT12);
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
ret = LOS_EventRead(&g_event, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
ICUNIT_GOTO_EQUAL(ret, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, ret, EXIT);
g_targetCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; // other cpu
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT12);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
EXIT:
TEST_HwiDelete(HWI_NUM_INT12);
TEST_HwiDelete(HWI_NUM_TEST);
LOS_EventDestroy(&g_event);
return LOS_OK;
}
VOID ItSmpLosHwiNest002(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
TestHwiTrigger(HWI_NUM_TEST1);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_TEST);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
}
VOID ItSmpLosHwiNest003(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST1);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
#endif
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
#ifndef TEST1980
TestHwiTrigger(HWI_NUM_TEST);
#else
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
#endif
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_TEST);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
}
VOID ItSmpLosHwiNest004(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,116 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT12);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
HalIrqUnmask(HWI_NUM_INT12);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
HalIrqUnmask(HWI_NUM_INT12);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid(); // current cpu
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_INT12);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_INT12);
return LOS_OK;
}
VOID ItSmpLosHwiNest005(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
HalIrqSendIpi(((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM) + 1, HWI_NUM_INT12);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
HalIrqUnmask(HWI_NUM_INT12);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
HalIrqUnmask(HWI_NUM_INT12);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid(); // current cpu
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_INT12);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_INT12);
return LOS_OK;
}
VOID ItSmpLosHwiNest006(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT11); // currernt cpu;
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid();
TestHwiTrigger(HWI_NUM_TEST1);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
}
VOID ItSmpLosHwiNest007(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#if (LOSCFG_KERNEL_SMP == YES)
static UINT32 g_targetCpuid;
static VOID HwiF02(void)
{
HalIrqSendIpi(CPUID_TO_AFFI_MASK((g_targetCpuid + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_INT11); // other cpu;
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
TestDumpCpuid();
return;
}
static VOID TaskF01(void)
{
HalIrqUnmask(HWI_NUM_INT11);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i;
g_testCount = 0;
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
g_targetCpuid = 0;
HalIrqUnmask(HWI_NUM_INT11);
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
g_targetCpuid = ArchCurrCpuid();
TestHwiTrigger(HWI_NUM_TEST1);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
EXIT:
TEST_HwiDelete(HWI_NUM_INT11);
TEST_HwiDelete(HWI_NUM_TEST1);
return LOS_OK;
}
VOID ItSmpLosHwiNest008(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiNest008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
UINT32 ret;
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare001(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
UINT32 ret;
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare002(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
TestHwiTrigger(HWI_NUM_TEST);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare003(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,111 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
TestDumpCpuid();
TestHwiTrigger(HWI_NUM_TEST);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare004(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,113 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
UINT32 ret;
TestDumpCpuid();
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
g_testCount = 0;
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(1);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0xff, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare005(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev1, g_dev2;
extern EVENT_CB_S g_event;
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID HwiF02(void)
{
LOS_AtomicAdd(&g_testCount, 0xff);
}
static VOID TaskF01(void)
{
UINT32 ret;
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
LOS_EventWrite(&g_event, 0x1);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
g_testCount = 0;
LOS_EventInit(&g_event);
g_dev1.pDevId = (void *)1;
g_dev1.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
g_dev2.pDevId = (void *)2; // 2, Set device ID
g_dev2.swIrq = HWI_NUM_TEST;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_EventRead(&g_event, 0x1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
ICUNIT_GOTO_EQUAL(ret, 0x1, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 0xff, g_testCount, EXIT);
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
LOS_EventDestroy(&g_event);
return LOS_OK;
EXIT:
LOS_EventDestroy(&g_event);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
return LOS_OK;
}
VOID ItSmpLosHwiShare006(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
extern EVENT_CB_S g_event;
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev[LOSCFG_KERNEL_CORE_NUM];
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF02(VOID)
{
TestHwiTrigger(HWI_NUM_TEST);
LOS_EventWrite(&g_event, 0x1 << LOSCFG_KERNEL_CORE_NUM);
TestDumpCpuid();
return;
}
static VOID TaskF01(UINTPTR devIndex)
{
UINT32 ret;
// 3, Set the interrupt priority
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[devIndex]));
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
ret = LOS_EventWrite(&g_event, 0x1 << devIndex);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
UINT32 i;
g_testCount = 0;
LOS_EventInit(&g_event);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
g_dev[i].pDevId = (void *)(i + 1);
g_dev[i].swIrq = HWI_NUM_TEST;
}
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT(testTask, "it_hwi_share_task", TaskF01,
TASK_PRIO_TEST + 1); // not set cpuaffi
testTask.auwArgs[0] = i;
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
ret = LOS_EventRead(&g_event, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
ICUNIT_GOTO_EQUAL(ret, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, ret, EXIT);
TEST_TASK_PARAM_INIT(testTask, "it_hwi_share_task", TaskF02,
TASK_PRIO_TEST + 1); // not set cpuaffi
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_EventRead(&g_event, (0x1 << (LOSCFG_KERNEL_CORE_NUM + 1)) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
ICUNIT_GOTO_EQUAL(ret, (0x1 << (LOSCFG_KERNEL_CORE_NUM + 1)) - 1, ret, EXIT);
LOS_TaskDelay(2); // 2, set delay time
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM, g_testCount, EXIT);
EXIT:
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[i]));
}
LOS_EventDestroy(&g_event);
return LOS_OK;
}
VOID ItSmpLosHwiShare007(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static UINT32 g_ret = 0;
static HwiIrqParam g_dev;
static VOID HwiF01(void)
{
TEST_HwiClear(HWI_NUM_TEST);
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01()
{
UINT32 ret;
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev); // 3, Set the interrupt priority
g_ret |= ret;
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i, j;
g_dev.pDevId = (void *)(1);
g_dev.swIrq = HWI_NUM_TEST;
for (j = 0; j < LOOP; j++) {
g_testCount = 0;
g_ret = 0;
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1,
CPUID_TO_AFFI_MASK(i));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(1);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
}
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
return LOS_OK;
}
VOID ItSmpLosHwiShare008(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev;
static UINT32 g_ret = 0;
static VOID HwiF01(void)
{
TEST_HwiClear(HWI_NUM_TEST);
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01()
{
UINT32 ret;
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
g_ret |= ret;
TestDumpCpuid();
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid;
UINT32 i, j;
g_dev.pDevId = (void *)(1);
g_dev.swIrq = HWI_NUM_TEST;
for (j = 0; j < LOOP; j++) {
g_testCount = 0;
g_ret = 0;
// 3, Set the interrupt priority
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1,
CPUID_TO_AFFI_MASK(i));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(1);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(1);
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
}
return LOS_OK;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
return LOS_OK;
}
VOID ItSmpLosHwiShare009(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,138 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_smp_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifndef LOSCFG_NO_SHARED_IRQ
static HwiIrqParam g_dev[3]; // 3, Three devices
static VOID HwiF01(void)
{
LOS_AtomicInc(&g_testCount);
}
static VOID TaskF01()
{
UINT32 ret, index, i;
index = ArchCurrCpuid();
switch (index) {
case 0:
for (i = 0; i < LOOP; i++) {
// 3, Set the interrupt priority
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[0]));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[0]));
TestDumpCpuid();
}
break;
case 1:
for (i = 0; i < LOOP; i++) {
// 3, Set the interrupt priority
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[1]));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[1]));
TestDumpCpuid();
}
break;
case 2: // 2, when CPU id is
for (i = 0; i < LOOP; i++) {
// 3, Set the interrupt priority; 2, index
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[2]));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[2])); // 2, index
TestDumpCpuid();
}
break;
default:
TestDumpCpuid();
break;
}
return;
EXIT:
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[0]));
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[1]));
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[2])); // 2, index
return;
}
static UINT32 Testcase(void)
{
TSK_INIT_PARAM_S testTask;
UINT32 ret, testid, currCpuid;
UINT32 i;
g_testCount = 0;
for (i = 0; i < 3; i++) { // 3, max index
g_dev[i].pDevId = (void *)(i + 1);
g_dev[i].swIrq = HWI_NUM_TEST;
}
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1, CPUID_TO_AFFI_MASK(i));
ret = LOS_TaskCreate(&testid, &testTask);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}
LOS_TaskDelay(100); // 100, set delay time
for (i = 0; i < 3; i++) { // 3, max index
ret = LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[i]));
PRINT_DEBUG("ret = 0x%x\n", ret);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
}
return LOS_OK;
}
VOID ItSmpLosHwiShare010(VOID)
{
TEST_ADD_CASE("ItSmpLosHwiShare010", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define RECORD_SIZE 100
UINT32 g_intrTrace[RECORD_SIZE];
UINT32 g_traceIdx = 0;
UINT32 g_intrHandleEnd = 0;
VOID RecordIntrTrace(INT32 irq, INT32 direction)
{
g_intrTrace[g_traceIdx++] = irq | (direction << 31); // 31, Bit shift mark.
}
VOID ResetIntrTrace(VOID)
{
g_traceIdx = 0;
memset(g_intrTrace, 0, RECORD_SIZE);
}
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num)
{
UINT32 ret = LOS_OK;
INT32 idx = 0;
if ((expect == NULL) || (num > RECORD_SIZE)) {
return LOS_NOK;
}
for (; idx < g_traceIdx; idx++) {
if (expect[idx] != g_intrTrace[idx]) {
ret = LOS_NOK;
break;
}
}
if (ret == LOS_NOK) {
for (idx = 0; idx < g_traceIdx; idx++) {
dprintf("%u ", g_intrTrace[idx]);
}
}
dprintf("\n");
return ret;
}
VOID ItSuiteHwiNesting(VOID)
{
#if defined(LOSCFG_TEST_FULL)
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
ItLosHwiNest001();
ItLosHwiNest002();
ItLosHwiNest003();
ItLosHwiNest004();
ItLosHwiNest005();
ItLosHwiNest006();
ItLosHwiNest007();
#endif
#endif
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "osTest.h"
#include "los_hwi.h"
#include "gic_common.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define HIGHT_PRIO_INTR 100
#define MIDDLE_PRIO_INTR 101
#define LOW_PRIO_INTR 102
#define SPI_HIGHT_PRIO 0
#define SPI_MIDDLE_PRIO ((GIC_MAX_INTERRUPT_PREEMPTION_LEVEL - 2) << PRIORITY_SHIFT)
#define SPI_LOW_PRIO MIN_INTERRUPT_PRIORITY
#define INTR_ENTRY 0
#define INTR_EXIT 1
extern UINT32 g_intrHandleEnd;
VOID RecordIntrTrace(INT32 irq, INT32 direction);
VOID ResetIntrTrace(VOID);
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num);
VOID ItLosHwiNest001(VOID);
VOID ItLosHwiNest002(VOID);
VOID ItLosHwiNest003(VOID);
VOID ItLosHwiNest004(VOID);
VOID ItLosHwiNest005(VOID);
VOID ItLosHwiNest006(VOID);
VOID ItLosHwiNest007(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,127 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
/* low in -> middle in -> hight in -> hight out -> middle out -> low out */
static UINT32 g_expect[] = {
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR
};
static VOID NestingPrioLow(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
while (nestingDelay-- > 0) {
}
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
g_intrHandleEnd = 1;
}
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
while (nestingDelay-- > 0) {
}
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
}
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqUnmask(MIDDLE_PRIO_INTR);
HalIrqUnmask(LOW_PRIO_INTR);
HalIrqPending(LOW_PRIO_INTR);
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
HalIrqMask(MIDDLE_PRIO_INTR);
HalIrqMask(LOW_PRIO_INTR);
g_intrHandleEnd = 0;
ResetIntrTrace();
return LOS_OK;
}
VOID ItLosHwiNest001(VOID)
{
TEST_ADD_CASE("ItLosHwiNest001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
/* middle in -> middle out -> low in -> hight in -> hight out -> low out */
static UINT32 g_expect[] = {
MIDDLE_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
LOW_PRIO_INTR,
HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR
};
static VOID NestingPrioLow(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
while (nestingDelay-- > 0);
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
g_intrHandleEnd = 1;
}
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
while (nestingDelay-- > 0);
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
}
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqUnmask(MIDDLE_PRIO_INTR);
HalIrqUnmask(LOW_PRIO_INTR);
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
HalIrqMask(MIDDLE_PRIO_INTR);
HalIrqMask(LOW_PRIO_INTR);
g_intrHandleEnd = 0;
ResetIntrTrace();
return LOS_OK;
}
VOID ItLosHwiNest002(VOID)
{
TEST_ADD_CASE("ItLosHwiNest002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
/* hight in -> hight out -> middle in -> middle out -> low in -> low out */
static UINT32 g_expect[] = {
HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
MIDDLE_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
LOW_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR
};
static VOID NestingPrioLow(INT32 irq, VOID *data)
{
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
g_intrHandleEnd = 1;
}
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
while (nestingDelay-- > 0) {
}
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
}
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
while (nestingDelay-- > 0) {
}
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqUnmask(MIDDLE_PRIO_INTR);
HalIrqUnmask(LOW_PRIO_INTR);
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
HalIrqMask(MIDDLE_PRIO_INTR);
HalIrqMask(LOW_PRIO_INTR);
g_intrHandleEnd = 0;
ResetIntrTrace();
return LOS_OK;
}
VOID ItLosHwiNest003(VOID)
{
TEST_ADD_CASE("ItLosHwiNest003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
/* middle in -> middle out -> low in -> low out -> hight in -> hight out */
static UINT32 g_expect[] = {
MIDDLE_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
LOW_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR,
HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR
};
static VOID NestingPrioLow(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
while (nestingDelay-- > 0);
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
g_intrHandleEnd = 1;
}
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
while (nestingDelay-- > 0);
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
}
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
LOS_HwiCreate(LOW_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqUnmask(MIDDLE_PRIO_INTR);
HalIrqUnmask(LOW_PRIO_INTR);
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
HalIrqMask(MIDDLE_PRIO_INTR);
HalIrqMask(LOW_PRIO_INTR);
g_intrHandleEnd = 0;
ResetIntrTrace();
return LOS_OK;
}
VOID ItLosHwiNest004(VOID)
{
TEST_ADD_CASE("ItLosHwiNest004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,143 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
/* low in -> middle in -> hight in -> hight out -> middle out -> low out */
/* loop trigger */
static UINT32 g_expect[] = {
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR,
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR,
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
0x80000000 | HIGHT_PRIO_INTR,
0x80000000 | MIDDLE_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR,
LOW_PRIO_INTR,
0x80000000 | LOW_PRIO_INTR,
};
static VOID NestingPrioLow(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
if (g_intrHandleEnd < 3) { // 3, Interrupt callback function count.
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
}
while (nestingDelay-- > 0) {
}
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
g_intrHandleEnd++;
}
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
{
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
while (nestingDelay-- > 0) {
}
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
}
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
HalIrqPending(LOW_PRIO_INTR);
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqUnmask(MIDDLE_PRIO_INTR);
HalIrqUnmask(LOW_PRIO_INTR);
HalIrqPending(LOW_PRIO_INTR);
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
HalIrqMask(MIDDLE_PRIO_INTR);
HalIrqMask(LOW_PRIO_INTR);
g_intrHandleEnd = 0;
ResetIntrTrace();
return LOS_OK;
}
VOID ItLosHwiNest005(VOID)
{
TEST_ADD_CASE("ItLosHwiNest005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
static HwiIrqParam g_nestingPara;
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
g_intrHandleEnd = 1;
UINT32 temp[0x100][2] = {0};
memset(temp, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
}
static VOID TaskF01(VOID)
{
HalIrqUnmask(HIGHT_PRIO_INTR);
HalIrqPending(HIGHT_PRIO_INTR);
}
static UINT32 Testcase(VOID)
{
UINT32 ret, taskID;
TSK_INIT_PARAM_S task1 = { 0 };
// 4, Task priority calculation.
TEST_TASK_PARAM_INIT(task1, "ItLosHwiNest010", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST - 4);
task1.uwStackSize = 0x2000;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
ret = LOS_TaskCreate(&taskID, &task1);
while (g_intrHandleEnd == 0) {
LOS_TaskDelay(10); // 10, set delay time.
}
ICUNIT_GOTO_EQUAL(g_intrHandleEnd, 1, g_intrHandleEnd, EXIT);
EXIT:
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
g_intrHandleEnd = 0;
return LOS_OK;
}
VOID ItLosHwiNest006(VOID)
{
TEST_ADD_CASE("ItLosHwiNest006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_hwi_nesting.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
#define MAX_RECORD_SIZE 1000
static HwiIrqParam g_nestingPara;
static INT32 g_saveIndex = 0;
static UINT64 g_intPendTime;
static UINT64 g_recordTime[MAX_RECORD_SIZE] = {0};
static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
UINT64 curTime;
curTime = LOS_CurrNanosec();
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
if (g_saveIndex == MAX_RECORD_SIZE) {
g_saveIndex = 0;
}
dprintf("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
dprintf("%lld\n", curTime - g_intPendTime);
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
g_saveIndex++;
}
static VOID DumpResult()
{
UINT32 i, count;
UINT64 avg, sum;
sum = 0;
count = 0;
for (i = 0; i < MAX_RECORD_SIZE; i++) {
if (g_recordTime[i] != 0) {
dprintf("%lld ");
sum += g_recordTime[i];
count++;
}
}
avg = sum / count;
dprintf("***hwi perf test dump***: \n");
dprintf("avg = %lld \n");
}
static VOID SwtmrF01(VOID)
{
g_intPendTime = LOS_CurrNanosec();
HalIrqPending(HIGHT_PRIO_INTR);
}
static UINT32 Testcase(VOID)
{
UINT32 ret, swtmrId;
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
HalIrqUnmask(HIGHT_PRIO_INTR);
// 10, Timing duration of the software timer to be created.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swtmrId,
0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
LOS_SwtmrStart(swtmrId);
/* EXIT time control */
LOS_TaskDelay(100); // 100, set delay time.
LOS_SwtmrStop(swtmrId);
DumpResult();
EXIT:
LOS_SwtmrDelete(swtmrId);
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
HalIrqMask(HIGHT_PRIO_INTR);
return LOS_OK;
}
VOID ItLosHwiNest007(VOID)
{
TEST_ADD_CASE("ItLosHwiNest007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,197 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
EVENT_CB_S g_eventCB1, g_eventCB2, g_eventCB3;
VOID ItSuiteLosSwtmr(VOID)
{
int ret = LOS_SetProcessScheduler(LOS_GetCurrProcessID(), LOS_SCHED_RR, TASK_PRIO_TEST_SWTMR);
if (ret != LOS_OK) {
dprintf("%s set test process schedule failed! %d\n", ret);
}
ret = LOS_SetTaskScheduler(LOS_CurTaskIDGet(), LOS_SCHED_RR, TASK_PRIO_TEST_SWTMR);
if (ret != LOS_OK) {
dprintf("%s set test task schedule failed! %d\n", ret);
}
#if defined(LOSCFG_TEST_SMOKE)
ItLosSwtmr053();
ItLosSwtmr058();
#endif
#if (LOSCFG_KERNEL_SMP == YES)
ItSmpLosSwtmr001(); /* Concurrent Multi-core */
ItSmpLosSwtmr002(); /* Stop Across Cores */
ItSmpLosSwtmr003();
ItSmpLosSwtmr004();
ItSmpLosSwtmr005();
ItSmpLosSwtmr006();
ItSmpLosSwtmr007();
ItSmpLosSwtmr008();
ItSmpLosSwtmr009();
ItSmpLosSwtmr010();
ItSmpLosSwtmr011();
ItSmpLosSwtmr012();
ItSmpLosSwtmr013();
ItSmpLosSwtmr014();
ItSmpLosSwtmr015();
ItSmpLosSwtmr016();
ItSmpLosSwtmr017();
ItSmpLosSwtmr018();
ItSmpLosSwtmr019();
ItSmpLosSwtmr020();
ItSmpLosSwtmr021();
ItSmpLosSwtmr022();
ItSmpLosSwtmr023();
ItSmpLosSwtmr024();
ItSmpLosSwtmr025();
ItSmpLosSwtmr026();
ItSmpLosSwtmr027();
ItSmpLosSwtmr028();
ItSmpLosSwtmr029();
ItSmpLosSwtmr030();
ItSmpLosSwtmr031();
ItSmpLosSwtmr032();
ItSmpLosSwtmr033();
ItSmpLosSwtmr034();
ItSmpLosSwtmr035();
#endif
#if defined(LOSCFG_TEST_FULL)
ItLosSwtmr001();
ItLosSwtmr002();
ItLosSwtmr003();
ItLosSwtmr005();
ItLosSwtmr006();
ItLosSwtmr007();
ItLosSwtmr008();
ItLosSwtmr009();
ItLosSwtmr010();
ItLosSwtmr011();
ItLosSwtmr012();
ItLosSwtmr013();
ItLosSwtmr014();
ItLosSwtmr015();
ItLosSwtmr016();
ItLosSwtmr017();
ItLosSwtmr018();
ItLosSwtmr019();
ItLosSwtmr020();
ItLosSwtmr021();
ItLosSwtmr022();
ItLosSwtmr030();
ItLosSwtmr033();
ItLosSwtmr036();
ItLosSwtmr037();
ItLosSwtmr039();
ItLosSwtmr040();
ItLosSwtmr041();
ItLosSwtmr042();
ItLosSwtmr043();
ItLosSwtmr044();
ItLosSwtmr045();
ItLosSwtmr046();
ItLosSwtmr047();
ItLosSwtmr048();
ItLosSwtmr049();
ItLosSwtmr050();
ItLosSwtmr051();
ItLosSwtmr052();
ItLosSwtmr054();
ItLosSwtmr055();
ItLosSwtmr056();
ItLosSwtmr057();
ItLosSwtmr059();
ItLosSwtmr060();
ItLosSwtmr061();
ItLosSwtmr062();
ItLosSwtmr063();
ItLosSwtmr064();
ItLosSwtmr065();
ItLosSwtmr066();
ItLosSwtmr067();
ItLosSwtmr068();
ItLosSwtmr069();
ItLosSwtmr070();
ItLosSwtmr071();
ItLosSwtmr075();
ItLosSwtmr076();
ItLosSwtmr077();
ItLosSwtmr078();
#endif
#if defined(LOSCFG_TEST_PRESSURE)
ItLosSwtmr004();
ItLosSwtmr024();
ItLosSwtmr025();
ItLosSwtmr026();
ItLosSwtmr027();
ItLosSwtmr028();
ItLosSwtmr029();
ItLosSwtmr031();
ItLosSwtmr032();
ItLosSwtmr034();
ItLosSwtmr035();
ItLosSwtmr038();
#endif
#if defined(LOSCFG_TEST_LLT)
ItLosSwtmr073();
#if !defined(TESTPBXA9) && !defined(TESTVIRTA53) && !defined(TEST3516DV300) && !defined(TESTHI1980IMU)
ItLosSwtmr072(); // SwtmrTimeGet
ItLosSwtmr074(); // across cores
ItLosSwtmr079(); // sched_clock_swtmr
#endif
ItLosSwtmr080();
ItLosSwtmr023();
#endif
ret = LOS_SetProcessScheduler(LOS_GetCurrProcessID(), LOS_SCHED_RR, 20); // 20, set a reasonable priority.
if (ret != LOS_OK) {
dprintf("%s set test process schedule failed! %d\n", ret);
}
ret = LOS_SetTaskScheduler(LOS_CurTaskIDGet(), LOS_SCHED_RR, TASK_PRIO_TEST);
if (ret != LOS_OK) {
dprintf("%s set test task schedule failed! %d\n", ret);
}
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,213 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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.
*/
#ifndef IT_LOS_SWTMR_H
#define IT_LOS_SWTMR_H
#include "los_swtmr.h"
#include "osTest.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define LOOP 100
#define SELF_DELETED 0
#define SYS_EXIST_SWTMR 1
#define SWTMR_LOOP_NUM 10
#define TEST_HWI_RUNTIME 0x100000
extern EVENT_CB_S g_eventCB1;
extern EVENT_CB_S g_eventCB2;
extern EVENT_CB_S g_eventCB3;
extern LITE_OS_SEC_BSS SWTMR_CTRL_S *m_pstSwtmrFreeList;
static UINT32 g_swTmrMaxNum;
static UINT16 g_swTmrID1;
static UINT16 g_swTmrID2;
static UINT16 g_swTmrID3;
static UINT32 g_swtmrCountA;
static UINT32 g_swtmrCountB;
static UINT32 g_swtmrCountC;
static UINT64 g_cpuTickCountA;
static UINT64 g_cpuTickCountB;
extern UINT32 OsSwTmrGetNextTimeout(VOID);
extern UINT32 OsSwtmrTimeGet(SWTMR_CTRL_S *swtmr);
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
extern VOID ItSuiteLosSwtmr(VOID);
#if defined(LOSCFG_KERNEL_SMP)
VOID ItSmpLosSwtmr001(VOID);
VOID ItSmpLosSwtmr002(VOID);
VOID ItSmpLosSwtmr003(VOID);
VOID ItSmpLosSwtmr004(VOID);
VOID ItSmpLosSwtmr005(VOID);
VOID ItSmpLosSwtmr006(VOID);
VOID ItSmpLosSwtmr007(VOID);
VOID ItSmpLosSwtmr008(VOID);
VOID ItSmpLosSwtmr009(VOID);
VOID ItSmpLosSwtmr010(VOID);
VOID ItSmpLosSwtmr011(VOID);
VOID ItSmpLosSwtmr012(VOID);
VOID ItSmpLosSwtmr013(VOID);
VOID ItSmpLosSwtmr014(VOID);
VOID ItSmpLosSwtmr015(VOID);
VOID ItSmpLosSwtmr016(VOID);
VOID ItSmpLosSwtmr017(VOID);
VOID ItSmpLosSwtmr018(VOID);
VOID ItSmpLosSwtmr019(VOID);
VOID ItSmpLosSwtmr020(VOID);
VOID ItSmpLosSwtmr021(VOID);
VOID ItSmpLosSwtmr022(VOID);
VOID ItSmpLosSwtmr023(VOID);
VOID ItSmpLosSwtmr024(VOID);
VOID ItSmpLosSwtmr025(VOID);
VOID ItSmpLosSwtmr026(VOID);
VOID ItSmpLosSwtmr027(VOID);
VOID ItSmpLosSwtmr028(VOID);
VOID ItSmpLosSwtmr029(VOID);
VOID ItSmpLosSwtmr030(VOID);
VOID ItSmpLosSwtmr031(VOID);
VOID ItSmpLosSwtmr032(VOID);
VOID ItSmpLosSwtmr033(VOID);
VOID ItSmpLosSwtmr034(VOID);
VOID ItSmpLosSwtmr035(VOID);
#endif
#if defined(LOSCFG_TEST_SMOKE)
VOID ItLosSwtmr053(VOID);
VOID ItLosSwtmr058(VOID);
#endif
#if defined(LOSCFG_TEST_FULL)
VOID ItLosSwtmr001(VOID);
VOID ItLosSwtmr002(VOID);
VOID ItLosSwtmr003(VOID);
VOID ItLosSwtmr005(VOID);
VOID ItLosSwtmr006(VOID);
VOID ItLosSwtmr007(VOID);
VOID ItLosSwtmr008(VOID);
VOID ItLosSwtmr009(VOID);
VOID ItLosSwtmr010(VOID);
VOID ItLosSwtmr011(VOID);
VOID ItLosSwtmr012(VOID);
VOID ItLosSwtmr013(VOID);
VOID ItLosSwtmr014(VOID);
VOID ItLosSwtmr015(VOID);
VOID ItLosSwtmr016(VOID);
VOID ItLosSwtmr017(VOID);
VOID ItLosSwtmr018(VOID);
VOID ItLosSwtmr019(VOID);
VOID ItLosSwtmr020(VOID);
VOID ItLosSwtmr021(VOID);
VOID ItLosSwtmr022(VOID);
VOID ItLosSwtmr030(VOID);
VOID ItLosSwtmr033(VOID);
VOID ItLosSwtmr036(VOID);
VOID ItLosSwtmr037(VOID);
VOID ItLosSwtmr038(VOID);
VOID ItLosSwtmr039(VOID);
VOID ItLosSwtmr040(VOID);
VOID ItLosSwtmr041(VOID);
VOID ItLosSwtmr042(VOID);
VOID ItLosSwtmr043(VOID);
VOID ItLosSwtmr044(VOID);
VOID ItLosSwtmr045(VOID);
VOID ItLosSwtmr046(VOID);
VOID ItLosSwtmr047(VOID);
VOID ItLosSwtmr048(VOID);
VOID ItLosSwtmr049(VOID);
VOID ItLosSwtmr050(VOID);
VOID ItLosSwtmr051(VOID);
VOID ItLosSwtmr052(VOID);
VOID ItLosSwtmr054(VOID);
VOID ItLosSwtmr055(VOID);
VOID ItLosSwtmr056(VOID);
VOID ItLosSwtmr057(VOID);
VOID ItLosSwtmr059(VOID);
VOID ItLosSwtmr060(VOID);
VOID ItLosSwtmr061(VOID);
VOID ItLosSwtmr062(VOID);
VOID ItLosSwtmr063(VOID);
VOID ItLosSwtmr064(VOID);
VOID ItLosSwtmr065(VOID);
VOID ItLosSwtmr066(VOID);
VOID ItLosSwtmr067(VOID);
VOID ItLosSwtmr068(VOID);
VOID ItLosSwtmr069(VOID);
VOID ItLosSwtmr070(VOID);
VOID ItLosSwtmr071(VOID);
VOID ItLosSwtmr075(VOID);
VOID ItLosSwtmr076(VOID);
VOID ItLosSwtmr077(VOID);
VOID ItLosSwtmr078(VOID);
#endif
#if defined(LOSCFG_TEST_PRESSURE)
VOID ItLosSwtmr004(VOID);
VOID ItLosSwtmr024(VOID);
VOID ItLosSwtmr025(VOID);
VOID ItLosSwtmr026(VOID);
VOID ItLosSwtmr027(VOID);
VOID ItLosSwtmr028(VOID);
VOID ItLosSwtmr029(VOID);
VOID ItLosSwtmr031(VOID);
VOID ItLosSwtmr032(VOID);
VOID ItLosSwtmr034(VOID);
VOID ItLosSwtmr035(VOID);
VOID ItLosSwtmr081(VOID);
VOID ItLosSwtmr082(VOID);
VOID ItLosSwtmr083(VOID);
#endif
#if defined(LOSCFG_TEST_LLT)
VOID ItLosSwtmr072(VOID);
VOID ItLosSwtmr073(VOID);
VOID ItLosSwtmr074(VOID);
VOID ItLosSwtmr079(VOID);
VOID ItLosSwtmr080(VOID);
VOID ItLosSwtmr023(VOID);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* IT_LOS_SWTMR_H */

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
ret = LOS_TaskDelay(5); // 5, set delay time
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
#if SELF_DELETED
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr001(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr001", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xabcdbcda) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xabcdbcda);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, The expected value
return LOS_OK;
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr002(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr002", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, NULL, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_RET_PTR_NULL, ret, EXIT);
ret = LOS_SwtmrCreate(0, 0, NULL, &swTmrID, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_INTERVAL_NOT_SUITED, ret, EXIT);
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, NULL, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_PTR_NULL, ret, EXIT);
ret = LOS_SwtmrCreate(0, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_INTERVAL_NOT_SUITED, ret, EXIT);
// 4, Timeout interval of a periodic software timer. 3, test mode
ret = LOS_SwtmrCreate(4, 3, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_MODE_INVALID, ret, EXIT);
return LOS_OK;
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr003(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr003", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
ret = LOS_SwtmrCreate(0x8000, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr005(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr005", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
ret = LOS_SwtmrCreate(0x7fff, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr006(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr006", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr007(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr007", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr008(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr008", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID = OS_SWTMR_MAX_TIMERID;
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_ID_INVALID, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr009(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr009", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr010(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr010", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount);
return LOS_OK;
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr011(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr011", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
if (arg != 0xffff) {
return;
}
#if SELF_DELETED
ret = LOS_SwtmrDelete(g_testTaskID01);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
#endif
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
g_testTaskID01 = swTmrID;
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
#if SELF_DELETED
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
}
VOID ItLosSwtmr012(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr012", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr013(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr013", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID = OS_SWTMR_MAX_TIMERID;
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_ID_INVALID, ret, EXIT);
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr014(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr014", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
#if SELF_DELETED
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
}
VOID ItLosSwtmr015(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr015", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xabcdbcda) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xabcdbcda);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr016(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr016", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,80 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
ret = LOS_SwtmrCreate(0x8000, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr017(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr017", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
ret = LOS_SwtmrCreate(0x8000, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr018(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr018", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
return LOS_OK;
}
VOID ItLosSwtmr019(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr019", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
if (arg != 0xffff) {
return;
}
#if SELF_DELETED
ret = LOS_SwtmrStart(g_testTaskID01);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
#endif
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
g_testTaskID01 = swTmrID;
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
#if SELF_DELETED
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
#else
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
#endif
EXIT:
#if SELF_DELETED
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
}
VOID ItLosSwtmr020(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr020", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
if (arg != 0xffff) {
return;
}
#if SELF_DELETED
ret = LOS_SwtmrStart(g_testTaskID01);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
#endif
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
g_testTaskID01 = swTmrID;
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
EXIT:
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr021(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr021", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,120 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (g_testCount != 2) { // 2, Execute if g_testCount is 2
return;
}
g_testCount++;
return;
}
static VOID HwiF01(VOID)
{
UINT32 ret;
UINT32 hwiNum;
#ifdef TEST3516A
hwiNum = HWI_NUM_INT32;
#elif defined TEST3518E || defined TEST3516CV300
hwiNum = HWI_NUM_INT31;
#elif defined TEST3559
hwiNum = HWI_NUM_INT32;
#elif defined TEST3559A
hwiNum = HWI_NUM_INT69;
#elif defined TEST3559A_M7
hwiNum = HWI_NUM_INT11;
#elif defined TESTPBXA9 || defined TESTVIRTA53
hwiNum = HWI_NUM_INT60;
#elif defined TEST3516DV300
hwiNum = HWI_NUM_INT60;
#endif
TEST_HwiClear(HWI_NUM_TEST3);
g_testCount++;
// 2, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_ONCE, SwtmrF01, &g_swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST3, 1, 0, HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST3);
TestExtraTaskDelay(2); // 2, set delay time
ret = LOS_SwtmrStart(g_swTmrID1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(5); // 5, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, The expected value
EXIT:
TEST_HwiDelete(HWI_NUM_TEST3);
#if SELF_DELETED
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
}
VOID ItLosSwtmr022(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr022", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,92 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
LOS_AtomicInc(&g_testCount);
}
static VOID SwtmrF02(UINT32 arg)
{
LOS_AtomicInc(&g_testCount);
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1;
UINT16 swTmrID2;
int value;
g_testCount = 0;
// 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF02, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
// 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID2, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
HAL_READ_UINT32(&g_testCount, value);
while (value < 4) { // 4, if value < 4, to do
HAL_READ_UINT32(&g_testCount, value);
}
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr030(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr030", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID HwiF01(VOID)
{
UINT32 index;
TEST_HwiClear(HWI_NUM_TEST);
for (index = 0; index < TEST_HWI_RUNTIME; index++) {
}
g_testCount = 10; // 10Set the number to determine whether the process is as expected.
}
static VOID SwtmrF01(UINT32 arg)
{
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 20, g_testCount); // 20, The expected value
g_testCount++;
}
static VOID SwtmrF02(UINT32 arg)
{
UINT32 index;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 10, g_testCount); // 10, The expected value
for (index = 0; index < 0x1000; index++) {
}
g_testCount = 20; // 20 Set the number to determine whether the process is as expected.
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1;
UINT16 swTmrID2;
int value;
UINT64 tickstart;
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF02, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
// 2, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID2, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);
HAL_READ_UINT32(&g_testCount, value);
tickstart = LOS_TickCountGet();
while (value != 21) { // 21, The expected value is not 21, execute
HAL_READ_UINT32(&g_testCount, value);
if (LOS_TickCountGet() - tickstart > 0xff) {
ICUNIT_GOTO_EQUAL(g_testCount, 21, g_testCount, EXIT); // 21, The expected value
}
}
EXIT:
LOS_SwtmrDelete(swTmrID1);
LOS_SwtmrDelete(swTmrID2);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItLosSwtmr033(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr033", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart((swTmrID + 1));
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
#if SELF_DELETED
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr036(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr036", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1;
g_testCount = 0;
ret = LOS_SwtmrCreate(LOS_Tick2MS(1), LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart((swTmrID1 + 1));
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskDelay(12); // 12, set delay time
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
if (g_testCount < 10) { // 10, if g_testCount < 10 set a erro code, then exit
ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); // 10, if g_testCount < 10 set a erro code, then exit
}
EXIT:
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr037(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr037", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST);
ret = LOS_SwtmrStart(g_swTmrID1);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
g_testCount1++;
return;
EXIT:
TEST_HwiDelete(HWI_NUM_TEST);
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_SWTMR_HWI_ACTIVE, ret);
}
static VOID SwtmrF02(UINT32 arg)
{
g_testCount1++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T hwiMode;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF02, &g_swTmrID1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
hwiMode = 0;
ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)SwtmrF01, (HwiIrqParam *)arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(5); // 5, set delay time
ICUNIT_GOTO_EQUAL(g_testCount1, 2, g_testCount1, EXIT5); // 2, The expected value
TEST_HwiDelete(HWI_NUM_TEST);
EXIT5:
#if SELF_DELETED
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#endif
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
EXIT3:
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItLosSwtmr039(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr039", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID HwiF01(UINT32 arg)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST);
ret = LOS_SwtmrStart(g_swTmrID1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
g_testCount1++;
return;
EXIT:
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_SWTMR_HWI_ACTIVE, ret);
TEST_HwiDelete(HWI_NUM_TEST);
}
static VOID SwtmrF02(UINT32 arg)
{
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T hwiMode;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
g_testCount = 0;
// 5, create swtmr.
ret = LOS_SwtmrCreate(LOS_Tick2MS(5), LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF02, &g_swTmrID1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
hwiMode = 0;
ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
ret = LOS_TaskDelay(7); // 7, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
ICUNIT_GOTO_EQUAL(g_testCount1, 1, g_testCount1, EXIT3);
ICUNIT_GOTO_NOT_EQUAL(g_testCount, 0, g_testCount, EXIT3);
TEST_HwiDelete(HWI_NUM_TEST);
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
EXIT3:
LOS_SwtmrDelete(g_swTmrID1);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItLosSwtmr040(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr040", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,136 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
UINT32 ret;
TEST_HwiClear(HWI_NUM_TEST);
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_SwtmrDelete(g_swTmrID2);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
g_testCount1++;
TEST_HwiDelete(HWI_NUM_TEST);
return;
EXIT:
LOS_SwtmrDelete(g_swTmrID1);
LOS_SwtmrDelete(g_swTmrID2);
TEST_HwiDelete(HWI_NUM_TEST);
return;
}
static VOID SwtmrF02(UINT32 arg)
{
g_testCount1++;
return;
}
static VOID SwtmrF03(UINT32 arg)
{
g_testCount1++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T hwiMode = 0;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
TEST_HwiClear(HWI_NUM_TEST);
// 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF03, &g_swTmrID1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
// 20, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(20, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF02, &g_swTmrID2, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)SwtmrF01, (HwiIrqParam *)arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT5);
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
ret = LOS_SwtmrStart(g_swTmrID2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT5);
ret = LOS_SwtmrStart(g_swTmrID1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT5);
TestHwiTrigger(HWI_NUM_TEST);
ret = LOS_TaskDelay(10); // 10, set delay time
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount1, 1, g_testCount1, EXIT5);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
EXIT5:
TEST_HwiDelete(HWI_NUM_TEST);
EXIT3:
LOS_SwtmrDelete(g_swTmrID2);
EXIT:
LOS_SwtmrDelete(g_swTmrID1);
}
VOID ItLosSwtmr041(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr041", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1, swTmrID2;
UINT32 *tick = NULL;
g_testCount = 0;
// 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStop((OS_SWTMR_MAX_TIMERID + 1));
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID1);
return LOS_OK;
}
VOID ItLosSwtmr042(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr042", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
g_testCount1++;
return;
}
static VOID HwiF01(VOID)
{
UINT32 ret;
UINT32 tick;
TEST_HwiClear(HWI_NUM_TEST);
g_testCount1++;
ret = LOS_SwtmrStart(g_swTmrID1);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
ret = LOS_SwtmrStop(g_swTmrID1);
ICUNIT_ASSERT_EQUAL_VOID(ret, 0, ret);
ret = LOS_SwtmrTimeGet(g_swTmrID1, &tick);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_SWTMR_NOT_STARTED, ret);
g_testCount1++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
g_testCount1 = 0;
// 2, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &g_swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
#if (LOSCFG_KERNEL_SMP == YES)
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
#endif
TestHwiTrigger(HWI_NUM_TEST);
ret = LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
ret = LOS_SwtmrDelete(g_swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TEST_HwiDelete(HWI_NUM_TEST);
return LOS_OK;
}
VOID ItLosSwtmr043(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr043", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID;
// 2, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStop(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_STARTED, ret);
ret = LOS_SwtmrDelete(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStop(swTmrID);
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret);
return LOS_OK;
}
VOID ItLosSwtmr044(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr044", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1, swTmrID2;
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID2, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr045(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr045", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1;
g_testCount = 0;
// 2, set swtmr
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_ONCE | LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrStart(swTmrID1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(21); // 21, set delay time
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); // 10, The expected value
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID1);
return LOS_OK;
}
VOID ItLosSwtmr046(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr046", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1 = 0xffff;
g_testCount = 0;
ret = LOS_SwtmrCreate(1, 10, SwtmrF01, &swTmrID1, 0xffff); // 10, Timeout interval of a periodic software timer.
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr047(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr047", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1 = (LOSCFG_BASE_CORE_SWTMR_CONFIG - 1);
UINT16 swTmrID2 = (LOSCFG_BASE_CORE_SWTMR_CONFIG - 1);
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID2, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr048(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr048", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static VOID SwtmrF01(UINT32 arg)
{
if (arg != 0xffff) {
return;
}
g_testCount++;
return;
}
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID1, swTmrID2;
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID1, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID1 + 1);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
g_testCount = 0;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID2, 0xffff);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID2 + 1);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ret = LOS_SwtmrDelete(swTmrID2);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
}
VOID ItLosSwtmr049(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr049", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "It_los_swtmr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT16 swTmrID = OS_SWTMR_MAX_TIMERID;
ret = LOS_SwtmrStart(swTmrID);
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(swTmrID);
return LOS_OK;
}
VOID ItLosSwtmr050(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosSwtmr050", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

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