1 /*
2 * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "It_los_queue.h"
17
18
HwiF01null19 static VOID HwiF01(VOID)
20 {
21 UINT32 ret;
22 CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
23
24 ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
25 ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret);
26 }
27
Testcasenull28 static UINT32 Testcase(VOID)
29 {
30 UINT32 ret;
31 HWI_PRIOR_T hwiPrio = 3;
32 HWI_MODE_T mode = 0;
33 CHAR *buff2 = NULL;
34 HwiIrqParam irqParam;
35
36 ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, 0);
37 ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_PARA_ISZERO, ret, EXIT);
38 (VOID)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
39 irqParam.pDevId = 0;
40 ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
41 ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
42
43 TestHwiTrigger(HWI_NUM_TEST);
44
45 ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
46 ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret, EXIT);
47
48 EXIT:
49 TestHwiDelete(HWI_NUM_TEST);
50 ret = LOS_QueueDelete(g_testQueueID01);
51 ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret);
52 return LOS_OK;
53 }
54
ItLosQueueIsr002null55 VOID ItLosQueueIsr002(VOID)
56 {
57 TEST_ADD_CASE("ItLosQueueIsr002", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
58 }
59
60