chore: fix typo: testsuits --> testsuites

keep testsuites the same directory name as in liteos_a

Signed-off-by: Caoruihong <crh.cao@huawei.com>
This commit is contained in:
Caoruihong
2021-10-21 21:26:54 +08:00
parent 93c1eb54a0
commit 9c69e6039e
710 changed files with 10 additions and 10 deletions

View File

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

View File

@@ -0,0 +1,65 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static_library("test_dynlink") {
sources = [
"It_los_dynlink.c",
"It_los_dynlink_001.c",
"It_los_dynlink_002.c",
"It_los_dynlink_003.c",
"It_los_dynlink_004.c",
"It_los_dynlink_005.c",
"It_los_dynlink_006.c",
"It_los_dynlink_007.c",
"It_los_dynlink_008.c",
"It_los_dynlink_009.c",
"It_los_dynlink_010.c",
"It_los_dynlink_011.c",
"It_los_dynlink_012.c",
"It_los_dynlink_013.c",
"It_los_dynlink_014.c",
"It_los_dynlink_015.c",
"It_los_dynlink_016.c",
"It_los_dynlink_017.c",
"It_los_dynlink_018.c",
"It_los_dynlink_019.c",
"It_los_dynlink_020.c",
]
include_dirs = [
"../../../../kernel/include",
"../../../../kernel/arch/include",
"../../../include",
"../../../../utils",
"../../../../components/dynlink",
".",
"../../../../components/cpup",
"//third_party/bounds_checking_function/include",
]
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2021-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_dynlink.h"
VOID ItSuiteLosDynlink(VOID)
{
ItLosDynlink001();
ItLosDynlink002();
ItLosDynlink003();
ItLosDynlink004();
ItLosDynlink005();
ItLosDynlink006();
ItLosDynlink007();
ItLosDynlink008();
ItLosDynlink009();
ItLosDynlink010();
ItLosDynlink011();
ItLosDynlink012();
ItLosDynlink013();
ItLosDynlink014();
ItLosDynlink015();
ItLosDynlink016();
ItLosDynlink017();
ItLosDynlink018();
ItLosDynlink019();
ItLosDynlink020();
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2021-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_DYNLINK_H
#define IT_LOS_DYNLINK_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#include "iCunit.h"
#define DSO_PATH "/music/"
#define DSO_FULL_PATH(p) DSO_PATH p
VOID ItLosDynlink001(VOID);
VOID ItLosDynlink002(VOID);
VOID ItLosDynlink003(VOID);
VOID ItLosDynlink004(VOID);
VOID ItLosDynlink005(VOID);
VOID ItLosDynlink006(VOID);
VOID ItLosDynlink007(VOID);
VOID ItLosDynlink008(VOID);
VOID ItLosDynlink009(VOID);
VOID ItLosDynlink010(VOID);
VOID ItLosDynlink012(VOID);
VOID ItLosDynlink013(VOID);
VOID ItLosDynlink014(VOID);
VOID ItLosDynlink015(VOID);
VOID ItLosDynlink016(VOID);
VOID ItLosDynlink017(VOID);
VOID ItLosDynlink018(VOID);
VOID ItLosDynlink019(VOID);
VOID ItLosDynlink020(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _IT_LOS_DYNLINK_H */

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test invalid param */
STATIC UINT32 TestCase(VOID)
{
INT32 ret;
VOID *handle = NULL;
INT32 (*func)(INT32 ,INT32) = NULL;
handle = (VOID *)LOS_SoLoad(NULL, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(NULL, NULL);
ICUNIT_ASSERT_EQUAL(func, NULL, func);
ret = LOS_SoUnload(NULL);
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink001(VOID)
{
TEST_ADD_CASE("ItLosDynlink001", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test invalide params */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
VOID *invalHandle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "test_api";
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_align4.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, NULL);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(NULL, symbolName);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
invalHandle = handle + 1;
func = (INT32 (*)(INT32, INT32))LOS_FindSym(invalHandle, symbolName);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
ret = LOS_SoUnload(invalHandle);
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink002(VOID)
{
TEST_ADD_CASE("ItLosDynlink002", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test dso name of too long length */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
CHAR name[PATH_MAX + 2];
(VOID)memset_s(name, PATH_MAX + 1, 'a', PATH_MAX + 1);
name[PATH_MAX + 1] = '\0';
handle = (VOID *)LOS_SoLoad(name, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink003(VOID)
{
TEST_ADD_CASE("ItLosDynlink003", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test shell script, shared library with ET_EXE flag, shared library with UNIX flag, or bad phdr */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
CHAR *shellName = DSO_FULL_PATH("shell.sh");
CHAR *execName = DSO_FULL_PATH("Align4_dynamic_exec.so");
CHAR *x86Name = DSO_FULL_PATH("Align4_dynamic_x86.so");
handle = (VOID *)LOS_SoLoad(shellName, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
handle = (VOID *)LOS_SoLoad(execName, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
handle = (VOID *)LOS_SoLoad(x86Name, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink004(VOID)
{
TEST_ADD_CASE("ItLosDynlink004", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test shared library with TLS or of align 0x1000 or without dynamic segment */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
CHAR *dsoNeedOthers = DSO_FULL_PATH("Align4_dynamic_need_others.so");
CHAR *dsoWithoutPIC = DSO_FULL_PATH("Align4_dynamic_nopic.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoNeedOthers, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
handle = (VOID *)LOS_SoLoad(dsoWithoutPIC, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink005(VOID)
{
TEST_ADD_CASE("ItLosDynlink005", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test symbol not found for reloc, it's upto shared library */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
CHAR *dsoNameUndVal = DSO_FULL_PATH("dynamic_undval.so");
CHAR *dsoNameUndFunc = DSO_FULL_PATH("dynamic_undfunc.so");
handle = (VOID *)LOS_SoLoad(dsoNameUndVal, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
handle = (VOID *)LOS_SoLoad(dsoNameUndFunc, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink006(VOID)
{
TEST_ADD_CASE("ItLosDynlink006", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test pie */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
INT32 ret;
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_pie.so");
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, "test_api");
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink007(VOID)
{
TEST_ADD_CASE("ItLosDynlink007", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test symbol not found */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *invalSymName1 = "A_invalid_api";
CHAR *invalSymName2 = "N_invalid_api";
CHAR *invalSymName3 = "Z_invalid_api";
CHAR *invalSymName4 = "a_invalid_api";
CHAR *invalSymName5 = "o_invalid_api";
CHAR *invalSymName6 = "z_invalid_api";
CHAR *invalSymName7 = "LOS_InvalidApi";
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_align4.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName1);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName2);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName3);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName4);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName5);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName6);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, invalSymName7);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink008(VOID)
{
TEST_ADD_CASE("ItLosDynlink008", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test Align4_dynamic_align4.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "test_api";
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_align4.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 14, ret, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink009(VOID)
{
TEST_ADD_CASE("ItLosDynlink009", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test Align4_dynamic_align4.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle1 = NULL;
VOID *handle2 = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "test_api";
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_align4.so");
INT32 ret;
handle1 = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle1, NULL, handle1);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle1, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT1);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 14, ret, EXIT1);
handle2 = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_GOTO_NOT_EQUAL(handle2, NULL, handle2, EXIT1);
ICUNIT_GOTO_EQUAL(handle1, handle2, handle2, EXIT2);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle2, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT2);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 14, ret, EXIT2);
ret = LOS_SoUnload(handle2);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
ret = LOS_SoUnload(handle1);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = LOS_SoUnload(handle1);
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
return LOS_OK;
EXIT2:
ret = LOS_SoUnload(handle2);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
EXIT1:
ret = LOS_SoUnload(handle1);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink010(VOID)
{
TEST_ADD_CASE("ItLosDynlink010", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that bss segment in dynamic_bss.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)() = NULL;
INT32 *pValue = NULL;
CHAR *symbolName1 = "dyn_bss_func";
CHAR *symbolName2 = "test_array";
CHAR *dsoName = DSO_FULL_PATH("dynamic_bss.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)())LOS_FindSym(handle, symbolName1);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func();
ICUNIT_GOTO_EQUAL(ret, 2117, ret, EXIT);
pValue = LOS_FindSym(handle, symbolName2);
ICUNIT_GOTO_NOT_EQUAL(pValue, NULL, pValue, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink011(VOID)
{
TEST_ADD_CASE("ItLosDynlink011", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that global symbol int dynamic_static.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "add_test";
CHAR *dsoName = DSO_FULL_PATH("dynamic_static.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(2000, 16);
ICUNIT_GOTO_EQUAL(ret, 2017, ret, EXIT);
ret = func(2017, -1);
ICUNIT_GOTO_EQUAL(ret, 2017, ret, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink012(VOID)
{
TEST_ADD_CASE("ItLosDynlink012", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that function and value to find int dynamic_xxxxx.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)() = NULL;
INT32 *pValueAddr = NULL;
INT32 **ppValueAddr = NULL;
CHAR *symbolName1 = "get_value100";
CHAR *symbolName2 = "get_value200";
CHAR *symbolName3 = "g_value100";
CHAR *symbolName4 = "g_pValue100";
CHAR *symbolName5 = "pValue200";
CHAR *symbolName6 = "g_pValue200";
CHAR *dsoName = DSO_FULL_PATH("dynamic_xxxxx.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)())LOS_FindSym(handle, symbolName1);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func();
ICUNIT_GOTO_EQUAL(ret, 100, ret, EXIT);
func = (INT32 (*)())LOS_FindSym(handle, symbolName2);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func();
ICUNIT_GOTO_EQUAL(ret, 200, ret, EXIT);
pValueAddr = LOS_FindSym(handle, symbolName3);
ICUNIT_GOTO_NOT_EQUAL(pValueAddr, NULL, pValueAddr, EXIT);
ICUNIT_GOTO_EQUAL(*pValueAddr, 100, *pValueAddr, EXIT);
ppValueAddr = LOS_FindSym(handle, symbolName4);
ICUNIT_GOTO_NOT_EQUAL(ppValueAddr, NULL, ppValueAddr, EXIT);
ICUNIT_GOTO_EQUAL(**ppValueAddr, 100, **ppValueAddr, EXIT);
pValueAddr = LOS_FindSym(handle, symbolName5);
ICUNIT_GOTO_EQUAL(pValueAddr, NULL, pValueAddr, EXIT);
ppValueAddr = LOS_FindSym(handle, symbolName6);
ICUNIT_GOTO_NOT_EQUAL(ppValueAddr, NULL, ppValueAddr, EXIT);
ICUNIT_GOTO_EQUAL(**ppValueAddr, 200, **ppValueAddr, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink013(VOID)
{
TEST_ADD_CASE("ItLosDynlink013", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that global and static symbol to find */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
INT32 *pValueAddr = NULL;
INT32 *pStaticValueAddr = NULL;
CHAR *symbolName1 = "add_test";
CHAR *symbolName2 = "static_sub_test";
CHAR *symbolName3 = "g_param";
CHAR *symbolName4 = "staticParam";
CHAR *dsoName = DSO_FULL_PATH("dynamic_static.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName1);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(55, 66);
ICUNIT_GOTO_EQUAL(ret, 122, ret, EXIT);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName2);
ICUNIT_GOTO_EQUAL(func, NULL, func, EXIT);
pValueAddr = LOS_FindSym(handle, symbolName3);
ICUNIT_GOTO_NOT_EQUAL(pValueAddr, NULL, pValueAddr, EXIT);
ICUNIT_GOTO_EQUAL(*pValueAddr, 10, *pValueAddr, EXIT);
pStaticValueAddr = LOS_FindSym(handle, symbolName4);
ICUNIT_GOTO_EQUAL(pStaticValueAddr, NULL, pStaticValueAddr, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink014(VOID)
{
TEST_ADD_CASE("ItLosDynlink014", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that interfaces in dynamic_athmtc.so */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
VOID (*func0)(INT32, INT32 *) = NULL;
VOID (*func1)(CHAR *, CHAR *) = NULL;
CHAR *symbolName1 = "It_dynlink_dowhile";
CHAR *symbolName2 = "It_dynlink_while";
CHAR *symbolName3 = "It_dynlink_for";
CHAR *symbolName4 = "It_dynlink_ifelse";
CHAR *symbolName5 = "It_dynlink_continue";
CHAR *symbolName6 = "It_dynlink_switch";
CHAR *dsoName = DSO_FULL_PATH("dynamic_athmtc.so");
INT32 out = 0;
CHAR inChar[3];
CHAR outChar[3] = { 0 };
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func0 = (VOID (*)(INT32, INT32 *))LOS_FindSym(handle, symbolName1);
ICUNIT_GOTO_NOT_EQUAL(func0, NULL, func0, EXIT);
func0(1, &out);
ICUNIT_GOTO_EQUAL(out, 2, out, EXIT);
func0 = (VOID (*)(INT32, INT32 *))LOS_FindSym(handle, symbolName2);
ICUNIT_GOTO_NOT_EQUAL(func0, NULL, func0, EXIT);
func0(2, &out);
ICUNIT_GOTO_EQUAL(out, 3, out, EXIT);
func0 = (VOID (*)(INT32, INT32 *))LOS_FindSym(handle, symbolName3);
ICUNIT_GOTO_NOT_EQUAL(func0, NULL, func0, EXIT);
func0(3, &out);
ICUNIT_GOTO_EQUAL(out, 4, out, EXIT);
func0 = (VOID (*)(INT32, INT32 *))LOS_FindSym(handle, symbolName4);
ICUNIT_GOTO_NOT_EQUAL(func0, NULL, func0, EXIT);
func0(105, &out);
ICUNIT_GOTO_EQUAL(out, 105, out, EXIT);
func0 = (VOID (*)(INT32, INT32 *))LOS_FindSym(handle, symbolName5);
ICUNIT_GOTO_NOT_EQUAL(func0, NULL, func0, EXIT);
func0(10, &out);
ICUNIT_GOTO_EQUAL(out, 6, out, EXIT);
func1 = (VOID (*)(CHAR *, CHAR *))LOS_FindSym(handle, symbolName6);
ICUNIT_GOTO_NOT_EQUAL(func1, NULL, func1, EXIT);
inChar[0] = 'a';
inChar[1] = 'c';
inChar[2] = 'q';
func1(inChar, outChar);
ICUNIT_GOTO_EQUAL(outChar[0], 'b', outChar[0], EXIT);
ICUNIT_GOTO_EQUAL(outChar[1], 'd', outChar[1], EXIT);
ICUNIT_GOTO_EQUAL(outChar[2], 'z', outChar[2], EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink015(VOID)
{
TEST_ADD_CASE("ItLosDynlink015", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that shared library is not exist */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
CHAR *dsoName = DSO_FULL_PATH("dynamic_noexist.so");
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink016(VOID)
{
TEST_ADD_CASE("ItLosDynlink016", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test init fini segment */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "test_api";
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_init_fini.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 104, ret, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink017(VOID)
{
TEST_ADD_CASE("ItLosDynlink017", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test shared library with align 0x10000 */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *dsoName = DSO_FULL_PATH("dynamic_align10000.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, "test_api");
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 14, ret, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink018(VOID)
{
TEST_ADD_CASE("ItLosDynlink018", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test call global function */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
INT32 (*func)(INT32, INT32) = NULL;
CHAR *symbolName = "caller";
CHAR *dsoName = DSO_FULL_PATH("dynamic_sym.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle);
func = (INT32 (*)(INT32, INT32))LOS_FindSym(handle, symbolName);
ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT);
ret = func(1, 1);
ICUNIT_GOTO_EQUAL(ret, 2033, ret, EXIT);
EXIT:
ret = LOS_SoUnload(handle);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return LOS_OK;
}
VOID ItLosDynlink019(VOID)
{
TEST_ADD_CASE("ItLosDynlink019", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_dynlink.h"
#include "It_los_dynlink.h"
/* Test that Align4_dynamic_stdlib.so, libc.a not with fPIC */
STATIC UINT32 TestCase(VOID)
{
VOID *handle = NULL;
VOID (*func)(INT32, INT32) = NULL;
CHAR *dsoName = DSO_FULL_PATH("Align4_dynamic_stdlib.so");
INT32 ret;
handle = (VOID *)LOS_SoLoad(dsoName, NULL);
ICUNIT_ASSERT_EQUAL(handle, NULL, handle);
return LOS_OK;
}
VOID ItLosDynlink020(VOID)
{
TEST_ADD_CASE("ItLosDynlink020", TestCase, TEST_LOS, TEST_DYNLINK, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,84 @@
# 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.
GCC_PREFIX = arm-none-eabi-
CROSS_GCC = $(GCC_PREFIX)gcc
GCC = gcc
RM = -rm -rf
HIDE = @
PREFIX = Align4_
TESTCASENAME = dynamic_
CASE = $(TESTCASENAME)
AGCASE = $(PREFIX)$(TESTCASENAME)
SRCS = $(wildcard *.c)
SO = $(patsubst %.c,%.so,$(SRCS))
ALIGN_SO = $(patsubst %.c,$(PREFIX)%.so,$(SRCS))
# cpu
CPU = -mcpu=cortex-m4
# fpu
FPU = -mfpu=fpv4-sp-d16
# float-abi
FLOAT-ABI = -mfloat-abi=hard
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
CFLAGS = -nostdlib -nostartfiles
ALIGN_CFLAGS = $(CFLAGS) -z max-page-size=4
INIT_FINI_CFLAGS = $(ALIGN_CFLAGS) -Wl,-init,init_first -Wl,-fini,fini_end
all: $(SO) $(ALIGN_SO)
$(SO): %.so : %.c
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)athmtc.c -o $(CASE)athmtc.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)bss.c -o $(CASE)bss.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)initfini.c -o $(CASE)align10000.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)static.c -o $(CASE)static.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)sym.c -o $(CASE)sym.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)undfunc.c -o $(CASE)undfunc.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)undval.c -o $(CASE)undval.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CFLAGS) $(CASE)xxxxx.c -o $(CASE)xxxxx.so
$(ALIGN_SO): $(PREFIX)%.so : %.c
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)align4.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(INIT_FINI_CFLAGS) $(CASE)initfini.c -o $(AGCASE)init_fini.so
# shared library not for need
$(HIDE)$(GCC) -fPIC -shared $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)x86.so
$(HIDE)$(CROSS_GCC) -fPIE -pie $(MCU) $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)pie.so
$(HIDE)$(CROSS_GCC) $(MCU) $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)exec.so
$(HIDE)$(CROSS_GCC) -shared $(MCU) $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)nopic.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(ALIGN_CFLAGS) $(AGCASE)align4.so $(CASE)initfini.c -o \
$(AGCASE)need_others.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(ALIGN_CFLAGS) $(CASE)initfini.c -o $(AGCASE)noThumb.so
$(HIDE)$(CROSS_GCC) -fPIC -shared $(MCU) $(CASE)initfini.c -o $(AGCASE)stdlib.so
clean:
$(HIDE)$(RM) *.so
.PHONY: all clean

View File

@@ -0,0 +1,163 @@
/*
* Copyright (c) 2021-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.
*/
#define OK 0
#define NOK 1
void It_dynlink_dowhile(int cnt, int *out)
{
int outParam = 0;
cnt += 1;
do {
++outParam;
--cnt;
} while (cnt);
*out = outParam;
}
void It_dynlink_while(int cnt, int *out)
{
int index = 0;
int outParam = 0;
cnt += 1;
while ((index++) < cnt) {
outParam += 1;
}
*out = outParam;
}
void It_dynlink_for(int cnt, int *out)
{
int index = 0;
int outParam = 0;
cnt += 1;
for (; index < cnt; ++index) {
++outParam;
}
*out = outParam;
}
void It_dynlink_ifelse(int inVal, int *outVal)
{
int outParam;
if (inVal <= 101) {
outParam = 101;
} else if (inVal == 102) {
outParam = inVal;
} else if (inVal == 103) {
outParam = inVal;
} else if (inVal == 104) {
outParam = inVal;
} else if (inVal == 105) {
outParam = inVal;
} else if (inVal == 106) {
outParam = inVal;
} else if (inVal == 107) {
outParam = inVal;
} else if (inVal == 108) {
outParam = inVal + 1;
} else if (inVal == 109) {
outParam = 45;
} else {
outParam = 45;
}
*outVal = outParam;
}
void It_dynlink_continue(int cnt, int *out)
{
int index = 0;
int outParam = 0;
cnt += 2;
for (; index < cnt; ++index) {
if (index % 2) {
continue;
} else {
++outParam;
}
}
*out = outParam;
}
void It_dynlink_switch(char *inVal, char *outVal)
{
int i;
char outParam;
for (i = 0; i < 3; ++i) {
switch (inVal[i]) {
case 'A':
case 'a':
outParam = 'b';
break;
case 'B':
case 'b':
outParam = 'c';
break;
case 'C':
case 'c':
outParam = 'd';
break;
case 'D':
case 'd':
outParam = 'e';
break;
case 'E':
case 'e':
outParam = 'f';
break;
case 'F':
case 'f':
outParam = 'g';
break;
case 'G':
case 'g':
outParam = 'h';
break;
case 'H':
case 'h':
outParam = 'i';
break;
default:
outParam = 'z';
break;
}
outVal[i] = outParam;
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2021-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.
*/
int test_array[100];
int dyn_bss_func(void)
{
test_array[0] += 100;
return 2017 + test_array[0];
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2021-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 "stdio.h"
#include "stdlib.h"
void init_test(void) __attribute__((constructor));
void fini_test(void) __attribute((destructor));
int g_param = 10;
static int param = 2;
void init_first(void)
{
g_param = 100;
}
void init_test(void)
{
g_param += param;
}
void fini_end(void)
{
g_param = 0;
}
void fini_test(void)
{
param = 0;
}
int callee(int a, int b)
{
return g_param + a + b;
}
int test_api(int a, int b)
{
int c = callee(a, b);
return c;
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2021-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.
*/
static int staticParam = 9;
int g_param = 10;
int add_test(int a, int b)
{
int c;
c = a + b + g_param - staticParam;
return c;
}
static int static_sub_test(int a, int b)
{
int c;
c = a - b + g_param - staticParam;
return c;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 2021-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.
*/
int g_param = 10;
int callee(int a, int b)
{
return a + b + g_param;
}
int caller(int a, int b)
{
return 2021 + callee(a, b);
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2021-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.
*/
extern int undef_func(int a, int b);
int caller(int a, int b)
{
return a + undef_func(a, b);
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2021-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.
*/
extern int g_param;
int caller(int a, int b)
{
return a + b + g_param;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2021-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.
*/
int g_value100 = 100;
int *g_pValue100 = &g_value100;
static int value200 = 200;
int *g_pValue200 = &value200;
int get_value100(void)
{
return *g_pValue100;
}
int get_value200(void)
{
return *g_pValue200;
}

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# 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.
LOAD_FLAG=false

View File

@@ -0,0 +1,78 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static_library("test_event") {
sources = [
"It_los_event.c",
"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",
]
configs += [ "//kernel/liteos_m/testsuites:include" ]
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_event.h"
EVENT_CB_S g_pevent;
VOID ItSuiteLosEvent()
{
ItLosEvent001();
ItLosEvent003();
ItLosEvent004();
ItLosEvent005();
ItLosEvent006();
ItLosEvent007();
ItLosEvent008();
ItLosEvent009();
ItLosEvent010();
ItLosEvent013();
ItLosEvent014();
ItLosEvent016();
ItLosEvent017();
ItLosEvent018();
ItLosEvent021();
ItLosEvent022();
ItLosEvent026();
ItLosEvent029();
ItLosEvent031();
ItLosEvent035();
ItLosEvent036();
ItLosEvent037();
ItLosEvent040();
ItLosEvent041();
ItLosEvent042();
ItLosEvent043();
#if (LOS_KERNEL_TEST_FULL == 1)
ItLosEvent002();
ItLosEvent011();
ItLosEvent012();
ItLosEvent015();
ItLosEvent019();
ItLosEvent020();
ItLosEvent027();
ItLosEvent028();
ItLosEvent030();
ItLosEvent032();
ItLosEvent033();
ItLosEvent034();
ItLosEvent039();
#if (LOS_KERNEL_HWI_TEST == 1)
ItLosEvent023();
ItLosEvent024();
ItLosEvent038();
#endif
#endif
}

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define SELF_DELETED 0
#define SYS_EXIST_SWTMR 1
#define TEST_HWI_RUNTIME 0x100000
#define TASK_LOOP_NUM 0x100000
#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 /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,101 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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_ATTR_JOINABLE;
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++;
ret = LOS_TaskJoin(g_testTaskID01, NULL);
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);
LOS_TaskJoin(g_testCount, NULL);
return LOS_OK;
}
VOID ItLosEvent003(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosEvent003", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL1, TEST_FUNCTION);
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,72 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,113 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,126 @@
/*
* 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_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);
}

View File

@@ -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.
*/
#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);
}

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,104 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,113 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,137 @@
/*
* 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_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);
}

View File

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

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,153 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -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.
*/
#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);
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

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

View File

@@ -0,0 +1,160 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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(11); // 11, set delay time.
if (g_testCount < 10) { // 10, Here, assert that g_testCount is equal to 10.
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);
}

View File

@@ -0,0 +1,53 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,151 @@
/*
* 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_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);
}

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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, 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);
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "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);
}

View File

@@ -0,0 +1,71 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static_library("test_hwi") {
sources = [
"It_los_hwi.c",
"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",
"llt_los_hwi_035.c",
]
configs += [ "//kernel/liteos_m/testsuites:include" ]
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "it_los_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();
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IT_LOS_HWI_H
#define IT_LOS_HWI_H
#include "osTest.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __RISC_V__
#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 /* __cplusplus */
#endif /* __cplusplus */
#endif /* IT_LOS_HWI_H */

View File

@@ -0,0 +1,59 @@
/*
* 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"
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,84 @@
/*
* 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"
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
#ifdef __RISC_V__
#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_TEST2, 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_TEST2);
return LOS_OK;
EXIT2:
TestHwiDelete(HWI_NUM_INT1);
TestHwiDelete(HWI_NUM_TEST2);
return LOS_OK;
EXIT1:
TestHwiDelete(HWI_NUM_TEST2);
return LOS_OK;
}
VOID ItLosHwi005(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosHwi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,72 @@
/*
* 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"
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;
UINT32 intSave;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
intSave = LOS_IntLock();
TestHwiTrigger(HWI_NUM_TEST);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
LOS_IntRestore(intSave);
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);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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;
UINT32 intSave1;
UINT32 intSave2;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
intSave1 = LOS_IntLock();
intSave2 = LOS_IntLock();
TestHwiTrigger(HWI_NUM_TEST);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
LOS_IntRestore(intSave2);
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
LOS_IntRestore(intSave1);
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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 __RISC_V__
HWI_PRIOR_T hwiPrio = 3;
#else
HWI_PRIOR_T hwiPrio = 1;
#endif
HWI_MODE_T mode = 0;
HWI_ARG_T arg = 0;
UINT32 intSave;
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 __RISC_V__
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);
intSave = LOS_IntLock();
TestHwiTrigger(HWI_NUM_TEST3);
TestHwiTrigger(HWI_NUM_TEST2);
TestHwiTrigger(HWI_NUM_TEST1);
LOS_IntRestore(intSave);
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);
}

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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;
UINT32 intSave;
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);
intSave = LOS_IntLock();
TestHwiTrigger(HWI_NUM_TEST1);
TestHwiTrigger(HWI_NUM_TEST3);
TestHwiTrigger(HWI_NUM_TEST);
LOS_IntRestore(intSave);
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);
}

View File

@@ -0,0 +1,101 @@
/*
* 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"
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -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.
*/
#include "osTest.h"
#include "it_los_hwi.h"
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);
}

View File

@@ -0,0 +1,101 @@
/*
* 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"
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);
}

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