add l0 testsuits
Change-Id: I523269c97053f484d5cb0d94397269e41eaae86c
This commit is contained in:
parent
4fc4b8c9c1
commit
449f27d5cb
|
@ -0,0 +1,38 @@
|
|||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
|
||||
source_set("test_init") {
|
||||
|
||||
sources = [
|
||||
"src/osTest.c",
|
||||
"src/osTestTask.c",
|
||||
"src/iCunit.c",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//kernel/liteos_m/kernel/include",
|
||||
"//kernel/liteos_m/kernel/base/include",
|
||||
"//build/compiler/arm-none-eabi/linux/arm-none-eabi/include",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include/",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include-fixed/",
|
||||
"//kernel/liteos_m/arch/arm/cortex-m/include",
|
||||
"//kernel/liteos_m/components/cmsis",
|
||||
"//vendor/huawei/watchgt/devkit/hal/include",
|
||||
]
|
||||
}
|
||||
|
||||
lite_component("test") {
|
||||
features = [
|
||||
":test_init",
|
||||
"sample/kernel/event:test_event",
|
||||
"sample/kernel/hwi:test_hwi",
|
||||
"sample/kernel/mem:test_mem",
|
||||
"sample/kernel/mux:test_mux",
|
||||
"sample/kernel/queue:test_queue",
|
||||
"sample/kernel/sem:test_sem",
|
||||
"sample/kernel/swtmr:test_swtmr",
|
||||
"sample/kernel/task:test_task",
|
||||
#"sample/kernel/tickless:test_tickless",
|
||||
]
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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.
|
|
@ -0,0 +1,2 @@
|
|||
objs-y += src
|
||||
objs-y += sample
|
|
@ -0,0 +1,378 @@
|
|||
/*
|
||||
* 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_ICUNIT_H
|
||||
#define _LOS_ICUNIT_H
|
||||
#include "osTest.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)
|
||||
|
||||
typedef iUINT32 (*CASE_FUNCTION)(void);
|
||||
|
||||
typedef struct {
|
||||
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_SEM,
|
||||
TEST_MUX,
|
||||
TEST_EVENT,
|
||||
TEST_QUE,
|
||||
TEST_SWTMR,
|
||||
TEST_HWI,
|
||||
TEST_ATO,
|
||||
TEST_CPUP,
|
||||
TEST_SCATTER,
|
||||
TEST_RUNSTOP,
|
||||
TEST_TIMER,
|
||||
TEST_MMU,
|
||||
TEST_TICKLESS,
|
||||
TEST_ROBIN,
|
||||
TEST_LIBC,
|
||||
TEST_WAIT,
|
||||
TEST_VFAT,
|
||||
TEST_YAFFS,
|
||||
TEST_JFFS,
|
||||
TEST_RAMFS,
|
||||
TEST_NFS,
|
||||
TEST_PROC,
|
||||
TEST_FS,
|
||||
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_SR,
|
||||
TEST_UNAME,
|
||||
TEST_MISC,
|
||||
TEST_EXC,
|
||||
#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,
|
||||
#endif
|
||||
TEST_DRIVERBASE,
|
||||
} LiteOS_test_module;
|
||||
|
||||
typedef enum {
|
||||
TEST_LOS = 0,
|
||||
TEST_CMSIS,
|
||||
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_CONTEXHUB
|
||||
} LiteOS_test_layer;
|
||||
|
||||
typedef enum {
|
||||
TEST_LEVEL0 = 0,
|
||||
TEST_LEVEL1,
|
||||
TEST_LEVEL2,
|
||||
TEST_LEVEL3
|
||||
} LiteOS_test_level;
|
||||
|
||||
typedef enum {
|
||||
TEST_FUNCTION = 0,
|
||||
TEST_PRESSURE,
|
||||
TEST_PERFORMANCE
|
||||
} LiteOS_test_type;
|
||||
|
||||
|
||||
extern iUINT16 iCunit_errLineNo;
|
||||
extern iiUINT32 iCunit_errCode;
|
||||
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
|
||||
|
||||
#define ICUNIT_TRACK_EQUAL(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ICUNIT_TRACK_NOT_EQUAL(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) == (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ICUNIT_ASSERT_EQUAL_VOID(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) == (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
#define ICUNIT_ASSERT_EQUAL(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
return 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ICUNIT_ASSERT_NOT_EQUAL(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) == (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_EQUAL_VOID(param, value, retcode) \
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
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_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((const char *)str1, (const char *)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, value, retcode, label) \
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ICUNIT_GOTO_NOT_EQUAL(param, value, retcode, label) \
|
||||
do { \
|
||||
if ((param) == (value)) { \
|
||||
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)
|
||||
|
||||
extern iUINT32 iCunitAddSuit_F(iCHAR *suitName, iCHAR *pfileName);
|
||||
#define iCunitAddSuit(suitName) iCunitAddSuit_F(suitName, __FILE__)
|
||||
|
||||
extern iUINT32 ICunitAddCase(iCHAR *caseName, CASE_FUNCTION caseFunc, iUINT16 testcaseLayer, iUINT16 testcaseModule,
|
||||
iUINT16 testcaseLevel, iUINT16 testcaseType);
|
||||
|
||||
extern iUINT32 ICunitRun(void);
|
||||
extern iUINT32 ICunitInit(void);
|
||||
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 */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ICUNIT_ICUNIT_INC
|
||||
#define _ICUNIT_ICUNIT_INC
|
||||
|
||||
#include "iCunit_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
ICUNIT_CASE_S iCunit_CaseArray[ICUNIT_CASE_SIZE];
|
||||
ICUNIT_SUIT_S iCunit_SuitArray[ICUNIT_SUIT_SIZE];
|
||||
|
||||
iUINT32 iCunit_Init_Success = 0x0000FFFF;
|
||||
iUINT32 iCunit_Case_Cnt = 0xFFFF;
|
||||
iUINT32 iCunit_Suit_Cnt = 0xFFFF;
|
||||
iUINT32 iCunit_Case_Idx = 0xFFFF;
|
||||
iUINT32 iCunit_Suit_Idx = 0xFFFF;
|
||||
iUINT32 iCunit_Case_FailedCnt = 0;
|
||||
iUINT32 iCunit_Suit_FailedCnt = 0;
|
||||
iUINT32 iCunit_ErrLog_AddSuit = 0;
|
||||
iUINT32 iCunit_ErrLog_AddCase = 0;
|
||||
|
||||
iUINT16 iCunit_errLineNo;
|
||||
iiUINT32 iCunit_errCode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* _UNI_ICUNIT_INC */
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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_CONFIG_H
|
||||
#define _ICUNIT_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
#define ICUNIT_CASE_SIZE 1500
|
||||
#define ICUNIT_SUIT_SIZE 200
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,272 @@
|
|||
/*
|
||||
* 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_DLINK_MEM_H
|
||||
#define _LOS_DLINK_MEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (OS_SYS_MEM_CHECK == YES)
|
||||
#define LOS_DLNK_ENABLE_ALLOC_CHECK
|
||||
#endif
|
||||
|
||||
typedef VOID (*MALLOC_HOOK)(VOID);
|
||||
|
||||
extern MALLOC_HOOK g_mallocHook;
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* Memory pool information structure
|
||||
*/
|
||||
typedef struct {
|
||||
void *pPoolAddr; /* *<Starting address of a memory pool */
|
||||
UINT32 uwPoolSize; /* *<Memory pool size */
|
||||
} LOS_DLNK_POOL_INFO;
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* Memory linked list node structure
|
||||
*/
|
||||
typedef struct tagLOS_DLNK_NODE {
|
||||
LOS_DL_LIST stFreeNodeInfo; /* *<Free memory node */
|
||||
struct tagLOS_DLNK_NODE *pstPreNode; /* *<Pointer to the previous memory node */
|
||||
UINT32 uwSizeAndFlag; /* *<Size and flag of the current node (the highest bit represents a flag, and the rest bits
|
||||
specify the size) */
|
||||
} LOS_DLNK_NODE;
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* @brief Initialize dynamic memory.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize the dynamic memory of a doubly linked list.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Call this API when dynamic memory needs to be initialized during the startup of HuaweiLite OS.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] Starting address of memory.
|
||||
* @param size [IN] Memory size.
|
||||
*
|
||||
* @retval #OS_ERROR ¨C1: The dynamic memory fails to be initialized.
|
||||
* @retval #LOS_OK 0: The dynamic memory is successfully initialized.
|
||||
* @par Dependency:
|
||||
* <ul>
|
||||
* <li>los_dlinkmem.h: the header file that contains the API declaration.</li>
|
||||
* </ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 LOS_DLnkInitMem(VOID *pool, UINT32 size);
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* @brief Allocate memory.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to allocate memory of which the size is specified by size.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>After calling this API, ensure that the returned memory address is not null in case that a null pointer will be
|
||||
accessed later.</li>
|
||||
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] Starting address of memory.
|
||||
* @param size [IN] Size of the memory to be allocated (unit: byte).
|
||||
*
|
||||
* @retval Address of the allocated memory. The memory is successfully allocated.
|
||||
* @retval NULL. The memory fails to be allocated.
|
||||
* @par Dependency:
|
||||
* <ul>
|
||||
* <li>los_dlinkmem.h: the header file that contains the API declaration.</li>
|
||||
* </ul>
|
||||
* @see LOS_DLnkFreeMem
|
||||
*/
|
||||
extern void *LOS_DLnkAllocMem(VOID *pool, UINT32 size);
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* @brief Free memory.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to free the allocated memory.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The memory fails to be freed if it has been already freed.</li>
|
||||
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] Starting address of memory.
|
||||
* @param mem [IN] Address of the memory to be freed.
|
||||
*
|
||||
* @retval #LOS_NOK 1: The memory fails to be freed.
|
||||
* @retval #LOS_OK 0: The memory is successfully freed.
|
||||
* @par Dependency:
|
||||
* <ul>
|
||||
* <li>los_dlinkmem.h: the header file that contains the API declaration.</li>
|
||||
* </ul>
|
||||
* @see LOS_DLnkAllocMem
|
||||
*/
|
||||
extern UINT32 LOS_DLnkFreeMem(VOID *pool, VOID *mem);
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* @brief Re-allocate memory.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to re-allocate memory if the memory allocated before is insufficient. Data in the original memory
|
||||
will be copied to the re-allocated memory, after which the original memory will be freed.</li>
|
||||
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Before calling this API, check whether the return value of this API is null.</li>
|
||||
* <li>If the passed-in address of the original memory is not null, and the passed-in size of the new memory block is 0,
|
||||
calling this API frees the original memory.</li>
|
||||
* <li>If the passed-in address of the original memory is null, calling this API allocates a new memory block.</li>
|
||||
* <li>If the new memory block fails to be allocated, the original one will not be released.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] Starting address of memory.
|
||||
* @param ptr [IN] Address of the re-allocated memory.
|
||||
* @param size [IN] Size of the memory to be allocated.
|
||||
*
|
||||
* @retval Address of the re-allocated memory. The memory is successfully re-allocated.
|
||||
* @retval NULL. The memory fails to be re-allocated.
|
||||
* @par Dependency:
|
||||
* <ul>
|
||||
* <li>los_dlinkmem.h: the header file that contains the API declaration.</li>
|
||||
* </ul>
|
||||
* @see LOS_DLnkAllocMem
|
||||
*/
|
||||
extern void *LOS_DLnkReAllocMem(VOID *pool, VOID *ptr, UINT32 size);
|
||||
|
||||
/* *
|
||||
* @ingroup los_dlinkmem
|
||||
* @brief Allocate aligned memory.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to allocate memory blocks of specified size and of which the starting addresses are aligned on a
|
||||
* specified boundary.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The alignment parameter value must be a power of 2 with the minimum value being 4.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] Starting address of memory.
|
||||
* @param size [IN] Size of the memory to be allocated.
|
||||
* @param boundary[IN] Boundary on which the memory is aligned.
|
||||
*
|
||||
* @retval Starting address of the allocated aligned memory. The memory is successfully allocated.
|
||||
* @retval The memory fails to be allocated.
|
||||
* @par Dependency:
|
||||
* <ul>
|
||||
* <li>los_dlinkmem.h: the header file that contains the API declaration.</li>
|
||||
* </ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern void *LOS_DlnkAllocMemAlign(void *pool, UINT32 size, UINT32 boundary);
|
||||
|
||||
extern UINT32 LOS_DLnkCheckMem(void *pool);
|
||||
extern UINT32 LOS_DLnkGetTotalMemUsed(void *pool);
|
||||
extern UINT32 LOS_DLnkGetMemFreeBlks(void *pool);
|
||||
extern UINT32 LOS_DLnkGetMemUsedBlks(void *pool);
|
||||
extern UINT32 LOS_DLnkGetMemTskId(void *ptr);
|
||||
|
||||
#ifdef OS_MEM_CHECK_DEBUG
|
||||
|
||||
/*
|
||||
* memcheck error code: the stack have not inited
|
||||
* Value: 0x02000100
|
||||
* Solution: do memcheck must after stack mem init
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_NOT_INIT LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x0)
|
||||
/*
|
||||
* memcheck error code: the pPtr is NULL
|
||||
* Value: 0x02000101
|
||||
* Solution: don't give a NULL parameter
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_PARA_NULL LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x1)
|
||||
/*
|
||||
* memcheck error code: the pPtr addr not in the suit range
|
||||
* Value: 0x02000102
|
||||
* Solution: check pPtr and comfirm it included by stack
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_OUTSIDE LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x2)
|
||||
/*
|
||||
* memcheck error code: can't find the ctrl node
|
||||
* Value: 0x02000103
|
||||
* Solution: confirm the pPtr if this node has been freed or has not been alloced
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_NO_HEAD LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x3)
|
||||
/*
|
||||
* memcheck error code: the para level is wrong
|
||||
* Value: 0x02000104
|
||||
* Solution: checkout the memcheck level by the func mCheck_Level"
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_WRONG_LEVEL LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x4)
|
||||
/*
|
||||
* memcheck error code: memcheck func not open
|
||||
* Value: 0x02000105
|
||||
* Solution: enable memcheck by the func "OS_SetMemCheck_Level"
|
||||
*/
|
||||
#define OS_ERRNO_MEMCHECK_DISABLED LOS_ERRNO_OS_ERROR(OS_MOD_MEM, 0x5)
|
||||
|
||||
#define LOS_MEM_CHECK_LEVEL_LO 0
|
||||
#define LOS_MEM_CHECK_LEVEL_HI 1
|
||||
#define LOS_MEM_CHECK_DISABLE 0xff
|
||||
#define LOS_MEM_CHECK_LEVEL_D OS_ERRNO_MEMCHECK_DISABLED
|
||||
|
||||
extern UINT32 LOS_CheckMemSize(VOID *pool, VOID *ptr, UINT32 *totalSize, UINT32 *availSize);
|
||||
extern UINT32 LOS_SetMemCheck_Level(UINT8 level);
|
||||
extern UINT8 LOS_GetMemCheck_Level(VOID);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_DLINK_MEM_H */
|
|
@ -0,0 +1,376 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "iCunit.h"
|
||||
|
||||
#include "los_debug.h"
|
||||
#include "los_config.h"
|
||||
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_task.h"
|
||||
#include "los_sem.h"
|
||||
#include "los_event.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_queue.h"
|
||||
#include "los_cpup.h"
|
||||
#include "los_tick.h"
|
||||
#include "los_swtmr.h"
|
||||
#include "los_mux.h"
|
||||
#include "securec.h"
|
||||
#include "securectype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define PRINTF(fmt, args...) \
|
||||
do { \
|
||||
printf(fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define LITEOS_BASE_TEST 1
|
||||
#define LOS_KERNEL_CORE_TASK_TEST 1
|
||||
#define LOS_KERNEL_IPC_MUX_TEST 1
|
||||
#define LOS_KERNEL_IPC_SEM_TEST 1
|
||||
#define LOS_KERNEL_IPC_EVENT_TEST 1
|
||||
#define LOS_KERNEL_IPC_QUEUE_TEST 1
|
||||
#define LOS_KERNEL_CORE_SWTMR_TEST 1
|
||||
#define LOS_KERNEL_HWI_TEST 1
|
||||
#define LOS_KERNEL_FS_TEST 0
|
||||
#define LOS_KERNEL_MEM_TEST 1
|
||||
#define LOS_KERNEL_TICKLESS_TEST 0
|
||||
|
||||
#define LITEOS_CMSIS_TEST 0
|
||||
#define LOS_CMSIS2_CORE_TASK_TEST 0
|
||||
#define LOS_CMSIS2_IPC_MUX_TEST 0
|
||||
#define LOS_CMSIS2_IPC_SEM_TEST 0
|
||||
#define LOS_CMSIS2_IPC_EVENT_TEST 0
|
||||
#define LOS_CMSIS2_IPC_MSG_TEST 0
|
||||
#define LOS_CMSIS2_CORE_SWTMR_TEST 0
|
||||
#define LOS_CMSIS2_HWI_TEST 0
|
||||
|
||||
#define LOSCFG_TEST_LLT 0
|
||||
#define LOSCFG_TEST_MUCH_LOG 0
|
||||
|
||||
extern UINT32 volatile g_testCount;
|
||||
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_usSemID;
|
||||
extern UINT32 g_usSemID2;
|
||||
extern UINT32 g_mutexTest;
|
||||
|
||||
extern UINT16 g_usSwTmrID;
|
||||
extern UINT32 g_usSemID;
|
||||
extern UINT32 g_testQueueID01;
|
||||
extern UINT32 g_testQueueID02;
|
||||
extern UINT32 g_testQueueID03;
|
||||
extern UINT32 g_testTskHandle;
|
||||
extern UINT32 g_leavingTaskNum;
|
||||
extern UINT32 g_testTaskIdArray[LOSCFG_BASE_CORE_TSK_LIMIT];
|
||||
extern UINT16 g_index;
|
||||
extern UINT32 g_usSemID3[];
|
||||
extern EVENT_CB_S g_exampleEvent;
|
||||
|
||||
#ifndef LOS_TASK_MIN_TEST_STACK_SIZE
|
||||
#define LOS_TASK_MIN_TEST_STACK_SIZE LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE + 0x20
|
||||
#endif
|
||||
|
||||
#ifndef TASK_TEST
|
||||
#define TASK_TEST
|
||||
#endif
|
||||
|
||||
#ifndef SWTMR_TEST
|
||||
#define SWTMR_TEST
|
||||
#endif
|
||||
|
||||
#ifndef QUEUE_TEST
|
||||
#define QUEUE_TEST
|
||||
#endif
|
||||
|
||||
#ifndef SEM_TEST
|
||||
#define SEM_TEST
|
||||
#endif
|
||||
|
||||
#ifndef EVENT_TEST
|
||||
#define EVENT_TEST
|
||||
#endif
|
||||
|
||||
#ifndef HWI_TEST
|
||||
#define HWI_TEST
|
||||
#endif
|
||||
|
||||
#ifndef TICK_TEST
|
||||
#define TICK_TEST
|
||||
#endif
|
||||
|
||||
#ifndef EXC_TEST
|
||||
#define EXC_TEST
|
||||
#endif
|
||||
|
||||
#ifndef MEMCHECK_TEST
|
||||
#define MEMCHECK_TEST
|
||||
#endif
|
||||
|
||||
#ifndef MACRO_BASE_FUNCTION_TEST
|
||||
#define MACRO_BASE_FUNCTION_TEST
|
||||
#endif
|
||||
|
||||
#ifndef MACRO_EXC_TEST
|
||||
#define MACRO_EXC_TEST
|
||||
#endif
|
||||
|
||||
#ifndef MACRO_PRESSURE_TEST
|
||||
#define MACRO_PRESSURE_TEST
|
||||
#endif
|
||||
|
||||
#ifdef MACRO_PREESSURE_TEST
|
||||
#define DIVISOR 1
|
||||
#else
|
||||
#define DIVISOR 10
|
||||
#endif
|
||||
|
||||
#ifndef TEST_CASE_RES_CHECK
|
||||
#define TEST_CASE_RES_CHECK
|
||||
#endif
|
||||
|
||||
#ifndef TST_IT
|
||||
#define TST_IT
|
||||
#endif
|
||||
|
||||
#define TEST_PT YES
|
||||
|
||||
#if (YES == OS_INCLUDE_DYNMEM)
|
||||
#define TEST_BIG YES
|
||||
#else
|
||||
#define TEST_BIG NO
|
||||
#endif
|
||||
|
||||
#define TASK_PRIO_TEST 25
|
||||
#define TASK_PRIO_TEST_NORMAL 20
|
||||
|
||||
#define TASK_STACK_SIZE_TEST 0x400
|
||||
#define TASK_LOOP_NUM 0x100000
|
||||
#define QUEUE_LOOP_NUM 100
|
||||
#define HWI_LOOP_NUM 100
|
||||
#define SWTMR_LOOP_NUM 1000
|
||||
#define TASK_NAME_NUM 10
|
||||
#define TEST_TASK_RUNTIME 0x100000
|
||||
#define TEST_SWTMR_RUNTIME 0x1000000
|
||||
#define TEST_HWI_RUNTIME 0x100000
|
||||
#define TEST_TASK_STACK_SIZE LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE
|
||||
#define TEST_TASK_PRIORITY_LOW osPriorityBelowNormal // tskIDLE_PRIORITY + 10
|
||||
#define TEST_TASK_PRIORITY_NORMAL osPriorityNormal // tskIDLE_PRIORITY + 11
|
||||
#define TEST_TASK_PRIORITY_HIGH osPriorityAboveNormal // tskIDLE_PRIORITY + 12
|
||||
#define TEST_TASK_PRIORITY_MAX osPriorityAboveNormal5
|
||||
|
||||
#define LOS_TASK_STATUS_DETACHED 0x0100
|
||||
|
||||
#define LOS_SYS_MS_PER_SECOND 1000 // Number of ms in one second.
|
||||
#define LOS_SYS_US_PER_SECOND 1000000 // Number of us in one second.
|
||||
|
||||
#define LOS_MS_PER_TICK (LOS_SYS_MS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND)
|
||||
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
#define OS_TSK_TEST_STACK_SIZE 0x9000
|
||||
#else
|
||||
#define OS_TSK_TEST_STACK_SIZE 0x1000
|
||||
#endif
|
||||
#define TASK_CMSIS_STACK_SIZE_TEST 0x600
|
||||
|
||||
#define OS_EVENT_TIMEOUT_MAX_VAL 0xFFFFFFFF
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
#define TASK_EXISTED_NUM 3
|
||||
#else
|
||||
#define TASK_EXISTED_NUM 2
|
||||
#endif
|
||||
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
#define QUEUE_EXISTED_NUM 1
|
||||
#else
|
||||
#define QUEUE_EXISTED_NUM 0
|
||||
#endif
|
||||
|
||||
#define HWI_NUM_INT_NEG (-4)
|
||||
#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_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_INT45 45
|
||||
#define HWI_NUM_INT50 50
|
||||
#define HWI_NUM_INT55 55
|
||||
#define HWI_NUM_INT60 60
|
||||
#define HWI_NUM_INT58 58
|
||||
#define HWI_NUM_INT59 59
|
||||
|
||||
#define HWI_NUM_INT75 75
|
||||
#define HWI_NUM_INT71 71
|
||||
#define HWI_NUM_INT72 72
|
||||
#define HWI_NUM_INT73 73
|
||||
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
#define HWI_NUM_TEST 32
|
||||
#define HWI_NUM_TEST0 33
|
||||
#define HWI_NUM_TEST1 34
|
||||
#define HWI_NUM_TEST2 35
|
||||
#define HWI_NUM_TEST3 36
|
||||
#else
|
||||
#define HWI_NUM_TEST0 HWI_NUM_INT1
|
||||
#define HWI_NUM_TEST HWI_NUM_INT7
|
||||
#define HWI_NUM_TEST1 HWI_NUM_INT11
|
||||
#define HWI_NUM_TEST2 HWI_NUM_INT12
|
||||
#define HWI_NUM_TEST3 HWI_NUM_INT14
|
||||
#endif
|
||||
|
||||
#define LOSCFG_BASE_IPC_QUEUE_CONFIG LOSCFG_BASE_IPC_QUEUE_LIMIT
|
||||
#define LOSCFG_BASE_IPC_SEM_CONFIG LOSCFG_BASE_IPC_SEM_LIMIT
|
||||
#define LOSCFG_BASE_CORE_SWTMR_CONFIG LOSCFG_BASE_CORE_SWTMR_LIMIT
|
||||
#define LOSCFG_BASE_CORE_TSK_CONFIG LOSCFG_BASE_CORE_TSK_LIMIT
|
||||
#define dprintf printf
|
||||
#define IT_SEM_COUNT_MAX OS_SEM_COUNTING_MAX_COUNT
|
||||
|
||||
extern EVENT_CB_S g_pstEventCb01;
|
||||
extern EVENT_CB_S g_pstEventCb02;
|
||||
extern EVENT_CB_S g_pstEventCb03;
|
||||
|
||||
|
||||
extern UINT32 TEST_TskDelete(UINT32 taskID);
|
||||
extern UINT32 TestSemDelete(UINT32 semHandle);
|
||||
extern UINT32 TestHwiDelete(UINT32 hwiNum);
|
||||
extern VOID TEST_HwiDeleteAll(VOID);
|
||||
extern VOID TestHwiTrigger(UINT32 hwiNum);
|
||||
extern VOID TestHwiClear(UINT32 hwiNum);
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
extern UINT64 LosCpuCycleGet(VOID);
|
||||
#else
|
||||
typedef struct tagHwiHandleForm {
|
||||
HWI_PROC_FUNC pfnHook;
|
||||
UINT32 uwPrioMask;
|
||||
} HWI_HANDLE_FORM_S;
|
||||
#endif
|
||||
#define TEST_HwiCreate(ID, prio, mode, Func, arg) HalHwiCreate(ID, prio, mode, Func, arg)
|
||||
#define LOS_HwiCreate(ID, prio, mode, Func, arg) HalHwiCreate(ID, prio, mode, Func, arg)
|
||||
#define uart_printf_func printf
|
||||
|
||||
extern VOID ItSuiteLosTask(void);
|
||||
extern VOID ItSuiteLosQueue(void);
|
||||
extern VOID ItSuiteLosMux(void);
|
||||
extern VOID ItSuiteLosEvent(void);
|
||||
extern VOID ItSuiteLosSem(void);
|
||||
extern VOID ItSuiteLosSwtmr(void);
|
||||
extern VOID ItSuiteLosHwi(void);
|
||||
extern VOID ItSuiteLosMem(void);
|
||||
extern VOID ItSuite_Los_FatFs(void);
|
||||
|
||||
extern VOID ItSuite_Cmsis_Lostask(void);
|
||||
extern VOID ItSuite_Cmsis_Lostask_add(void);
|
||||
extern VOID ItSuite_CMSIS_Losmsg(void);
|
||||
extern VOID ItSuite_CMSIS_Losmsg_add(void);
|
||||
extern VOID ItSuite_CMSIS_Signal(void);
|
||||
extern VOID ItSuite_CMSIS_Signal_add(void);
|
||||
extern VOID ItSuite_Cmsis_LosMemBox(void);
|
||||
extern VOID ItSuite_Cmsis_LosMutex(void);
|
||||
extern VOID ItSuite_Cmsis_LosMutex_add(void);
|
||||
extern VOID ItSuite_Cmsis_LosRobin(void);
|
||||
extern VOID ItSuite_Cmsis_LosRobin_add(void);
|
||||
extern VOID ItSuite_CMSIS_Losmail(void);
|
||||
extern VOID ItSuite_CMSIS_Losmail_add(void);
|
||||
extern VOID ItSuite_Cmsis_LosSem(void);
|
||||
extern VOID ItSuite_Cmsis_LosSem_add(void);
|
||||
extern VOID ItSuite_CMSIS_Swtmr(void);
|
||||
extern VOID ItSuite_CMSIS_Swtmr_add(void);
|
||||
extern VOID ItSuite_Cmsis_Hwi_M3(VOID);
|
||||
extern VOID ItSuite_Cmsis_Hwi_M3_add(void);
|
||||
extern VOID ItSuite_CMSIS_Wait(void);
|
||||
extern VOID ItSuite_CMSIS_Wait_add(VOID);
|
||||
|
||||
#define OS_MS_TO_TICK(ms) (((ms) * (UINT64)LOSCFG_BASE_CORE_TICK_PER_SECOND) / 1000)
|
||||
|
||||
extern UINT32 g_usSemID;
|
||||
extern UINT32 g_auwTestTaskID[LOSCFG_BASE_CORE_TSK_LIMIT];
|
||||
|
||||
extern LosQueueCB *g_pstAllQueue;
|
||||
extern UINT32 g_taskMaxNum;
|
||||
|
||||
extern LITE_OS_SEC_BSS_INIT LOS_DL_LIST g_stUnusedSemList;
|
||||
|
||||
extern VOID HalHwiDefaultHandler(VOID);
|
||||
extern LosTask g_losTask;
|
||||
extern VOID LOS_Schedule(VOID);
|
||||
extern LosTaskCB *g_taskCBArray;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _OSTEST_H */
|
|
@ -0,0 +1,33 @@
|
|||
objs-y += it_cmsis_los_hwi.o
|
||||
objs-y += it_cmsis_los_hwi_add.o
|
||||
objs-y += it_cmsis_los_mail.o
|
||||
objs-y += it_cmsis_los_mail_add.o
|
||||
objs-y += it_cmsis_los_membox.o
|
||||
objs-y += it_cmsis_los_msg.o
|
||||
objs-y += it_cmsis_los_msg_add.o
|
||||
objs-y += it_cmsis_los_mux.o
|
||||
objs-y += it_cmsis_los_mux_add.o
|
||||
objs-y += it_cmsis_los_robin.o
|
||||
objs-y += it_cmsis_los_robin_add.o
|
||||
objs-y += it_cmsis_los_sem.o
|
||||
objs-y += it_cmsis_los_sem_add.o
|
||||
objs-y += it_cmsis_los_signal.o
|
||||
objs-y += it_cmsis_los_signal_add.o
|
||||
objs-y += it_cmsis_los_swtmr.o
|
||||
objs-y += it_cmsis_los_swtmr_add.o
|
||||
objs-y += it_cmsis_los_task.o
|
||||
objs-y += it_cmsis_los_task_add.o
|
||||
objs-y += it_cmsis_los_wait.o
|
||||
objs-y += it_cmsis_los_wait_add.o
|
||||
objs-y += it_event.o
|
||||
objs-y += it_queue.o
|
||||
objs-y += it_sem.o
|
||||
objs-y += it_sem_rt.o
|
||||
objs-y += it_swtmr.o
|
||||
objs-y += It_swtmr_align.o
|
||||
objs-y += it_task.o
|
||||
objs-y += it_task_new.o
|
||||
objs-y += it_timeslice.o
|
||||
objs-y += it_cpup.o
|
||||
objs-y += it_mpu.o
|
||||
objs-y += it_sr.o
|
|
@ -0,0 +1,63 @@
|
|||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
|
||||
static_library("test_event") {
|
||||
|
||||
sources = [
|
||||
"It_los_event_001.c",
|
||||
"It_los_event_002.c",
|
||||
"It_los_event_003.c",
|
||||
"It_los_event_004.c",
|
||||
"It_los_event_005.c",
|
||||
"It_los_event_006.c",
|
||||
"It_los_event_007.c",
|
||||
"It_los_event_008.c",
|
||||
"It_los_event_009.c",
|
||||
"It_los_event_010.c",
|
||||
"It_los_event_011.c",
|
||||
"It_los_event_012.c",
|
||||
"It_los_event_013.c",
|
||||
"It_los_event_014.c",
|
||||
"It_los_event_015.c",
|
||||
"It_los_event_016.c",
|
||||
"It_los_event_017.c",
|
||||
"It_los_event_018.c",
|
||||
"It_los_event_019.c",
|
||||
"It_los_event_020.c",
|
||||
"It_los_event_021.c",
|
||||
"It_los_event_022.c",
|
||||
"It_los_event_023.c",
|
||||
"It_los_event_024.c",
|
||||
"It_los_event_026.c",
|
||||
"It_los_event_027.c",
|
||||
"It_los_event_028.c",
|
||||
"It_los_event_029.c",
|
||||
"It_los_event_030.c",
|
||||
"It_los_event_031.c",
|
||||
"It_los_event_032.c",
|
||||
"It_los_event_033.c",
|
||||
"It_los_event_034.c",
|
||||
"It_los_event_035.c",
|
||||
"It_los_event_036.c",
|
||||
"It_los_event_037.c",
|
||||
"It_los_event_038.c",
|
||||
"It_los_event_039.c",
|
||||
"It_los_event_040.c",
|
||||
"It_los_event_041.c",
|
||||
"It_los_event_042.c",
|
||||
"It_los_event_043.c",
|
||||
"It_los_event.c",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"It_los_event.h",
|
||||
"../../../include/",
|
||||
"//kernel/liteos_m/kernel/include",
|
||||
"//kernel/liteos_m/kernel/base/include",
|
||||
"//build/compiler/arm-none-eabi/linux/arm-none-eabi/include",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include/",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include-fixed/",
|
||||
"//kernel/liteos_m/arch/arm/cortex-m/include",
|
||||
"//vendor/huawei/watchgt/devkit/hal/include",
|
||||
"//kernel/liteos_m/components/cmsis",
|
||||
]
|
||||
}
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
EVENT_CB_S g_pevent;
|
||||
|
||||
VOID ItSuiteLosEvent()
|
||||
{
|
||||
ItLosEvent001();
|
||||
ItLosEvent002();
|
||||
ItLosEvent003();
|
||||
ItLosEvent004();
|
||||
ItLosEvent005();
|
||||
ItLosEvent006();
|
||||
ItLosEvent007();
|
||||
ItLosEvent008();
|
||||
ItLosEvent009();
|
||||
ItLosEvent010();
|
||||
ItLosEvent011();
|
||||
ItLosEvent012();
|
||||
ItLosEvent013();
|
||||
ItLosEvent014();
|
||||
ItLosEvent015();
|
||||
ItLosEvent016();
|
||||
ItLosEvent017();
|
||||
ItLosEvent018();
|
||||
ItLosEvent019();
|
||||
ItLosEvent020();
|
||||
ItLosEvent021();
|
||||
ItLosEvent022();
|
||||
ItLosEvent023();
|
||||
ItLosEvent024();
|
||||
ItLosEvent026();
|
||||
ItLosEvent027();
|
||||
ItLosEvent028();
|
||||
ItLosEvent029();
|
||||
ItLosEvent030();
|
||||
ItLosEvent031();
|
||||
ItLosEvent032();
|
||||
ItLosEvent033();
|
||||
ItLosEvent034();
|
||||
ItLosEvent035();
|
||||
ItLosEvent036();
|
||||
ItLosEvent037();
|
||||
ItLosEvent038();
|
||||
ItLosEvent039();
|
||||
ItLosEvent040();
|
||||
ItLosEvent041();
|
||||
ItLosEvent042();
|
||||
ItLosEvent043();
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define SELF_DELETED 0
|
||||
#define SYS_EXIST_SWTMR 1
|
||||
#define TEST_HWI_RUNTIME 0x100000
|
||||
#define TASK_LOOP_NUM 0x100000
|
||||
#define TASK_STACK_SIZE_TEST 0x400
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
#define TASK_EXISTED_NUM 3
|
||||
#else
|
||||
#define TASK_EXISTED_NUM 2
|
||||
#endif
|
||||
|
||||
#define TASK_EXISTED_D_NUM TASK_EXISTED_NUM
|
||||
#define TASK_NAME_NUM 10
|
||||
#define IT_TASK_LOOP 20
|
||||
|
||||
extern EVENT_CB_S g_pevent;
|
||||
|
||||
extern UINT32 g_testTaskID01;
|
||||
extern UINT32 g_testTaskID02;
|
||||
extern UINT32 g_testTaskID03;
|
||||
extern UINT32 g_testQueueID01;
|
||||
extern UINT32 g_idleTaskID;
|
||||
extern UINT32 g_testTskHandle;
|
||||
extern UINT32 g_usSwTmrMaxNum;
|
||||
|
||||
extern UINT16 g_usSwTmrID1;
|
||||
extern UINT16 g_usSwTmrID2;
|
||||
extern UINT16 g_usSwTmrID3;
|
||||
|
||||
extern UINT32 g_swtmrCountA;
|
||||
extern UINT32 g_swtmrCountB;
|
||||
extern UINT32 g_swtmrCountC;
|
||||
extern UINT64 g_cpuTickCountA;
|
||||
extern UINT64 g_cpuTickCountB;
|
||||
|
||||
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
||||
|
||||
extern VOID ItLosEvent001(VOID);
|
||||
extern VOID ItLosEvent002(VOID);
|
||||
extern VOID ItLosEvent003(VOID);
|
||||
extern VOID ItLosEvent004(VOID);
|
||||
extern VOID ItLosEvent005(VOID);
|
||||
extern VOID ItLosEvent006(VOID);
|
||||
extern VOID ItLosEvent007(VOID);
|
||||
extern VOID ItLosEvent008(VOID);
|
||||
extern VOID ItLosEvent009(VOID);
|
||||
extern VOID ItLosEvent010(VOID);
|
||||
extern VOID ItLosEvent011(VOID);
|
||||
extern VOID ItLosEvent012(VOID);
|
||||
extern VOID ItLosEvent013(VOID);
|
||||
extern VOID ItLosEvent014(VOID);
|
||||
extern VOID ItLosEvent015(VOID);
|
||||
extern VOID ItLosEvent016(VOID);
|
||||
extern VOID ItLosEvent017(VOID);
|
||||
extern VOID ItLosEvent018(VOID);
|
||||
extern VOID ItLosEvent019(VOID);
|
||||
extern VOID ItLosEvent020(VOID);
|
||||
extern VOID ItLosEvent021(VOID);
|
||||
extern VOID ItLosEvent022(VOID);
|
||||
extern VOID ItLosEvent023(VOID);
|
||||
extern VOID ItLosEvent024(VOID);
|
||||
extern VOID ItLosEvent025(VOID);
|
||||
extern VOID ItLosEvent026(VOID);
|
||||
extern VOID ItLosEvent027(VOID);
|
||||
extern VOID ItLosEvent028(VOID);
|
||||
extern VOID ItLosEvent029(VOID);
|
||||
extern VOID ItLosEvent030(VOID);
|
||||
extern VOID ItLosEvent031(VOID);
|
||||
extern VOID ItLosEvent032(VOID);
|
||||
extern VOID ItLosEvent033(VOID);
|
||||
extern VOID ItLosEvent034(VOID);
|
||||
extern VOID ItLosEvent035(VOID);
|
||||
extern VOID ItLosEvent036(VOID);
|
||||
extern VOID ItLosEvent037(VOID);
|
||||
extern VOID ItLosEvent038(VOID);
|
||||
extern VOID ItLosEvent039(VOID);
|
||||
extern VOID ItLosEvent040(VOID);
|
||||
extern VOID ItLosEvent041(VOID);
|
||||
extern VOID ItLosEvent042(VOID);
|
||||
extern VOID ItLosEvent043(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, g_pevent.uwEventID, ret);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_pevent.uwEventID, 0x11, g_pevent.uwEventID);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk1";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent001(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent001", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 3); // 3, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x4, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk2";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x2);
|
||||
|
||||
LOS_TaskDelay(3); // 3, set delay time.
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to 3.
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
|
||||
LOS_TaskDelay(4); // 4, set delay time.
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4, Here, assert that g_testCount is equal to 4.
|
||||
LOS_EventClear(&g_pevent, 0xffff);
|
||||
LOS_EventDestroy(&g_pevent);
|
||||
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent002(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent002", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk3";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent003", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xFFFFFFFF, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SETBIT_INVALID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk4";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xFFFFFFFF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SETBIT_INVALID, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
EXIT1:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent004(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent004", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventWrite(NULL, 0x1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_EVENT_PTR_NULL, ret);
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x1);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 1, g_pevent.uwEventID, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 1, g_pevent.uwEventID, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xFFFFFFFF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SETBIT_INVALID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
EXIT:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent005(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent005", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01()
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x00000110, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x10, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x00000110, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x110, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk6";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x110);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
EXIT1:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent006(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent006", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x00000110, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x10, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x110);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x110, g_pevent.uwEventID, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x00000110, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x110, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x00000011, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x110, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk7";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent007(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent007", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_EVENTMASK_INVALID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x0FFFFFFF, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SETBIT_INVALID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk8";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10011);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x10011, g_pevent.uwEventID, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
EXIT1:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent008", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
ret = LOS_EventRead(NULL, 0x11, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_PTR_NULL, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_EVENTMASK_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xffffffff, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SETBIT_INVALID, ret, EXIT);
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, 0xffffffff, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_FLAGS_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, 0, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_FLAGS_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, (LOS_WAITMODE_AND | LOS_WAITMODE_OR | LOS_WAITMODE_CLR), LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_FLAGS_INVALID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk9";
|
||||
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
||||
task1.usTaskPrio = 24; // Set the priority of the current task to 24.
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent009", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk10";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, 1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, 1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent010", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER); // Permanent wait, task not jump.
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk11";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x100);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x1000);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10000);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelay(2);// 2, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 7, g_testCount, EXIT1); // 7, Here, assert that g_testCount is equal to 7.
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 8, g_testCount, EXIT1); // 8, Here, assert that g_testCount is equal to 8.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent011", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x110, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x10, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11010, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1001, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1000, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11010, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11011, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1100, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk12";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11010);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x1001);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
LOS_TaskDelay(3); // 3, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 7, g_testCount, EXIT1); // 7, Here, assert that g_testCount is equal to 7.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent012", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1100, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1100, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11111111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x110000, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x110000, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11001111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11000000, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11000000, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x00001111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk13";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11111111);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT1); // 6, Here, assert that g_testCount is equal to 6.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent013", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskSuspend(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x01, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x01, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x01, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x01, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk14";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_TaskResume(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent014", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelay(3); // 3, set delay time.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x1111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1100, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1100, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x1111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk15";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x1111);
|
||||
|
||||
LOS_TaskDelay(4); // 4, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent015(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent015", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskSuspend(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk16";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent016(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent016", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x10, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_IN_LOCK, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk17";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent017(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent017", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x10, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x10, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk18A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTs18B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 5, g_testCount); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent018(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent018", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 index = 0;
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
g_testCount++;
|
||||
|
||||
while (index < 100000) { // 100000, Wait for enough time.
|
||||
index--;
|
||||
}
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk19A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvTsk19B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
LOS_TaskDelay(10); // 10, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT1); // 6, Here, assert that g_testCount is equal to 6.
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent019(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent019", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 index = 0;
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
while (index < 100000) { // 100000, Wait for enough time.
|
||||
index--;
|
||||
}
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_OR, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelay(30); // 30, set delay time.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk20A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTsk20B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent020(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent020", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
g_testCount++;
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTsk21B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk21A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 5, g_testCount); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent021(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent021", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskSuspend(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk22A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTsk22B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert that g_testCount is equal to 4.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskResume(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT1); // 6, Here, assert that g_testCount is equal to 6.
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent022(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent022", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, 0x11, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, 0x11, ret);
|
||||
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); // 6, Here, assert that g_testCount is equal to 6.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk23A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTsk23B";
|
||||
task1.uwStackSize = LOS_TASK_MIN_TEST_STACK_SIZE;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 7, g_testCount); // 7, Here, assert that g_testCount is equal to 7.
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent023(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent023", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, 10); // 10, The timeout period for reading events.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_READ_IN_INTERRUPT, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent024(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent024", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk26";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
LOS_EventInit(&g_pevent);
|
||||
g_testCount = 0;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT1);
|
||||
|
||||
LOS_TaskUnlock();
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent026(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent026", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static UINT32 g_testCount1;
|
||||
static UINT32 g_uwEventMask;
|
||||
|
||||
static VOID SwtmrF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
g_uwEventMask = g_uwEventMask | (1 << g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, g_uwEventMask);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
while (g_testCount < 16) { // 16, The number of times the test case task is executed.
|
||||
}
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1FFFF, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x1FFFF, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount1++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
UINT32 swTmrID;
|
||||
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk27";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_uwEventMask = 1;
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
/* 2, Timeout interval of a periodic software timer. */
|
||||
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff,
|
||||
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE);
|
||||
#else
|
||||
ret = LOS_SwtmrCreate(2, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff); // 2, Timeout interval of a periodic software timer.
|
||||
#endif
|
||||
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrStart(swTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
LOS_TaskDelay(16); // 16, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount1, 1, g_testCount1, EXIT1);
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(swTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent027(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent027", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#define QUEUE_MAX_LEN 10
|
||||
#define QUEUE_MAX_NODE_SIZE 10
|
||||
|
||||
extern UINT32 g_usSemID;
|
||||
extern UINT32 g_testQueueID01;
|
||||
|
||||
static VOID SwtmrF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 eventMask;
|
||||
|
||||
eventMask = 0x1;
|
||||
eventMask = eventMask << g_testCount;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, eventMask);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
CHAR str[10];
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, str, QUEUE_MAX_NODE_SIZE, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, str, QUEUE_MAX_NODE_SIZE, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x2, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x2, ret, EXIT1);
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
EXIT2:
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
UINT32 swTmrID;
|
||||
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk28";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(1, &g_usSemID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueCreate("EventTsk28_Queue", QUEUE_MAX_LEN, &g_testQueueID01, 0, QUEUE_MAX_NODE_SIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
/* 4, Timeout interval of a periodic software timer. */
|
||||
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff,
|
||||
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE);
|
||||
#else
|
||||
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff); // 4, Timeout interval of a periodic software timer.
|
||||
#endif
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
LOS_SwtmrStart(swTmrID);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
|
||||
|
||||
LOS_TaskDelay(10); // 10, set delay time.
|
||||
|
||||
EXIT3:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
EXIT2:
|
||||
ret = LOS_SwtmrDelete(swTmrID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT1:
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
|
||||
EXIT:
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent028(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent028", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL3, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 index;
|
||||
|
||||
for (index = 0; index < 0xFF00; index++) {
|
||||
ret = LOS_EventWrite(&g_pevent, 0xFF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
}
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk29";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xFF, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0xFF, g_pevent.uwEventID, EXIT1);
|
||||
|
||||
EXIT1:
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent029(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent029", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 3); // 3, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk30";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 1;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_TaskDelay(35); // 35, set delay time.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent030(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent030", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventDestroy(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_EVENT_PTR_NULL, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent031(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent031", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND, 30); // 30, The timeout period for reading events.
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND, 31); // 31, The timeout period for reading events.
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF03(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND, 32); // 32, The timeout period for reading events.
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk32A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 3; // 3, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EventTsk32B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF03;
|
||||
task1.pcName = "EventTsk32C";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID03, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
LOS_TaskDelay(50); // 50, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT2); // 3, set new task priority, it is higher than the test task.
|
||||
|
||||
EXIT2:
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent032(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent032", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0xF, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0xF, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
static VOID TaskF03(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0xF, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk33A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 3; // 3, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EventTsk33B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF03;
|
||||
task1.pcName = "EventTsk33C";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID03, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT2); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xF);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT3); // 6, Here, assert that g_testCount is equal to 6.
|
||||
|
||||
EXIT3:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT2:
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent033(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent033", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID SwtmrF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0xF);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0xF, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, g_pevent.uwEventID, ret);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, 0xF, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 swTmrID;
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff,
|
||||
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE);
|
||||
#else
|
||||
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0xffff);
|
||||
#endif
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_SwtmrStart(swTmrID);
|
||||
|
||||
LOS_TaskDelay(10);// 10, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); // 10, Here, assert that g_testCount is equal to 10.
|
||||
EXIT:
|
||||
|
||||
LOS_SwtmrDelete(swTmrID);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent034(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent034", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
int ret;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventInit(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_EVENT_PTR_NULL, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent035(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent035", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk36";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT1);
|
||||
|
||||
LOS_EventClear(&g_pevent, (~(0x11)));
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent036(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent036", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskSuspend(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
LOS_EventInit(&g_pevent);
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk37";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
|
||||
LOS_EventClear(&g_pevent, (~(0x11)));
|
||||
|
||||
ret = LOS_TaskResume(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent037(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent037", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static EVENT_CB_S g_pevent2 = { 0 };
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent2, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_EventClear(&g_pevent2, 0);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent2, 0x11, LOS_WAITMODE_AND, 10); // 10, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
LOS_EventClear(&g_pevent2, 0x11);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent2, 0x11, LOS_WAITMODE_AND, 10); // 10, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_READ_TIMEOUT, ret, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent2, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_EventClear(&g_pevent2, 0x11);
|
||||
ret = LOS_EventRead(&g_pevent2, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x11, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); // 6, Here, assert that g_testCount is equal to 6.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_OR, 10); // 10, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x1, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
LOS_EventInit(&g_pevent);
|
||||
LOS_EventInit(&g_pevent2);
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk38A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EventTsk38B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert that g_testCount is equal to 2.
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
LOS_TaskDelay(11); // 11, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 7, g_testCount, EXIT1); // 7, Here, assert that g_testCount is equal to 7.
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent038(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent038", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk39";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_EventClear(&g_pevent, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent039(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent039", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 10); // 10, The timeout period for reading events.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, 0x11, ret);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_pevent.uwEventID, 0x111, g_pevent.uwEventID);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk40";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x100);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent040(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent040", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 3); // 3, The timeout period for reading events.
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk41";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent041(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent041", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, g_pevent.uwEventID, ret);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_pevent.uwEventID, 0x11, g_pevent.uwEventID);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
EVENT_CB_S pevent = { 0 };
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk42";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
LOS_EventInit(&pevent);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_EventWrite(&pevent, 0x11);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x11);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent042(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent042", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
g_pevent.uwEventID = 0;
|
||||
LOS_EventInit(&g_pevent);
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x1);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x1, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x1, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x10);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, g_pevent.uwEventID, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x11, g_pevent.uwEventID, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
g_testCount++;
|
||||
|
||||
LOS_EventWrite(&g_pevent, 0x100);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x10, LOS_WAITMODE_OR, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0x10, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_pevent.uwEventID, 0x111, g_pevent.uwEventID, EXIT);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
(void)memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk43";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the test task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosEvent043(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosEvent043", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,56 @@
|
|||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
|
||||
static_library("test_hwi") {
|
||||
|
||||
sources = [
|
||||
"it_los_hwi_001.c",
|
||||
"it_los_hwi_002.c",
|
||||
"it_los_hwi_003.c",
|
||||
"it_los_hwi_004.c",
|
||||
"it_los_hwi_005.c",
|
||||
"it_los_hwi_006.c",
|
||||
"it_los_hwi_007.c",
|
||||
"it_los_hwi_008.c",
|
||||
"it_los_hwi_009.c",
|
||||
"it_los_hwi_010.c",
|
||||
"it_los_hwi_011.c",
|
||||
"it_los_hwi_012.c",
|
||||
"it_los_hwi_013.c",
|
||||
"it_los_hwi_014.c",
|
||||
"it_los_hwi_015.c",
|
||||
"it_los_hwi_016.c",
|
||||
"it_los_hwi_017.c",
|
||||
"it_los_hwi_018.c",
|
||||
"it_los_hwi_019.c",
|
||||
"it_los_hwi_020.c",
|
||||
"it_los_hwi_021.c",
|
||||
"it_los_hwi_022.c",
|
||||
"it_los_hwi_023.c",
|
||||
"it_los_hwi_024.c",
|
||||
"it_los_hwi_025.c",
|
||||
"it_los_hwi_026.c",
|
||||
"it_los_hwi_027.c",
|
||||
"it_los_hwi_028.c",
|
||||
"it_los_hwi_029.c",
|
||||
"it_los_hwi_030.c",
|
||||
"it_los_hwi_031.c",
|
||||
"it_los_hwi_032.c",
|
||||
"it_los_hwi_033.c",
|
||||
"it_los_hwi_034.c",
|
||||
"It_los_hwi.c",
|
||||
"LLT_los_hwi_035.c",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"It_los_hwi.h",
|
||||
"../../../include/",
|
||||
"//kernel/liteos_m/kernel/include",
|
||||
"//kernel/liteos_m/kernel/base/include",
|
||||
"//build/compiler/arm-none-eabi/linux/arm-none-eabi/include",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include/",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include-fixed/",
|
||||
"//kernel/liteos_m/arch/arm/cortex-m/include",
|
||||
"//kernel/liteos_m/components/cmsis",
|
||||
"//vendor/huawei/watchgt/devkit/hal/include",
|
||||
]
|
||||
}
|
|
@ -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_hwi.h"
|
||||
|
||||
VOID ItSuiteLosHwi()
|
||||
{
|
||||
ItLosHwi001();
|
||||
ItLosHwi002();
|
||||
ItLosHwi003();
|
||||
ItLosHwi004();
|
||||
ItLosHwi005();
|
||||
ItLosHwi006();
|
||||
ItLosHwi007();
|
||||
ItLosHwi008();
|
||||
ItLosHwi009();
|
||||
ItLosHwi010();
|
||||
ItLosHwi011();
|
||||
ItLosHwi012();
|
||||
ItLosHwi013();
|
||||
ItLosHwi014();
|
||||
ItLosHwi015();
|
||||
ItLosHwi016();
|
||||
ItLosHwi017();
|
||||
ItLosHwi018();
|
||||
ItLosHwi019();
|
||||
ItLosHwi020();
|
||||
ItLosHwi021();
|
||||
ItLosHwi022();
|
||||
ItLosHwi023();
|
||||
ItLosHwi024();
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
ItLosHwi026();
|
||||
#endif
|
||||
ItLosHwi027();
|
||||
ItLosHwi028();
|
||||
ItLosHwi029();
|
||||
ItLosHwi030();
|
||||
ItLosHwi031();
|
||||
ItLosHwi032();
|
||||
ItLosHwi033();
|
||||
ItLosHwi034();
|
||||
}
|
|
@ -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.
|
||||
*/
|
||||
#ifndef IT_LOS_HWI_H
|
||||
#define IT_LOS_HWI_H
|
||||
|
||||
#include "osTest.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
#define OS_USER_HWI_MAX (26)
|
||||
#define OS_HWI_MAX_USED_NUM (26)
|
||||
#define OS_USER_HWI_MIN OS_RISCV_SYS_VECTOR_CNT
|
||||
#else
|
||||
#define OS_USER_HWI_MAX 10
|
||||
#define OS_HWI_MAX_USED_NUM 10
|
||||
#define OS_USER_HWI_MIN 0
|
||||
#endif
|
||||
|
||||
extern VOID ItLosHwi001(VOID);
|
||||
extern VOID ItLosHwi002(VOID);
|
||||
extern VOID ItLosHwi003(VOID);
|
||||
extern VOID ItLosHwi004(VOID);
|
||||
extern VOID ItLosHwi005(VOID);
|
||||
extern VOID ItLosHwi006(VOID);
|
||||
extern VOID ItLosHwi007(VOID);
|
||||
extern VOID ItLosHwi008(VOID);
|
||||
extern VOID ItLosHwi009(VOID);
|
||||
extern VOID ItLosHwi010(VOID);
|
||||
extern VOID ItLosHwi011(VOID);
|
||||
extern VOID ItLosHwi012(VOID);
|
||||
extern VOID ItLosHwi013(VOID);
|
||||
extern VOID ItLosHwi014(VOID);
|
||||
extern VOID ItLosHwi015(VOID);
|
||||
extern VOID ItLosHwi016(VOID);
|
||||
extern VOID ItLosHwi017(VOID);
|
||||
extern VOID ItLosHwi018(VOID);
|
||||
extern VOID ItLosHwi019(VOID);
|
||||
extern VOID ItLosHwi020(VOID);
|
||||
extern VOID ItLosHwi021(VOID);
|
||||
extern VOID ItLosHwi022(VOID);
|
||||
extern VOID ItLosHwi023(VOID);
|
||||
extern VOID ItLosHwi024(VOID);
|
||||
extern VOID ItLosHwi025(VOID);
|
||||
extern VOID ItLosHwi026(VOID);
|
||||
extern VOID ItLosHwi027(VOID);
|
||||
extern VOID ItLosHwi028(VOID);
|
||||
extern VOID ItLosHwi029(VOID);
|
||||
extern VOID ItLosHwi030(VOID);
|
||||
extern VOID ItLosHwi031(VOID);
|
||||
extern VOID ItLosHwi032(VOID);
|
||||
extern VOID ItLosHwi033(VOID);
|
||||
extern VOID ItLosHwi034(VOID);
|
||||
extern VOID LltLosHwi035(VOID);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* IT_LOS_HWI_H */
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi001(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, NULL, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_PROC_FUNC_NULL, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi002(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
hwiPrio = 2; // 2, set new hwi priority
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
hwiPrio = 6; // 6, set new hwi priority
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
hwiPrio = 7; // 7, set new hwi priority
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT3);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi004(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
#define HWI_NUM_INT0 HWI_NUM_TEST2
|
||||
#define HWI_NUM_INT1 HWI_NUM_TEST3
|
||||
#endif
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT0, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
TestHwiDelete(HWI_NUM_INT1);
|
||||
TestHwiDelete(HWI_NUM_INT0);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_INT1);
|
||||
TestHwiDelete(HWI_NUM_INT0);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_INT0);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi005(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_HANDLE_T hwiNum = 241;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(hwiNum, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi006(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
uvIntSave = LOS_IntLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
LOS_IntRestore(uvIntSave);
|
||||
LOS_TaskDelay(5); // 5, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi007(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT3); // Compare wiht the expected value 3.
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave1;
|
||||
UINTPTR uvIntSave2;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
uvIntSave1 = LOS_IntLock();
|
||||
uvIntSave2 = LOS_IntLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
LOS_IntRestore(uvIntSave2);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
LOS_IntRestore(uvIntSave1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi010", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 5, g_testCount); // Compare wiht the expected value 5.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST2);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 3, g_testCount); // Compare wiht the expected value 3.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST2);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
hwiPrio = 2; // 2, set new hwi priority
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
hwiPrio = 1;
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT3); // Compare wiht the expected value 6.
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST2);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST2);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi011", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 5, g_testCount); // Compare wiht the expected value 5.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 3, g_testCount); // Compare wiht the expected value 3.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
hwiPrio = 2; // set new hwi priority is 2
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
hwiPrio = 3; // set new hwi priority is 3
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT3); // Compare wiht the expected value 6.
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi012", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST2);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
#else
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
#endif
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
hwiPrio = 2; // set new hwi priority is 2
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
hwiPrio = 1;
|
||||
#else
|
||||
hwiPrio = 3; // set new hwi priority is 3
|
||||
#endif
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
uvIntSave = LOS_IntLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
TestHwiTrigger(HWI_NUM_TEST2);
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
|
||||
LOS_IntRestore(uvIntSave);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT3); // Compare wiht the expected value 3.
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST2);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST2);
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi013", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
uvIntSave = LOS_IntLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
LOS_IntRestore(uvIntSave);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT3); // Compare wiht the expected value 3.
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi014", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "Tsk015A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT2); // Compare wiht the expected value 3.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi015(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi015", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF03(VOID)
|
||||
{
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // Compare wiht the expected value 4.
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // Compare wiht the expected value 3.
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk016A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 3; // 3, set new task priority, it is higher than the current task.
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task.pcName = "HwiTsk016B";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF03;
|
||||
task.pcName = "HwiTsk016C";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID03, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
|
||||
|
||||
LOS_TaskUnlock();
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 5, g_testCount); // Compare wiht the expected value 5.
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT3:
|
||||
LOS_TaskDelete(g_testTaskID03);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi016(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi016", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
g_testCount++;
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk017A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItLosHwi017(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi017", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
g_testCount++;
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskUnlock();
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk018A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // Compare wiht the expected value 3.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi018(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi018", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
if (g_testCount == 1) {
|
||||
ret = LOS_TaskSuspend(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
}
|
||||
g_testCount++;
|
||||
|
||||
if (g_testCount == 4) { // when g_testCount is 4, Resume the task id is 4
|
||||
ret = LOS_TaskResume(g_testTaskID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // Compare wiht the expected value 5.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk019A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT2); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
ICUNIT_TRACK_EQUAL(g_testCount, 6, g_testCount); // Compare wiht the expected value 6.
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi019(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi019", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task.pcName = "HwiTsk020B";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // Compare wiht the expected value 3.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk020A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // Compare wiht the expected value 4.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi020(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi020", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // Compare wiht the expected value 3.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task.pcName = "HwiTsk021B";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTsk021A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // Compare wiht the expected value 4.
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi021(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi021", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define EVENT_WAIT 200
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
ret = LOS_EventWrite(&g_exampleEvent, EVENT_WAIT);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventRead(&g_exampleEvent, EVENT_WAIT, LOS_WAITMODE_AND, 100); // 100, set time out
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_READ_IN_INTERRUPT, ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_exampleEvent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ret = LOS_EventRead(&g_exampleEvent, EVENT_WAIT, LOS_WAITMODE_AND, 100); // 100, set time out.
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_WAIT, ret);
|
||||
|
||||
ret = LOS_EventClear(&g_exampleEvent, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_exampleEvent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi022(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi022", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
CHAR *queName = "TEST_QUE";
|
||||
UINT32 ret;
|
||||
UINT32 len = 10;
|
||||
UINT32 flags = 0;
|
||||
UINT32 maxMsgSize = 6;
|
||||
UINT8 queueRead[6];
|
||||
UINT8 queueWrite[6] = {101, 102, 103, 104, 105, 106};
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_QueueCreate(queName, len, &g_testQueueID01, flags, maxMsgSize); // Los_QueueCreateSyn
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, queueRead, maxMsgSize, 0); // Los_QueueReadSyn
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, queueWrite, maxMsgSize, 0); // Los_QueueWriteSyn
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, queueRead, maxMsgSize, 0); // Los_QueueReadSyn
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_QueueDelete(g_testQueueID01); // Los_QueueDelete
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 1;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi023(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi023", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount++;
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
|
||||
return;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 semCount = 1;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.pcName = "HwiTask024A";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(semCount, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_NO_WAIT);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // Compare wiht the expected value 3.
|
||||
|
||||
EXIT1:
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi024(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi024", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,70 @@
|
|||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SEM_PEND_INTERR, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 semCount = 1;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_SemCreate(semCount, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
/*
|
||||
**********
|
||||
Testcase brief in English
|
||||
**********
|
||||
*/
|
||||
|
||||
VOID ItLosHwi025(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi025", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID SwtmrF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 interval = 1;
|
||||
UINT32 swTmrID = 0x2;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SwtmrCreate(interval, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &swTmrID, 0x0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SwtmrStart(swTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
while (1) {
|
||||
if (g_testCount == 10) { // Expected to trigger 10 software timer interrupts for test.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EXIT:
|
||||
ret = LOS_SwtmrDelete(swTmrID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi026(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi026", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 index;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
for (index = 0; index < HWI_LOOP_NUM; index++) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
|
||||
}
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
}
|
||||
ICUNIT_ASSERT_EQUAL(loop, HWI_LOOP_NUM, loop);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi027(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi027", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* 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 "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave1;
|
||||
UINTPTR uvIntSave2;
|
||||
UINTPTR uvIntSave3;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
g_testCount = 0;
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
uvIntSave1 = LOS_IntLock();
|
||||
uvIntSave2 = LOS_IntLock();
|
||||
uvIntSave3 = LOS_IntLock();
|
||||
|
||||
LOS_IntRestore(uvIntSave3);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT3);
|
||||
|
||||
uvIntSave3 = LOS_IntLock();
|
||||
|
||||
LOS_IntRestore(uvIntSave3);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT3);
|
||||
|
||||
LOS_IntRestore(uvIntSave2);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT3);
|
||||
|
||||
LOS_IntRestore(uvIntSave1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT3);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT3);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
}
|
||||
return LOS_OK;
|
||||
|
||||
EXIT3:
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi028(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi028", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST1);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 4, g_testCount); // Compare wiht the expected value 4.
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF02(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST3);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // Compare wiht the expected value 2.
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST1);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST3);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 2;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
g_testCount = 0;
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 5, g_testCount); // Compare wiht the expected value 5.
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST1);
|
||||
}
|
||||
|
||||
EXIT2:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
|
||||
EXIT1:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi029(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi029", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 2;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINTPTR uvIntSave;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
g_testCount = 0;
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
uvIntSave = LOS_IntLock();
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
LOS_IntRestore(uvIntSave);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
}
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi030(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi030", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 3;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, loop + 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi031(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi031", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static int g_uwIndex;
|
||||
#ifdef LOS_HIMIDEER_RV32
|
||||
#define HWI_NUM_INT0 HWI_NUM_TEST
|
||||
#ifdef LOS_HIFONEV320_RV32
|
||||
#define TEST_MAX_NUMBER_HWI 5
|
||||
#define TEST_HWI_COUNT (TEST_MAX_NUMBER_HWI - 1)
|
||||
#else
|
||||
#define TEST_MAX_NUMBER_HWI OS_USER_HWI_MAX
|
||||
#define TEST_HWI_COUNT (TEST_MAX_NUMBER_HWI - 2)
|
||||
#endif
|
||||
#else
|
||||
#define TEST_MAX_NUMBER_HWI (OS_USER_HWI_MAX - HWI_NUM_INT0)
|
||||
#define TEST_HWI_COUNT (TEST_MAX_NUMBER_HWI - 2)
|
||||
#endif
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_INT0 + g_uwIndex);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
/* Creates 3 interrupts in a row with interrupt number */
|
||||
for (g_uwIndex = 0; g_uwIndex < 3; g_uwIndex++) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
TestHwiTrigger(HWI_NUM_INT0 + g_uwIndex);
|
||||
}
|
||||
|
||||
/* Create interrupt starting at interrupt number HWI_NUM_INT0 + 4. */
|
||||
for (g_uwIndex = 4; g_uwIndex < TEST_MAX_NUMBER_HWI; g_uwIndex++) {
|
||||
/* if interrupt number is not HWI_NUM_INT0 + 5 */
|
||||
if (g_uwIndex != 5) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
TestHwiTrigger(HWI_NUM_INT0 + g_uwIndex);
|
||||
}
|
||||
}
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, TEST_HWI_COUNT, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
for (g_uwIndex = 0; g_uwIndex < TEST_MAX_NUMBER_HWI; g_uwIndex++) {
|
||||
TestHwiDelete(HWI_NUM_INT0 + g_uwIndex);
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi032(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi032", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
int index;
|
||||
for (index = OS_USER_HWI_MIN; index < OS_HWI_MAX_USED_NUM; index++) {
|
||||
TestHwiClear(index);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 index;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
for (index = 0; index < OS_HWI_MAX_USED_NUM; index++) {
|
||||
/* if not Interrupt number HWI_NUM_INT0 + 3\4\32\35\36. */
|
||||
if ((index != 3) && (index != 4) && (index != 32) && (index != 35) && (index != 36)) {
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT0 + index, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
}
|
||||
|
||||
for (index = OS_USER_HWI_MIN; index < OS_HWI_MAX_USED_NUM; index++) {
|
||||
TestHwiDelete(HWI_NUM_INT0 + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi033(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi033", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 2;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
|
||||
g_testCount = 0;
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // Compare wiht the expected value 5.
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
}
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosHwi034(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi034", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
}
|
||||
|
||||
VOID ItHwiM3B001F001()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UINT32 g_testTaskIdHwi = 0xFFFF;
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 2;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "HWI_035";
|
||||
task1.usTaskPrio = 4; // set new task priority is 4
|
||||
task1.uwStackSize = 0x200;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskIdHwi, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_INT0, hwiPrio, mode, (HWI_PROC_FUNC)ItHwiM3B001F001, arg);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskIdHwi);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
/*
|
||||
**********
|
||||
Testcase brief in English
|
||||
**********
|
||||
*/
|
||||
|
||||
VOID LltLosHwi035(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("LltLosHwi035", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
|
||||
static_library("test_mem") {
|
||||
|
||||
sources = [
|
||||
"It_los_list_001.c",
|
||||
"It_los_mem_001.c",
|
||||
"It_los_mem_002.c",
|
||||
"It_los_mem_003.c",
|
||||
"It_los_mem_004.c",
|
||||
"It_los_mem_005.c",
|
||||
"It_los_mem_006.c",
|
||||
"It_los_mem_007.c",
|
||||
"It_los_mem_008.c",
|
||||
"It_los_mem_009.c",
|
||||
"It_los_mem_010.c",
|
||||
"It_los_mem_011.c",
|
||||
"It_los_mem_012.c",
|
||||
"It_los_mem_013.c",
|
||||
"It_los_mem_014.c",
|
||||
"It_los_mem_015.c",
|
||||
"It_los_mem_016.c",
|
||||
"It_los_mem_017.c",
|
||||
"It_los_mem_018.c",
|
||||
"It_los_mem_019.c",
|
||||
"It_los_mem_020.c",
|
||||
"It_los_mem_035.c",
|
||||
"It_los_mem_036.c",
|
||||
"It_los_mem_037.c",
|
||||
"It_los_mem_038.c",
|
||||
"It_los_mem_040.c",
|
||||
"It_los_mem_045.c",
|
||||
"it_los_mem.c",
|
||||
"It_los_tick_001.c",
|
||||
"LLT_los_tick_001.c",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"It_los_mem.h",
|
||||
"../../../include/",
|
||||
"//kernel/liteos_m/kernel/include",
|
||||
"//kernel/liteos_m/kernel/base/include",
|
||||
"//build/compiler/arm-none-eabi/linux/arm-none-eabi/include",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include/",
|
||||
"//build/compiler/arm-none-eabi/linux/lib/gcc/arm-none-eabi/5.4.1/include-fixed/",
|
||||
"//kernel/liteos_m/arch/arm/cortex-m/include",
|
||||
"//kernel/liteos_m/components/cmsis",
|
||||
"//vendor/huawei/watchgt/devkit/hal/include",
|
||||
]
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* 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_MEM_H
|
||||
#define IT_LOS_MEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#include "osTest.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_config.h"
|
||||
#include "iCunit.h"
|
||||
#include "math.h"
|
||||
|
||||
#define OS_MEM_WATERLINE YES
|
||||
|
||||
#ifdef OS_MEM_WATERLINE
|
||||
#define TEST_MEM_MINIUSE (LOS_DLNK_HEAD_SIZE + LOS_DLNK_NODE_HEAD_SIZE + sizeof(LOS_MEM_POOL_INFO))
|
||||
#endif
|
||||
|
||||
#define TEST_MEM_SIZE 0x2000
|
||||
|
||||
#define IS_ALIGNED_SIZE(value, alignSize) (0 == ((UINT32)(value) & (UINT32)((alignSize) - 1)))
|
||||
|
||||
#define TEST_POOL_SIZE (1 * 8 * 1024)
|
||||
|
||||
#define RANDOM(x) (rand() % (x))
|
||||
|
||||
#define LOS_INIT_MEM LOS_MemInit
|
||||
#define LOS_ALLOC_MEM LOS_MemAlloc
|
||||
#define LOS_REALLOC_MEM LOS_MemRealloc
|
||||
#define LOS_FREE_MEM LOS_MemFree
|
||||
|
||||
/* Supposing a Second Level Index: SLI = 3. */
|
||||
#define OS_MEM_SLI 3
|
||||
/* Giving 1 free list for each small bucket: 4, 8, 12, up to 124. */
|
||||
#define OS_MEM_SMALL_BUCKET_COUNT 31
|
||||
#define OS_MEM_SMALL_BUCKET_MAX_SIZE 128
|
||||
/* Giving OS_MEM_FREE_LIST_NUM free lists for each large bucket. */
|
||||
#define OS_MEM_LARGE_BUCKET_COUNT 24
|
||||
#define OS_MEM_FREE_LIST_NUM (1 << OS_MEM_SLI)
|
||||
/* OS_MEM_SMALL_BUCKET_MAX_SIZE to the power of 2 is 7. */
|
||||
#define OS_MEM_LARGE_START_BUCKET 7
|
||||
|
||||
/* The count of free list. */
|
||||
#define OS_MEM_FREE_LIST_COUNT (OS_MEM_SMALL_BUCKET_COUNT + (OS_MEM_LARGE_BUCKET_COUNT << OS_MEM_SLI))
|
||||
/* The bitmap is used to indicate whether the free list is empty, 1: not empty, 0: empty. */
|
||||
#define OS_MEM_BITMAP_WORDS ((OS_MEM_FREE_LIST_COUNT >> 5) + 1)
|
||||
|
||||
struct TestMemNodeHead {
|
||||
#if (LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK == 1)
|
||||
UINT32 magic;
|
||||
#endif
|
||||
#if (LOSCFG_MEM_LEAKCHECK == 1)
|
||||
UINTPTR linkReg[LOS_RECORD_LR_CNT];
|
||||
#endif
|
||||
union {
|
||||
struct TestMemNodeHead *prev; /* The prev is used for current node points to the previous node */
|
||||
struct TestMemNodeHead *next; /* The next is used for sentinel node points to the expand node */
|
||||
} ptr;
|
||||
#if (LOSCFG_MEM_FREE_BY_TASKID == 1)
|
||||
UINT32 taskID : 6;
|
||||
UINT32 sizeAndFlag : 26;
|
||||
#else
|
||||
UINT32 sizeAndFlag;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct TestMemUsedNodeHead {
|
||||
struct TestMemNodeHead header;
|
||||
};
|
||||
|
||||
struct TestMemFreeNodeHead {
|
||||
struct TestMemNodeHead header;
|
||||
struct TestMemFreeNodeHead *prev;
|
||||
struct TestMemFreeNodeHead *next;
|
||||
};
|
||||
|
||||
struct TestMemPoolInfo {
|
||||
VOID *pool;
|
||||
UINT32 totalSize;
|
||||
UINT32 attr;
|
||||
#if (LOSCFG_MEM_WATERLINE == 1)
|
||||
UINT32 waterLine; /* Maximum usage size in a memory pool */
|
||||
UINT32 curUsedSize; /* Current usage size in a memory pool */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct TestMemPoolHead {
|
||||
struct TestMemPoolInfo info;
|
||||
UINT32 freeListBitmap[OS_MEM_BITMAP_WORDS];
|
||||
struct TestMemFreeNodeHead *freeList[OS_MEM_FREE_LIST_COUNT];
|
||||
#if (LOSCFG_MEM_MUL_POOL == 1)
|
||||
VOID *nextPool;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define LOS_MEM_NODE_HEAD_SIZE sizeof(struct TestMemUsedNodeHead)
|
||||
#define MIN_MEM_POOL_SIZE (LOS_MEM_NODE_HEAD_SIZE + sizeof(struct TestMemPoolHead))
|
||||
#define LOS_MEM_POOL_SIZE sizeof(struct TestMemPoolHead)
|
||||
|
||||
extern void *g_memPool;
|
||||
extern void *g_testPool;
|
||||
|
||||
extern void MemStart(void);
|
||||
extern void MemEnd(void);
|
||||
extern void MemInit(void);
|
||||
extern void MemFree(void);
|
||||
extern UINT32 MemGetFreeSize(void *pool);
|
||||
extern UINT32 CalPow(UINT32 exp);
|
||||
|
||||
VOID ItLosMem001(void);
|
||||
VOID ItLosMem002(void);
|
||||
VOID ItLosMem003(void);
|
||||
VOID ItLosMem004(void);
|
||||
VOID ItLosMem005(void);
|
||||
VOID ItLosMem006(void);
|
||||
VOID ItLosMem007(void);
|
||||
VOID ItLosMem008(void);
|
||||
VOID ItLosMem009(void);
|
||||
VOID ItLosMem010(void);
|
||||
VOID ItLosMem011(void);
|
||||
VOID ItLosMem012(void);
|
||||
VOID ItLosMem013(void);
|
||||
VOID ItLosMem014(void);
|
||||
VOID ItLosMem015(void);
|
||||
VOID ItLosMem016(void);
|
||||
VOID ItLosMem017(void);
|
||||
VOID ItLosMem018(void);
|
||||
VOID ItLosMem019(void);
|
||||
VOID ItLosMem020(void);
|
||||
VOID ItLosMem021(void);
|
||||
VOID ItLosMem022(void);
|
||||
VOID ItLosMem023(void);
|
||||
VOID ItLosMem024(void);
|
||||
VOID ItLosMem025(void);
|
||||
VOID ItLosMem026(void);
|
||||
VOID ItLosMem027(void);
|
||||
VOID ItLosMem028(void);
|
||||
VOID ItLosMem029(void);
|
||||
VOID ItLosMem030(void);
|
||||
VOID ItLosMem031(void);
|
||||
VOID ItLosMem032(void);
|
||||
VOID ItLosMem033(void);
|
||||
VOID ItLosMem035(void);
|
||||
VOID ItLosMem036(void);
|
||||
VOID ItLosMem037(void);
|
||||
VOID ItLosMem038(void);
|
||||
VOID ItLosMem039(void);
|
||||
VOID ItLosMem040(void);
|
||||
VOID ItLosMem041(void);
|
||||
VOID ItLosMem042(void);
|
||||
VOID ItLosMem043(void);
|
||||
VOID ItLosMem044(void);
|
||||
VOID ItLosMem045(void);
|
||||
VOID ItLosMem046(void);
|
||||
VOID ItLosMem047(void);
|
||||
VOID ItLosMem058(void);
|
||||
VOID ItLosMem063(void);
|
||||
VOID ItLosMem064(void);
|
||||
VOID ItLosMem065(void);
|
||||
VOID ItLosTick001(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* IT_LOS_MEM_H */
|
|
@ -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 "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 size;
|
||||
void *p = NULL;
|
||||
|
||||
size = 0x100;
|
||||
p = LOS_MemAlloc((void *)LOSCFG_SYS_HEAP_ADDR, size);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(p, NULL, 0);
|
||||
|
||||
(void)memset_s(p, size, 1, size);
|
||||
|
||||
ret = LOS_MemFree((void *)LOSCFG_SYS_HEAP_ADDR, p);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, 0);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem001(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem001", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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 "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 size;
|
||||
void *p = NULL;
|
||||
|
||||
MemStart();
|
||||
|
||||
size = 0;
|
||||
p = LOS_MemAlloc((void *)LOSCFG_SYS_HEAP_ADDR, size);
|
||||
ICUNIT_ASSERT_EQUAL(p, NULL, p);
|
||||
|
||||
size = 0xffffffff;
|
||||
p = LOS_MemAlloc((void *)LOSCFG_SYS_HEAP_ADDR, size);
|
||||
ICUNIT_ASSERT_EQUAL(p, NULL, p);
|
||||
|
||||
MemEnd();
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem002(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem002", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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 "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 size;
|
||||
void *p = NULL;
|
||||
|
||||
size = 0x1;
|
||||
p = LOS_MemAlloc((void *)LOSCFG_SYS_HEAP_ADDR, size);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(p, NULL, 0);
|
||||
|
||||
ret = LOS_MemFree((void *)LOSCFG_SYS_HEAP_ADDR, p);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, 0);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem003(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem003", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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 "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MemInit(NULL, TEST_MEM_SIZE);
|
||||
ICUNIT_ASSERT_EQUAL(ret, OS_ERROR, ret);
|
||||
|
||||
ret = LOS_MemInit(g_memPool, MIN_MEM_POOL_SIZE - 1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, OS_ERROR, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem004(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem004", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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 "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
void *pool = NULL;
|
||||
UINT32 ret;
|
||||
ret = LOS_MemInit(g_memPool, TEST_MEM_SIZE);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
pool = (void *)((UINT32)(UINTPTR)g_memPool + MIN_DLNK_POOL_SIZE - LOS_DLNK_NODE_HEAD_SIZE);
|
||||
|
||||
ret = LOS_MemInit(pool, MIN_DLNK_POOL_SIZE + 1000); // 1000, Initialize the appropriate memory pool space。
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MemDeInit(pool);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_MemDeInit(g_memPool);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem005(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem005", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -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 "osTest.h"
|
||||
#include "It_los_mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 size;
|
||||
void *p0 = NULL;
|
||||
|
||||
MemInit();
|
||||
|
||||
size = 0x400;
|
||||
while (1) {
|
||||
p0 = LOS_MemAlloc(g_memPool, size);
|
||||
if (p0 == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MemGetFreeSize(g_memPool) >= (size + LOS_MEM_NODE_HEAD_SIZE + LOS_MEM_POOL_SIZE)) {
|
||||
ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT);
|
||||
}
|
||||
|
||||
size = size;
|
||||
p0 = LOS_MemAlloc(g_memPool, size);
|
||||
ICUNIT_GOTO_EQUAL(p0, NULL, p0, EXIT);
|
||||
|
||||
EXIT:
|
||||
MemFree();
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosMem006(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMem006", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, 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
Loading…
Reference in New Issue