|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __TESTMSGQUEUE_H__ |
|
21 #define __TESTMSGQUEUE_H__ |
|
22 |
|
23 #include <test/testexecutestepbase.h> |
|
24 #include <e32svr.h> |
|
25 #include <sys/msg.h> |
|
26 #include <errno.h> |
|
27 #include <sys/ipc.h> |
|
28 #include <string.h> |
|
29 #include <stdlib.h> |
|
30 #include <pthread.h> |
|
31 #include <sys/ipc.h> |
|
32 |
|
33 // MACROS |
|
34 #define MAX_IPC_OBJ 1024 |
|
35 |
|
36 _LIT(KMessageQueueCreate,"MessageQueueCreate"); |
|
37 _LIT(KMessageQueueControl,"MessageQueueControl"); |
|
38 |
|
39 _LIT(KIntgTest1,"IntgTest1"); |
|
40 _LIT(KIntgTest2,"IntgTest2"); |
|
41 _LIT(KIntgTest3,"IntgTest3"); |
|
42 _LIT(KIntgTest4,"IntgTest4"); |
|
43 _LIT(KIntgTest5,"IntgTest5"); |
|
44 _LIT(KIntgTest6,"IntgTest6"); |
|
45 _LIT(KIntgTest7,"IntgTest7"); |
|
46 _LIT(KIntgTest8,"IntgTest8"); |
|
47 _LIT(KIntgTest9,"IntgTest9"); |
|
48 _LIT(KIntgTest10,"IntgTest10"); |
|
49 _LIT(KIntgTest11,"IntgTest11"); |
|
50 _LIT(KIntgTest12,"IntgTest12"); |
|
51 _LIT(KIntgTest13,"IntgTest13"); |
|
52 _LIT(KIntgTest14,"IntgTest14"); |
|
53 _LIT(KIntgTest15,"IntgTest15"); |
|
54 _LIT(KIntgTest16,"IntgTest16"); |
|
55 _LIT(KIntgTest17,"IntgTest17"); |
|
56 _LIT(KIntgTest6_1,"IntgTest6_1"); |
|
57 |
|
58 _LIT(Kmsggettest1,"msggettest1"); |
|
59 _LIT(Kmsggettest2,"msggettest2"); |
|
60 _LIT(Kmsggettest3,"msggettest3"); |
|
61 _LIT(Kmsggettest4,"msggettest4"); |
|
62 _LIT(Kmsggettest5,"msggettest5"); |
|
63 _LIT(Kmsggettest6,"msggettest6"); |
|
64 _LIT(KMsggetCreateKey,"MsggetCreateKey"); |
|
65 _LIT(Kmsgctltest1,"msgctltest1"); |
|
66 _LIT(Kmsgctltest2,"msgctltest2"); |
|
67 _LIT(Kmsgctltest3,"msgctltest3"); |
|
68 _LIT(Kmsgctltest4,"msgctltest4"); |
|
69 _LIT(Kmsgctltest5,"msgctltest5"); |
|
70 _LIT(Kmsgsndtest1,"msgsndtest1"); |
|
71 _LIT(Kmsgsndtest2,"msgsndtest2"); |
|
72 _LIT(Kmsgsndtest3,"msgsndtest3"); |
|
73 _LIT(Kmsgsndtest4,"msgsndtest4"); |
|
74 _LIT(Kmsgsndtest5,"msgsndtest5"); |
|
75 _LIT(Kmsgsndtest6,"msgsndtest6"); |
|
76 _LIT(Kmsgrcvtest1,"msgrcvtest1"); |
|
77 _LIT(Kmsgrcvtest2,"msgrcvtest2"); |
|
78 _LIT(Kmsgrcvtest3,"msgrcvtest3"); |
|
79 _LIT(Kmsgrcvtest4,"msgrcvtest4"); |
|
80 _LIT(Ksndrcvtest1,"sndrcvtest1"); |
|
81 _LIT(Ksndrcvtest2,"sndrcvtest2"); |
|
82 _LIT(Ksndrcvtest3,"sndrcvtest3"); |
|
83 _LIT(Ksndrcvtest4,"sndrcvtest4"); |
|
84 _LIT(Kthsndrcvtest1,"thsndrcvtest1"); |
|
85 |
|
86 class CTestMsgqueue : public CTestStep |
|
87 { |
|
88 public: |
|
89 ~CTestMsgqueue(); |
|
90 CTestMsgqueue(const TDesC& aStepName); |
|
91 TVerdict doTestStepL(); |
|
92 TVerdict doTestStepPreambleL(); |
|
93 TVerdict doTestStepPostambleL(); |
|
94 |
|
95 TInt IntgTest1(); |
|
96 TInt IntgTest2(); |
|
97 TInt IntgTest3(); |
|
98 TInt IntgTest4(); |
|
99 TInt IntgTest5(); |
|
100 TInt IntgTest6(); |
|
101 TInt IntgTest7(); |
|
102 TInt IntgTest8(); |
|
103 TInt IntgTest9(); |
|
104 TInt IntgTest10(); |
|
105 TInt IntgTest11(); |
|
106 TInt IntgTest12(); |
|
107 TInt IntgTest13(); |
|
108 TInt IntgTest14(); |
|
109 TInt IntgTest15(); |
|
110 TInt IntgTest16(); |
|
111 TInt IntgTest17(); |
|
112 TInt IntgTest6_1(); |
|
113 |
|
114 TInt msggettest1(); |
|
115 TInt msggettest2(); |
|
116 TInt msggettest3(); |
|
117 TInt msggettest4(); |
|
118 TInt msggettest5(); |
|
119 TInt msggettest6(); |
|
120 TInt MsggetCreateKey(); |
|
121 TInt msgctltest1(); |
|
122 TInt msgctltest2(); |
|
123 TInt msgctltest3(); |
|
124 TInt msgctltest4(); |
|
125 TInt msgctltest5(); |
|
126 TInt msgsndtest1(); |
|
127 TInt msgsndtest2(); |
|
128 TInt msgsndtest3(); |
|
129 TInt msgsndtest4(); |
|
130 TInt msgsndtest5(); |
|
131 TInt msgsndtest6(); |
|
132 TInt msgrcvtest1(); |
|
133 TInt msgrcvtest2(); |
|
134 TInt msgrcvtest3(); |
|
135 TInt msgrcvtest4(); |
|
136 TInt sndrcvtest1(); |
|
137 TInt sndrcvtest2(); |
|
138 TInt sndrcvtest3(); |
|
139 TInt sndrcvtest4(); |
|
140 TInt thsndrcvtest1(); |
|
141 |
|
142 protected: // Functions from base classes |
|
143 |
|
144 static void* ThreadEntryFunctionRead(void* arg); |
|
145 static void* ThreadEntryFunctionDestroyQ(void* arg); |
|
146 static void* ThreadEntryFunctionWrite(void* arg); |
|
147 private: |
|
148 /** |
|
149 * Message queue create |
|
150 * @since MRT 2.0 |
|
151 * @param aItem Script line containing parameters. |
|
152 * @return Symbian OS error code. |
|
153 */ |
|
154 virtual TInt MessageQueueCreate( ); |
|
155 |
|
156 /** |
|
157 * Message queue close |
|
158 * @since MRT 2.0 |
|
159 * @param aItem Script line containing parameters. |
|
160 * @return Symbian OS error code. |
|
161 */ |
|
162 virtual TInt MessageQueueClose( ); |
|
163 |
|
164 /** |
|
165 * Message queue control |
|
166 * @since MRT 2.0 |
|
167 * @param aItem Script line containing parameters. |
|
168 * @return Symbian OS error code. |
|
169 */ |
|
170 virtual TInt MessageQueueControl( ); |
|
171 |
|
172 /** |
|
173 * Message queue send |
|
174 * @since MRT 2.0 |
|
175 * @param aItem Script line containing parameters. |
|
176 * @return Symbian OS error code. |
|
177 */ |
|
178 virtual TInt MessageQueueSend( ); |
|
179 |
|
180 /** |
|
181 * Message queue receive |
|
182 * @since MRT 2.0 |
|
183 * @param aItem Script line containing parameters. |
|
184 * @return Symbian OS error code. |
|
185 */ |
|
186 virtual TInt MessageQueueRecv( ); |
|
187 |
|
188 /** |
|
189 * Create Thread |
|
190 * @since MRT 2.0 |
|
191 * @param aItem Script line containing parameters. |
|
192 * @return Symbian OS error code. |
|
193 */ |
|
194 virtual TInt CreateThread( ); |
|
195 |
|
196 |
|
197 /** |
|
198 * Send Message to Queue |
|
199 * @since MRT 2.0 |
|
200 * @param aItem Script line containing parameters. |
|
201 * @return Symbian OS error code. |
|
202 */ |
|
203 virtual TInt SendMessage( ); |
|
204 |
|
205 /** |
|
206 * Recv Message from Queue |
|
207 * @since MRT 2.0 |
|
208 * @param aItem Script line containing parameters. |
|
209 * @return Symbian OS error code. |
|
210 */ |
|
211 virtual TInt RecvMessage( ); |
|
212 |
|
213 TInt MsgKey( TInt& aKey ); |
|
214 |
|
215 TInt MsgFlag( TInt& aFlag ); |
|
216 |
|
217 TInt MsgId( TInt& aId ); |
|
218 |
|
219 TInt MsgCmd( TInt& aCmd ); |
|
220 |
|
221 TInt MsgType( TInt& aType ); |
|
222 |
|
223 TInt MsgLen( TInt& aLen ); |
|
224 |
|
225 TInt MsgSegs( TInt& aSegs ); |
|
226 |
|
227 TInt ErrCode( TInt& aErrCode ); |
|
228 |
|
229 TInt CheckMessageQueueStats(struct msqid_ds& buf); |
|
230 |
|
231 void SetMessageQueueParms(struct msqid_ds* buf); |
|
232 |
|
233 public: // Data |
|
234 TInt iErrno; |
|
235 private: // Data |
|
236 TInt iParamCnt; |
|
237 TInt iBlocked; |
|
238 TInt iThreadId; |
|
239 TInt *iNoOfMsqIds; |
|
240 TInt msgq_id; |
|
241 }; |
|
242 #endif |