feat:增加smp ipc测试用例
Signed-off-by: chenjiafan <chenjiafan24367@openvalley.net> Change-Id: If0695aa4a6af947537ea2de0b61fdd5dbcee2fd9
This commit is contained in:
parent
e22e8525e9
commit
70022950ac
|
@ -249,6 +249,13 @@ extern UINT32 TaskUsedCountGet(VOID);
|
|||
#define TASK_EXISTED_NUM TaskUsedCountGet()
|
||||
#define QUEUE_EXISTED_NUM QueueUsedCountGet()
|
||||
|
||||
extern UINT64 TestTickCountGet(VOID);
|
||||
extern UINT64 TestTickCountByCurrCpuid(VOID);
|
||||
extern VOID TestBusyTaskDelay(UINT32 tick);
|
||||
extern VOID TestAssertBusyTaskDelay(UINT32 timeout, UINT32 flag);
|
||||
|
||||
#define TEST_HwiClear(ID) LOS_HwiClear(ID)
|
||||
|
||||
#define HWI_NUM_INT_NEG (-4)
|
||||
#define HWI_NUM_INT0 0
|
||||
#define HWI_NUM_INT1 1
|
||||
|
|
|
@ -74,7 +74,29 @@ static_library("test_event") {
|
|||
"It_los_event_041.c",
|
||||
"It_los_event_042.c",
|
||||
"It_los_event_043.c",
|
||||
"smp/It_smp_los_event_001.c",
|
||||
"smp/It_smp_los_event_002.c",
|
||||
"smp/It_smp_los_event_003.c",
|
||||
"smp/It_smp_los_event_004.c",
|
||||
"smp/It_smp_los_event_005.c",
|
||||
"smp/It_smp_los_event_006.c",
|
||||
"smp/It_smp_los_event_007.c",
|
||||
"smp/It_smp_los_event_008.c",
|
||||
"smp/It_smp_los_event_009.c",
|
||||
"smp/It_smp_los_event_010.c",
|
||||
"smp/It_smp_los_event_011.c",
|
||||
"smp/It_smp_los_event_012.c",
|
||||
"smp/It_smp_los_event_013.c",
|
||||
"smp/It_smp_los_event_014.c",
|
||||
"smp/It_smp_los_event_015.c",
|
||||
"smp/It_smp_los_event_016.c",
|
||||
"smp/It_smp_los_event_017.c",
|
||||
"smp/It_smp_los_event_018.c",
|
||||
"smp/It_smp_los_event_019.c",
|
||||
"smp/It_smp_los_event_020.c",
|
||||
]
|
||||
|
||||
include_dirs = [ "." ]
|
||||
|
||||
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
|
||||
}
|
||||
|
|
|
@ -83,4 +83,27 @@ VOID ItSuiteLosEvent()
|
|||
ItLosEvent038();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
ItSmpLosEvent001();
|
||||
ItSmpLosEvent002();
|
||||
ItSmpLosEvent003();
|
||||
ItSmpLosEvent004();
|
||||
ItSmpLosEvent005();
|
||||
ItSmpLosEvent006();
|
||||
ItSmpLosEvent007();
|
||||
ItSmpLosEvent008();
|
||||
ItSmpLosEvent009();
|
||||
ItSmpLosEvent010();
|
||||
ItSmpLosEvent011();
|
||||
ItSmpLosEvent012();
|
||||
ItSmpLosEvent013();
|
||||
ItSmpLosEvent014();
|
||||
ItSmpLosEvent015();
|
||||
ItSmpLosEvent016();
|
||||
ItSmpLosEvent017();
|
||||
ItSmpLosEvent018();
|
||||
ItSmpLosEvent019();
|
||||
ItSmpLosEvent020();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -110,6 +110,27 @@ extern VOID ItLosEvent041(VOID);
|
|||
extern VOID ItLosEvent042(VOID);
|
||||
extern VOID ItLosEvent043(VOID);
|
||||
|
||||
extern VOID ItSmpLosEvent001(VOID);
|
||||
extern VOID ItSmpLosEvent002(VOID);
|
||||
extern VOID ItSmpLosEvent003(VOID);
|
||||
extern VOID ItSmpLosEvent004(VOID);
|
||||
extern VOID ItSmpLosEvent005(VOID);
|
||||
extern VOID ItSmpLosEvent006(VOID);
|
||||
extern VOID ItSmpLosEvent007(VOID);
|
||||
extern VOID ItSmpLosEvent008(VOID);
|
||||
extern VOID ItSmpLosEvent009(VOID);
|
||||
extern VOID ItSmpLosEvent010(VOID);
|
||||
extern VOID ItSmpLosEvent011(VOID);
|
||||
extern VOID ItSmpLosEvent012(VOID);
|
||||
extern VOID ItSmpLosEvent013(VOID);
|
||||
extern VOID ItSmpLosEvent014(VOID);
|
||||
extern VOID ItSmpLosEvent015(VOID);
|
||||
extern VOID ItSmpLosEvent016(VOID);
|
||||
extern VOID ItSmpLosEvent017(VOID);
|
||||
extern VOID ItSmpLosEvent018(VOID);
|
||||
extern VOID ItSmpLosEvent019(VOID);
|
||||
extern VOID ItSmpLosEvent020(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_EventDestroy(&g_pevent);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent001(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent001", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_EventDestroy(&g_pevent);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent002(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent002", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_EventDestroy(&g_pevent);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent003", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_004_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent004(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent004", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_005_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_005_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent005(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent005", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_006_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
TestBusyTaskDelay(2); // 2, delay enouge time
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL((ret & OS_TASK_STATUS_PEND), 0, ret, EXIT);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent006(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent006", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
// 2, Set the priority according to the task purpose,a smaller number means a higher priority.
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_007_task1", TaskF01, TASK_PRIO_TEST - 2,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_007_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(10); // 10, delay enouge time
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID02)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_UNUSED, 0, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent007(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent007", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_READ_IN_INTERRUPT, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_EventDestroy(&g_pevent);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent008", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_009_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
TestBusyTaskDelay(2); // 2, delay enouge time
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL((ret & OS_TASK_STATUS_PEND), 0, ret, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, wait until g_testCount is 2 ,or do noting
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_PEND, 0, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent009", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_010_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_010_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
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_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent010", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_011_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_011_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent011", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_012_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent012", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, 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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_013_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_013_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(10); // 10, delay enouge time
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent013", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
return;
|
||||
}
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
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);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_014_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_014_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent014", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&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);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, wait until g_testCount is 2 ,or do noting
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_015_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent015(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent015", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_016_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent016(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent016", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_017_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent017(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent017", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_018_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent018(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent018", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent019(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent019", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_EventWrite(&g_pevent, 0x11);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
g_pevent.uwEventID = 0;
|
||||
|
||||
ret = LOS_EventInit(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_020_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(1);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_EventRead(&g_pevent, 0x11, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, g_pevent.uwEventID, ret);
|
||||
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_EventDestroy(&g_pevent);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosEvent020(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosEvent020", Testcase, TEST_LOS, TEST_EVENT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -64,7 +64,28 @@ static_library("test_mux") {
|
|||
"It_los_mutex_033.c",
|
||||
"It_los_mutex_034.c",
|
||||
"It_los_mux.c",
|
||||
"smp/It_smp_los_mux_001.c",
|
||||
"smp/It_smp_los_mux_002.c",
|
||||
"smp/It_smp_los_mux_003.c",
|
||||
"smp/It_smp_los_mux_004.c",
|
||||
"smp/It_smp_los_mux_005.c",
|
||||
"smp/It_smp_los_mux_006.c",
|
||||
"smp/It_smp_los_mux_007.c",
|
||||
"smp/It_smp_los_mux_008.c",
|
||||
"smp/It_smp_los_mux_009.c",
|
||||
"smp/It_smp_los_mux_010.c",
|
||||
"smp/It_smp_los_mux_011.c",
|
||||
"smp/It_smp_los_mux_012.c",
|
||||
"smp/It_smp_los_mux_013.c",
|
||||
"smp/It_smp_los_mux_014.c",
|
||||
"smp/It_smp_los_mux_015.c",
|
||||
"smp/It_smp_los_mux_016.c",
|
||||
"smp/It_smp_los_mux_017.c",
|
||||
"smp/It_smp_los_mux_018.c",
|
||||
"smp/It_smp_los_mux_019.c",
|
||||
]
|
||||
|
||||
include_dirs = [ "." ]
|
||||
|
||||
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
|
||||
}
|
||||
|
|
|
@ -52,6 +52,28 @@ VOID ItSuiteLosMux(void)
|
|||
ItLosMux029();
|
||||
ItLosMux031();
|
||||
|
||||
#if LOSCFG_KERNEL_SMP
|
||||
ItSmpLosMux001();
|
||||
ItSmpLosMux002();
|
||||
ItSmpLosMux003();
|
||||
ItSmpLosMux004();
|
||||
ItSmpLosMux005();
|
||||
ItSmpLosMux006();
|
||||
ItSmpLosMux007();
|
||||
ItSmpLosMux008();
|
||||
ItSmpLosMux009();
|
||||
ItSmpLosMux010();
|
||||
ItSmpLosMux011();
|
||||
ItSmpLosMux012();
|
||||
ItSmpLosMux013();
|
||||
ItSmpLosMux014();
|
||||
ItSmpLosMux015();
|
||||
ItSmpLosMux016();
|
||||
ItSmpLosMux017();
|
||||
ItSmpLosMux018();
|
||||
ItSmpLosMux019();
|
||||
#endif
|
||||
|
||||
#if (LOS_KERNEL_TEST_FULL == 1)
|
||||
ItLosMux007();
|
||||
ItLosMux010();
|
||||
|
|
|
@ -81,6 +81,26 @@ VOID ItSuiteLosMux(void);
|
|||
VOID ItLosMux020(void);
|
||||
#endif
|
||||
|
||||
VOID ItSmpLosMux001(VOID);
|
||||
VOID ItSmpLosMux002(VOID);
|
||||
VOID ItSmpLosMux003(VOID);
|
||||
VOID ItSmpLosMux004(VOID);
|
||||
VOID ItSmpLosMux005(VOID);
|
||||
VOID ItSmpLosMux006(VOID);
|
||||
VOID ItSmpLosMux007(VOID);
|
||||
VOID ItSmpLosMux008(VOID);
|
||||
VOID ItSmpLosMux009(VOID);
|
||||
VOID ItSmpLosMux010(VOID);
|
||||
VOID ItSmpLosMux011(VOID);
|
||||
VOID ItSmpLosMux012(VOID);
|
||||
VOID ItSmpLosMux013(VOID);
|
||||
VOID ItSmpLosMux014(VOID);
|
||||
VOID ItSmpLosMux015(VOID);
|
||||
VOID ItSmpLosMux016(VOID);
|
||||
VOID ItSmpLosMux017(VOID);
|
||||
VOID ItSmpLosMux018(VOID);
|
||||
VOID ItSmpLosMux019(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = 5;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux001(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux001", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = 5;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux002(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux002", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static void Hwi01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_IN_INTERR, ret);
|
||||
|
||||
TEST_HwiClear(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)Hwi01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid));
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = 5;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_MuxPost(g_mutexTest1);
|
||||
LOS_TaskDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux003(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux003", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = 5;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux004(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux004", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_PENDED, ret);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.usTaskPrio = 5;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux005(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux005", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static void Task02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest2);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest2, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest2);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest2);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid, currCpuid2;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
TSK_INIT_PARAM_S task2 = { 0 };
|
||||
currCpuid = ArchCurrCpuid() % (LOSCFG_KERNEL_CORE_NUM - 1) + 1;
|
||||
currCpuid2 = currCpuid % (LOSCFG_KERNEL_CORE_NUM - 1) + 1;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task2.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
|
||||
task2.pcName = "Test Case 2";
|
||||
task2.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task2.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid2);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task2);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, here assert the result.
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux006(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux006", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static void Task01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
TestBusyTaskDelay(5); // 5, delay for Timing control.
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static void Task02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
TestBusyTaskDelay(5); // 5, delay for Timing control.
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
g_testCount++;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid, currCpuid2;
|
||||
g_testCount = 0;
|
||||
TSK_INIT_PARAM_S task = { 0 };
|
||||
TSK_INIT_PARAM_S task2 = { 0 };
|
||||
currCpuid = ArchCurrCpuid() % (LOSCFG_KERNEL_CORE_NUM - 1) + 1;
|
||||
currCpuid2 = currCpuid % (LOSCFG_KERNEL_CORE_NUM - 1) + 1;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
|
||||
task.pcName = "Test Case 1";
|
||||
task.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
task2.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
|
||||
task2.pcName = "Test Case 2";
|
||||
task2.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task2.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid2);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task2);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, here assert the result.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux007(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux007", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_008_task", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux008", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_009_task", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux009", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
LOS_HwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux010", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, 3, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
EXIT:
|
||||
LOS_MuxPost(g_mutexTest1);
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // 2, here assert the result.
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_PENDED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_011_task2", TaskF02, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_011_task1", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 4); // 100, 4, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux011", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static UINT32 volatile g_runFlag = 0;
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_runFlag);
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
g_runFlag = 1;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_012_task1", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_MUX_PENDED, ret);
|
||||
|
||||
g_runFlag = 0;
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, 3, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux012", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
LOS_TaskDelay(2); // 2, delay for Timing control.
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // 2, here assert the result.
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_PENDED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
// 2, set reasonable priority.
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_013_task1", TaskF01, 5 - 2,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_013_task2", TaskF02, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 4); // 100, 4, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result.
|
||||
|
||||
LOS_TaskDelay(10); // 10, delay for Timing control.
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_UNUSED, 0, ret, EXIT);
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID02)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_UNUSED, 0, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux013", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_IN_INTERR, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
LOS_HwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux014", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, 3, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
EXIT:
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_PENDED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_015_task", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
LOS_HwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 4); // 100, 4, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelay(10); // 10, delay for Timing control.
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux015(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux015", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
EXIT:
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_016_task1", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux016(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux016", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
LOS_TaskDelay(2); // 2, delay for Timing control.
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // 2, here assert the result. // task f01 pend
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_017_task2", TaskF02, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_017_task1", TaskF01, 5 + 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(10); // 10, delay for Timing control. // TaskF01 run
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, here assert the result.
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux017(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux017", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 2, g_testCount); // 2, here assert the result.
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, 5); // 5, init mutex.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_TIMEOUT, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result.
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
LOS_TaskDelay(100); // 100, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, here assert the result.
|
||||
EXIT:
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_MUX_IN_INTERR, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_018_task1", TaskF02, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, 2, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result.
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_018_task2", TaskF01, 5 + 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(1); // task f01 run
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result.
|
||||
|
||||
LOS_HwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
LOS_TaskDelay(200); // 200, set delay time.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); // 6, here assert the result.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
VOID ItSmpLosMux018(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux018", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 3); // 3, wait until g_testCount == 3.
|
||||
|
||||
ret = LOS_MuxDelete(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPend(g_mutexTest1, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_019_task1", TaskF01, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_mux_019_task2", TaskF02, 5 - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_MuxPost(g_mutexTest1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 4); // 100, 4, delay for Timing control.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_MuxDelete(g_mutexTest1);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosMux019(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosMux019", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -188,7 +188,34 @@ static_library("test_queue") {
|
|||
"It_los_queue_static_006.c",
|
||||
"LLt_los_queue_003.c",
|
||||
"Llt_los_queue_001.c",
|
||||
"smp/It_smp_los_queue_001.c",
|
||||
"smp/It_smp_los_queue_002.c",
|
||||
"smp/It_smp_los_queue_003.c",
|
||||
"smp/It_smp_los_queue_004.c",
|
||||
"smp/It_smp_los_queue_005.c",
|
||||
"smp/It_smp_los_queue_006.c",
|
||||
"smp/It_smp_los_queue_007.c",
|
||||
"smp/It_smp_los_queue_008.c",
|
||||
"smp/It_smp_los_queue_009.c",
|
||||
"smp/It_smp_los_queue_010.c",
|
||||
"smp/It_smp_los_queue_011.c",
|
||||
"smp/It_smp_los_queue_012.c",
|
||||
"smp/It_smp_los_queue_013.c",
|
||||
"smp/It_smp_los_queue_014.c",
|
||||
"smp/It_smp_los_queue_015.c",
|
||||
"smp/It_smp_los_queue_016.c",
|
||||
"smp/It_smp_los_queue_017.c",
|
||||
"smp/It_smp_los_queue_018.c",
|
||||
"smp/It_smp_los_queue_019.c",
|
||||
"smp/It_smp_los_queue_020.c",
|
||||
"smp/It_smp_los_queue_021.c",
|
||||
"smp/It_smp_los_queue_022.c",
|
||||
"smp/It_smp_los_queue_023.c",
|
||||
"smp/It_smp_los_queue_024.c",
|
||||
"smp/It_smp_los_queue_025.c",
|
||||
]
|
||||
|
||||
include_dirs = [ "." ]
|
||||
|
||||
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ VOID ItSuiteLosQueue(VOID)
|
|||
ItLosQueueHead040();
|
||||
ItLosQueueHead041();
|
||||
ItLosQueueHead042();
|
||||
|
||||
ItLosQueueIsr001();
|
||||
ItLosQueueIsr002();
|
||||
ItLosQueueIsr003();
|
||||
|
@ -167,6 +168,35 @@ VOID ItSuiteLosQueue(VOID)
|
|||
ItLosQueueIsr014();
|
||||
ItLosQueueIsr015();
|
||||
ItLosQueueIsr016();
|
||||
|
||||
#if LOSCFG_KERNEL_SMP
|
||||
ItSmpLosQueue001();
|
||||
ItSmpLosQueue002();
|
||||
ItSmpLosQueue003();
|
||||
ItSmpLosQueue004();
|
||||
ItSmpLosQueue005();
|
||||
ItSmpLosQueue006();
|
||||
ItSmpLosQueue007();
|
||||
ItSmpLosQueue008();
|
||||
ItSmpLosQueue009();
|
||||
ItSmpLosQueue010();
|
||||
ItSmpLosQueue011();
|
||||
ItSmpLosQueue012();
|
||||
ItSmpLosQueue013();
|
||||
ItSmpLosQueue014();
|
||||
ItSmpLosQueue015();
|
||||
ItSmpLosQueue016();
|
||||
ItSmpLosQueue017();
|
||||
ItSmpLosQueue018();
|
||||
ItSmpLosQueue019();
|
||||
ItSmpLosQueue020();
|
||||
ItSmpLosQueue021();
|
||||
ItSmpLosQueue022();
|
||||
ItSmpLosQueue023();
|
||||
ItSmpLosQueue024();
|
||||
ItSmpLosQueue025();
|
||||
#endif
|
||||
|
||||
#if (LOS_KERNEL_TEST_FULL == 1)
|
||||
#if (LOS_KERNEL_HWI_TEST == 1)
|
||||
ItLosQueue044();
|
||||
|
|
|
@ -43,6 +43,8 @@ extern "C" {
|
|||
#define QUEUE_BASE_NUM 3
|
||||
#define QUEUE_BASE_MSGSIZE 8
|
||||
|
||||
#define LOOP 100
|
||||
|
||||
#define PER_ADDED_VALUE 1
|
||||
|
||||
extern UINT32 g_testTaskID01;
|
||||
|
@ -212,6 +214,32 @@ extern VOID ItLosQueueStatic006(VOID);
|
|||
extern VOID ItLosQueue046(VOID);
|
||||
#endif
|
||||
|
||||
extern VOID ItSmpLosQueue001(VOID);
|
||||
extern VOID ItSmpLosQueue002(VOID);
|
||||
extern VOID ItSmpLosQueue003(VOID);
|
||||
extern VOID ItSmpLosQueue004(VOID);
|
||||
extern VOID ItSmpLosQueue005(VOID);
|
||||
extern VOID ItSmpLosQueue006(VOID);
|
||||
extern VOID ItSmpLosQueue007(VOID);
|
||||
extern VOID ItSmpLosQueue008(VOID);
|
||||
extern VOID ItSmpLosQueue009(VOID);
|
||||
extern VOID ItSmpLosQueue010(VOID);
|
||||
extern VOID ItSmpLosQueue011(VOID);
|
||||
extern VOID ItSmpLosQueue012(VOID);
|
||||
extern VOID ItSmpLosQueue013(VOID);
|
||||
extern VOID ItSmpLosQueue014(VOID);
|
||||
extern VOID ItSmpLosQueue015(VOID);
|
||||
extern VOID ItSmpLosQueue016(VOID);
|
||||
extern VOID ItSmpLosQueue017(VOID);
|
||||
extern VOID ItSmpLosQueue018(VOID);
|
||||
extern VOID ItSmpLosQueue019(VOID);
|
||||
extern VOID ItSmpLosQueue020(VOID);
|
||||
extern VOID ItSmpLosQueue021(VOID);
|
||||
extern VOID ItSmpLosQueue022(VOID);
|
||||
extern VOID ItSmpLosQueue023(VOID);
|
||||
extern VOID ItSmpLosQueue024(VOID);
|
||||
extern VOID ItSmpLosQueue025(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue001(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue001", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue002(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue002", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue003", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_004_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_QUEUE_IN_TSKUSE, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue004(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue004", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_IN_TSKUSE, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_005_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_005_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue005(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue005", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_006_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
TestBusyTaskDelay(2); // 2, Set the timeout of runtime;
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_PEND, 0, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_QUEUE_IN_TSKUSE, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelay(10); // 10, set delay time.
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_UNUSED, 0, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue006(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue006", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_IN_TSKUSE, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
// 2, set new task priority, it is higher than the current task.
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_007_task1", TaskF01, TASK_PRIO_TEST - 2,
|
||||
CPUID_TO_AFFI_MASK(currCpuid));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_007_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue007(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue007", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_READ_IN_INTERRUPT, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue008", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_IN_TSKUSE, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_009_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_PEND, 0, ret, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelay(10); // 10, set delay time.
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_UNUSED, 0, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue009", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, 0); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
// 2, set new task priority, it is higher than the current task.
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_010_task1", TaskF01, TASK_PRIO_TEST - 2,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_010_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue010", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_011_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_011_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue011", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_NO_WAIT); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_012_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue012", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, Here, judgment that g_testCount is not equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_013_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_013_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count.
|
||||
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_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue013", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, Here, judgment that g_testCount is not equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_014_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_014_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count.
|
||||
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_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue014", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_NO_WAIT); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, Here, judgment that g_testCount is not equal to 3.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_015_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
|
||||
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue015(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue015", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_016_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue016(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue016", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_017_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue017(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue017", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_018_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue018(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue018", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_NO_WAIT); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue019(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue019", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_020_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue020(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue020", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_021_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue021(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue021", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_READ_IN_INTERRUPT, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_022_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue022(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue022", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_023_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_023_task", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // othercpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue023(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue023", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_024_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_024_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue024(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue024", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
|
||||
static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &g_buff1, 8, LOS_WAIT_FOREVER); // 8, Write the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &g_buff2, 8, LOS_WAIT_FOREVER); // 8, Read the setting size of queue buffer.
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_READ_IN_INTERRUPT, ret);
|
||||
|
||||
ret = LOS_QueueDelete(g_testQueueID01);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 8); // 8, Set the maximum data length of the message queue.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_queue_025_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_QueueDelete(g_testQueueID01);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosQueue025(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosQueue025", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -75,7 +75,20 @@ static_library("test_sem") {
|
|||
"it_los_sem_041.c",
|
||||
"it_los_sem_042.c",
|
||||
"it_los_sem_043.c",
|
||||
"smp/It_smp_los_sem_001.c",
|
||||
"smp/It_smp_los_sem_002.c",
|
||||
"smp/It_smp_los_sem_003.c",
|
||||
"smp/It_smp_los_sem_004.c",
|
||||
"smp/It_smp_los_sem_005.c",
|
||||
"smp/It_smp_los_sem_006.c",
|
||||
"smp/It_smp_los_sem_007.c",
|
||||
"smp/It_smp_los_sem_008.c",
|
||||
"smp/It_smp_los_sem_009.c",
|
||||
"smp/It_smp_los_sem_010.c",
|
||||
"smp/It_smp_los_sem_011.c",
|
||||
]
|
||||
|
||||
include_dirs = [ "." ]
|
||||
|
||||
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
|
||||
}
|
||||
|
|
|
@ -84,4 +84,18 @@ VOID ItSuiteLosSem(void)
|
|||
ItLosSem037();
|
||||
ItLosSem039();
|
||||
#endif
|
||||
|
||||
#if LOSCFG_KERNEL_SMP
|
||||
ItSmpLosSem001();
|
||||
ItSmpLosSem002();
|
||||
ItSmpLosSem003();
|
||||
ItSmpLosSem004();
|
||||
ItSmpLosSem005();
|
||||
ItSmpLosSem006();
|
||||
ItSmpLosSem007();
|
||||
ItSmpLosSem008();
|
||||
ItSmpLosSem009();
|
||||
ItSmpLosSem010();
|
||||
ItSmpLosSem011();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -85,6 +85,18 @@ VOID ItLosSem042(void);
|
|||
VOID ItLosSem043(void);
|
||||
VOID ItLosSem044(void);
|
||||
|
||||
VOID ItSmpLosSem001(void);
|
||||
VOID ItSmpLosSem002(void);
|
||||
VOID ItSmpLosSem003(void);
|
||||
VOID ItSmpLosSem004(void);
|
||||
VOID ItSmpLosSem005(void);
|
||||
VOID ItSmpLosSem006(void);
|
||||
VOID ItSmpLosSem007(void);
|
||||
VOID ItSmpLosSem008(void);
|
||||
VOID ItSmpLosSem009(void);
|
||||
VOID ItSmpLosSem010(void);
|
||||
VOID ItSmpLosSem011(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_SEM_PENDED, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem001(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem001", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_SEM_PENDED, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_002_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_002_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to
|
||||
|
||||
TestBusyTaskDelay(1);
|
||||
ret = OS_TCB_FROM_TID(g_testTaskID01)->taskStatus;
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret & OS_TASK_STATUS_PEND, 0, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem002(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem002", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_003_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
LOS_TaskDelay(1);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SEM_PENDED, ret, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
EXIT:
|
||||
ret = LOS_TaskDelete(g_testTaskID01);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem003", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_004_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_004_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem004(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem004", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_005_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_005_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem005(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem005", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_006_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem006(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem006", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_007_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_007_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem007(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem007", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF02(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 1);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_008_task1", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_event_008_task2", TaskF02, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_TaskDelete(g_testTaskID02);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem008(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem008", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
do {
|
||||
LOS_TaskDelay(10);
|
||||
} while (g_testCount != 2); // 2, wait flag is, or do nothing
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_HwiSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_009_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // current cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
TestHwiTrigger(HWI_NUM_TEST);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 3); // 100, Set the timeout of runtime; 3, test running count
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem009", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_010_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem010(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem010", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount);
|
||||
ret = LOS_SemPost(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
|
||||
g_testCount = 0;
|
||||
|
||||
ret = LOS_SemCreate(0, &g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_sem_011_task2", TaskF01, TASK_PRIO_TEST - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // other cpu
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_SemDelete(g_usSemID);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskID01);
|
||||
LOS_SemDelete(g_usSemID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSem011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSem011", Testcase, TEST_LOS, TEST_SEM, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
|
@ -146,7 +146,34 @@ static_library("test_swtmr") {
|
|||
"It_los_swtmr_Delay_003.c",
|
||||
"It_los_swtmr_Delay_004.c",
|
||||
"It_los_swtmr_Delay_005.c",
|
||||
"smp/It_smp_los_swtmr_001.c",
|
||||
"smp/It_smp_los_swtmr_002.c",
|
||||
"smp/It_smp_los_swtmr_003.c",
|
||||
"smp/It_smp_los_swtmr_004.c",
|
||||
"smp/It_smp_los_swtmr_005.c",
|
||||
"smp/It_smp_los_swtmr_006.c",
|
||||
"smp/It_smp_los_swtmr_007.c",
|
||||
"smp/It_smp_los_swtmr_008.c",
|
||||
"smp/It_smp_los_swtmr_009.c",
|
||||
"smp/It_smp_los_swtmr_010.c",
|
||||
"smp/It_smp_los_swtmr_011.c",
|
||||
"smp/It_smp_los_swtmr_012.c",
|
||||
"smp/It_smp_los_swtmr_013.c",
|
||||
"smp/It_smp_los_swtmr_014.c",
|
||||
"smp/It_smp_los_swtmr_015.c",
|
||||
"smp/It_smp_los_swtmr_016.c",
|
||||
"smp/It_smp_los_swtmr_017.c",
|
||||
"smp/It_smp_los_swtmr_018.c",
|
||||
"smp/It_smp_los_swtmr_019.c",
|
||||
"smp/It_smp_los_swtmr_020.c",
|
||||
"smp/It_smp_los_swtmr_021.c",
|
||||
"smp/It_smp_los_swtmr_022.c",
|
||||
"smp/It_smp_los_swtmr_023.c",
|
||||
"smp/It_smp_los_swtmr_024.c",
|
||||
"smp/It_smp_los_swtmr_025.c",
|
||||
]
|
||||
|
||||
include_dirs = [ "." ]
|
||||
|
||||
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
|
||||
}
|
||||
|
|
|
@ -78,6 +78,34 @@ VOID ItSuiteLosSwtmr(void)
|
|||
ItLosSwtmrAlign004();
|
||||
#endif
|
||||
|
||||
#if LOSCFG_KERNEL_SMP
|
||||
ItSmpLosSwtmr001();
|
||||
ItSmpLosSwtmr002();
|
||||
ItSmpLosSwtmr003();
|
||||
ItSmpLosSwtmr004();
|
||||
ItSmpLosSwtmr005();
|
||||
ItSmpLosSwtmr006();
|
||||
ItSmpLosSwtmr007();
|
||||
ItSmpLosSwtmr008();
|
||||
ItSmpLosSwtmr009();
|
||||
ItSmpLosSwtmr010();
|
||||
ItSmpLosSwtmr011();
|
||||
ItSmpLosSwtmr012();
|
||||
ItSmpLosSwtmr013();
|
||||
ItSmpLosSwtmr014();
|
||||
ItSmpLosSwtmr015();
|
||||
ItSmpLosSwtmr016();
|
||||
ItSmpLosSwtmr017();
|
||||
ItSmpLosSwtmr018();
|
||||
ItSmpLosSwtmr019();
|
||||
ItSmpLosSwtmr020();
|
||||
ItSmpLosSwtmr021();
|
||||
ItSmpLosSwtmr022();
|
||||
ItSmpLosSwtmr023();
|
||||
ItSmpLosSwtmr024();
|
||||
ItSmpLosSwtmr025();
|
||||
#endif
|
||||
|
||||
#if (LOS_KERNEL_TEST_FULL == 1)
|
||||
ItLosSwtmr025();
|
||||
ItLosSwtmr026();
|
||||
|
|
|
@ -39,6 +39,8 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define LOOP 100
|
||||
|
||||
#define SELF_DELETED 0
|
||||
#define SYS_EXIST_SWTMR 1
|
||||
#define TEST_HWI_RUNTIME 0x100000
|
||||
|
@ -188,6 +190,31 @@ extern VOID ItLosSwtmrDelay003(VOID);
|
|||
extern VOID ItLosSwtmrDelay004(VOID);
|
||||
extern VOID ItLosSwtmrDelay005(VOID);
|
||||
|
||||
extern VOID ItSmpLosSwtmr001(VOID);
|
||||
extern VOID ItSmpLosSwtmr002(VOID);
|
||||
extern VOID ItSmpLosSwtmr003(VOID);
|
||||
extern VOID ItSmpLosSwtmr004(VOID);
|
||||
extern VOID ItSmpLosSwtmr005(VOID);
|
||||
extern VOID ItSmpLosSwtmr006(VOID);
|
||||
extern VOID ItSmpLosSwtmr007(VOID);
|
||||
extern VOID ItSmpLosSwtmr008(VOID);
|
||||
extern VOID ItSmpLosSwtmr009(VOID);
|
||||
extern VOID ItSmpLosSwtmr010(VOID);
|
||||
extern VOID ItSmpLosSwtmr011(VOID);
|
||||
extern VOID ItSmpLosSwtmr012(VOID);
|
||||
extern VOID ItSmpLosSwtmr013(VOID);
|
||||
extern VOID ItSmpLosSwtmr014(VOID);
|
||||
extern VOID ItSmpLosSwtmr015(VOID);
|
||||
extern VOID ItSmpLosSwtmr016(VOID);
|
||||
extern VOID ItSmpLosSwtmr017(VOID);
|
||||
extern VOID ItSmpLosSwtmr018(VOID);
|
||||
extern VOID ItSmpLosSwtmr019(VOID);
|
||||
extern VOID ItSmpLosSwtmr020(VOID);
|
||||
extern VOID ItSmpLosSwtmr021(VOID);
|
||||
extern VOID ItSmpLosSwtmr022(VOID);
|
||||
extern VOID ItSmpLosSwtmr023(VOID);
|
||||
extern VOID ItSmpLosSwtmr024(VOID);
|
||||
extern VOID ItSmpLosSwtmr025(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 g_testTimes;
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 testSwtmrHandle;
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &testSwtmrHandle, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SwtmrStart(testSwtmrHandle);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod * g_testTimes + 5); // g_testPeriod * g_testTimes + 5, set delay time
|
||||
|
||||
ret = LOS_SwtmrStop(testSwtmrHandle);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(testSwtmrHandle);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(testSwtmrHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret, testid;
|
||||
UINT32 coreIdx = 0;
|
||||
|
||||
/* each core run swtmr for 10 times, period is 10 */
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
g_testTimes = 10; // each core run swtmr for 10 times
|
||||
|
||||
while (coreIdx < LOSCFG_KERNEL_CORE_NUM) {
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_001_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(coreIdx));
|
||||
ret = LOS_TaskCreate(&testid, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
coreIdx++;
|
||||
}
|
||||
|
||||
LOS_TaskDelay(g_testPeriod * g_testTimes + 10); // g_testPeriod * g_testTimes + 10, set delay time
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, g_testTimes * LOSCFG_KERNEL_CORE_NUM, g_testCount);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr001(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr001", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static UINT32 g_testTimes;
|
||||
|
||||
static UINT32 g_swtmrHandle[LOSCFG_KERNEL_CORE_NUM];
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(UINTPTR swtmrId)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_SwtmrStart(swtmrId);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(swtmrId);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret, testid;
|
||||
UINT32 i;
|
||||
|
||||
/* each core run swtmr for 10 times, period is 10 */
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
g_testTimes = 1;
|
||||
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_swtmrHandle[i], 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
}
|
||||
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
TEST_TASK_PARAM_INIT(testTask, "it_swtmr_002_task", TaskF01,
|
||||
TASK_PRIO_TEST_SWTMR + 1); // not set cpuaffi
|
||||
testTask.uwArg = g_swtmrHandle[i];
|
||||
testTask.usCpuAffiMask = CPUID_TO_AFFI_MASK(i);
|
||||
ret = LOS_TaskCreate(&testid, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
}
|
||||
|
||||
UINT64 startTime = LOS_CurrNanosec();
|
||||
LOS_TaskDelay(g_testPeriod * g_testTimes + 5); // g_testPeriod * g_testTimes + 5, set delay time
|
||||
UINT64 usedTime = LOS_CurrNanosec() - startTime;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, g_testTimes * LOSCFG_KERNEL_CORE_NUM, g_testCount);
|
||||
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
ret = LOS_SwtmrStop(g_swtmrHandle[i]);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_swtmrHandle[i]);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
}
|
||||
return LOS_OK;
|
||||
EXIT:
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
LOS_SwtmrDelete(g_swtmrHandle[i]);
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr002(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr002", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SwtmrStart(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_003_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod + 10); // period is 10
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
/* do stop and delete */
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr003(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr003", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret;
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
ret = LOS_SwtmrStart(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_004_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod + 1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
|
||||
|
||||
/* do stop and delete */
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr004(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr004", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SwtmrStart(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_005_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod * 2 + 1); // g_testPeriod*2+1, set delay time
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
|
||||
|
||||
/* do stop and delete */
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr005(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr005", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_SwtmrStart(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_006_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod * 2 + 1); // g_testPeriod*2+1, set delay time
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
|
||||
|
||||
/* do stop and delete */
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr006(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr006", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_STARTED, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_007_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod + 1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr007(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr007", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_STARTED, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
UINT32 currCpuid;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_008_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod + 1);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr008(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr008", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
static VOID SwtmrF01(void)
|
||||
{
|
||||
LOS_AtomicInc(&g_testCount);
|
||||
}
|
||||
|
||||
static void TaskF01(void)
|
||||
{
|
||||
UINT32 ret, currCpuid;
|
||||
|
||||
ret = LOS_SwtmrStop(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_STARTED, ret, EXIT);
|
||||
|
||||
return;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S testTask;
|
||||
UINT32 ret;
|
||||
|
||||
g_testCount = 0;
|
||||
g_testPeriod = 10; // period is 10
|
||||
|
||||
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_usSwTmrID, 0
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
|
||||
#endif
|
||||
);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_swtmr_009_task", TaskF01, TASK_PRIO_TEST_SWTMR - 1,
|
||||
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
LOS_TaskDelay(g_testPeriod * 2 + 1); // g_testPeriod*2+1, set delay time
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(g_usSwTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(g_usSwTmrID);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItSmpLosSwtmr009(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItSmpLosSwtmr009", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue