1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "stdio.h"
32 #include "It_posix_queue.h"
33
34 CHAR *g_mqueueMsessage[MQUEUE_SHORT_ARRAY_LENGTH] = {"0123456789", "1234567890", "2345678901",
35 "3456789012", "4567890123", "5678901234",
36 "6789012345", "7890123456", "lalalalala",
37 "hahahahaha"};
38 CHAR g_gqname[MQUEUE_STANDARD_NAME_LENGTH];
39 CHAR g_mqueueName[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH];
40 mqd_t g_mqueueId[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1];
41 SEM_HANDLE_T g_mqueueSem;
42 mqd_t g_messageQId;
43 mqd_t g_gqueue;
44 TSK_HANDLE_T g_mqueueTaskPID;
45
TestAssertWaitDelay(UINT32 * testCount,UINT32 flag)46 VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag)
47 {
48 while (*testCount != flag) {
49 usleep(1);
50 }
51 }
52
ItSuitePosixMqueue(void)53 VOID ItSuitePosixMqueue(void)
54 {
55 printf("*********** BEGIN SAMPLE POSIX MQUEUE TEST ************\n");
56 ItPosixQueue001();
57 ItPosixQueue002();
58 ItPosixQueue003();
59 ItPosixQueue004();
60 ItPosixQueue005();
61 ItPosixQueue006();
62 ItPosixQueue007();
63 ItPosixQueue008();
64 ItPosixQueue009();
65 ItPosixQueue010();
66 ItPosixQueue011();
67 ItPosixQueue012();
68 ItPosixQueue013();
69 ItPosixQueue014();
70 ItPosixQueue015();
71 ItPosixQueue016();
72 ItPosixQueue017();
73 ItPosixQueue018();
74 ItPosixQueue019();
75 ItPosixQueue020();
76 ItPosixQueue021();
77 ItPosixQueue022();
78 ItPosixQueue023();
79 ItPosixQueue024();
80 ItPosixQueue025();
81 ItPosixQueue026();
82 ItPosixQueue027();
83 ItPosixQueue028();
84 ItPosixQueue029();
85 ItPosixQueue030();
86 ItPosixQueue031();
87 ItPosixQueue032();
88 ItPosixQueue033();
89 ItPosixQueue034();
90 ItPosixQueue035();
91 ItPosixQueue036();
92 ItPosixQueue037();
93 ItPosixQueue038();
94 ItPosixQueue039();
95 ItPosixQueue040();
96 ItPosixQueue041();
97 ItPosixQueue042();
98 ItPosixQueue043();
99 ItPosixQueue044();
100 ItPosixQueue045();
101 ItPosixQueue046();
102 ItPosixQueue047();
103 ItPosixQueue048();
104 ItPosixQueue049();
105 ItPosixQueue050();
106 ItPosixQueue051();
107 ItPosixQueue052();
108 }
109