First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\bench\t_svr5.cpp
16 // Test client server shareable sessions and benchmark their performance.
18 // CSession2, CServer2, RSessionBase, RMessage2, DServer, DSession
20 // - Start the test server
21 // - Open a connection with the server specifying 0 message slots should be
22 // available for the session and verify the server returns KErrServerBusy
23 // when it tries to pass a message to it.
24 // - Open a connection using a fixed pool of messages and test that the server
25 // handles the messages correctly.
26 // - Open a connection using the kernel's global pool of messages and test the
27 // servers handles the messages correctly.
28 // - Open a shareable session with the server and verify that:
29 // - all arguments are passed to the server and back correctly
30 // - server can read and write to/from the client and return the appropriate
31 // errors when bad descriptors are passed in.
32 // - another thread can share the session to send messages to the server.
33 // - a message sent by one thread can be saved and completed later in
34 // response to a message sent by a different thread.
35 // - another thread can close the session.
36 // - a different thread can attach to a session by handle.
37 // - Establish a global shareable session to the server and test it fails, as
38 // the server doesn't support global shareable sessions.
39 // - Open an unshareable session with the server and verify that:
40 // - all arguments are passed to the server and back correctly.
41 // - server can reads and write to/from the client and return the
42 // appropriate errors when bad descriptors are passed in.
43 // - the session handle is local (thread owned)
44 // - Open an automatically shared session using ShareAuto and test it can be
45 // shared by threads in the same process.
46 // - Send dummy messages that the server completes immediately and display how
47 // many are completed per second.
48 // - Verify that stopping the server completes existing pending requests with
49 // KErrServerTerminated.
50 // - Verify that the kernel does not crash by completing a message with an invalid
51 // handle and verify the client is panicked with EBadMessageHandle.
52 // Platforms/Drives/Compatibility:
54 // Assumptions/Requirement/Pre-requisites:
55 // Failures and causes:
56 // Base Port information:
57 // This test does not help to validate an EKA2 port.
62 #include <e32base_private.h>
63 #define __E32TEST_EXTENSION__
67 #include "../mmu/mmudetect.h"
69 const TInt KHeapSize=0x2000;
70 const TInt KMajorVersionNumber=1;
71 const TInt KMinorVersionNumber=0;
72 const TInt KBuildVersionNumber=1;
74 _LIT(KServerName,"Display");
76 TInt SessionCreateLResult=0;
77 TInt SessionCostructCount=0;
78 TInt SessionDestructCount=0;
80 class CMySession : public CSession2
85 void DisplayName(const RMessage2& aM);
86 virtual void ServiceL(const RMessage2& aMessage);
87 virtual void CreateL();
88 TInt Hold(const RMessage2& aM);
89 TInt Release(const RMessage2& aM);
91 RPointerArray<TInt> iAsyncMsgArray; // 'pointers' are actually message handles
95 TInt AsyncMsgOrder(const TInt& aL, const TInt& aR)
99 RMessage2 l(*(const RMessagePtr2*)&lh);
100 RMessage2 r(*(const RMessagePtr2*)&rh);
101 return l.Int0() - r.Int0();
104 TInt GetClientName(const RMessagePtr2& aM, TFullName& aN)
107 TInt r = aM.Client(t);
116 class CMyServer : public CServer2
119 enum {EDisplay,ERead,EWrite,ETest,EStop,EHold,ERelease,EGetCompleteIndex};
121 CMyServer(TInt aPriority);
122 static CMyServer* New(TInt aPriority);
123 virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
126 class CMyActiveScheduler : public CActiveScheduler
129 virtual void Error(TInt anError) const; //Overloading pure virtual function
132 class RDisplay : public RSessionBase
141 TInt Display(const TDesC& aMessage);
146 TInt Echo(TInt aWhat, TInt a0, TInt a1, TInt a2, TInt a3);
148 TInt Hold(TInt aOrder=0, TInt aArg=0);
149 void Hold(TRequestStatus& aStatus, TInt aOrder=0, TInt aArg=0);
150 TInt Release(TInt aCount=KMaxTInt);
151 TInt CompleteIndex();
154 LOCAL_D RTest test(_L("T_SVR"));
155 LOCAL_D RTest testSvr(_L("T_SVR Server"));
156 LOCAL_D RTest testSpeedy(_L("T_SVR Speedy"));
157 LOCAL_D RSemaphore client;
158 LOCAL_D TInt speedCount;
160 CMySession::CMySession()
165 ++SessionCostructCount;
168 CMySession::~CMySession()
170 iAsyncMsgArray.Close();
171 ++SessionDestructCount;
174 void CMySession::CreateL()
176 User::LeaveIfError(SessionCreateLResult);
179 void CMySession::DisplayName(const RMessage2& aM)
181 // Display the client's name.
186 TInt r = GetClientName(aM, fn);
187 testSvr(r==KErrNone);
190 testSvr(r==KErrNone);
191 testSvr.Printf(_L("Session %08x %S\n%S\n"), this, &fn, &text);
194 CMyServer* CMyServer::New(TInt aPriority)
196 // Create a new CMyServer.
200 return new CMyServer(aPriority);
203 CMyServer::CMyServer(TInt aPriority)
207 : CServer2(aPriority, ESharableSessions)
210 CSession2* CMyServer::NewSessionL(const TVersion& aVersion, const RMessage2&) const
212 // Create a new client for this server.
216 TVersion v(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
217 if (!User::QueryVersionSupported(v,aVersion))
218 User::Leave(KErrNotSupported);
219 return new(ELeave) CMySession;
222 void CMySession::ServiceL(const RMessage2& aMessage)
224 // Handle messages for this server.
228 TInt f = aMessage.Function();
231 TInt what = f & 0x3fffffff;
232 TInt a0 = aMessage.Int0();
233 TInt a1 = aMessage.Int1();
234 TInt a2 = aMessage.Int2();
235 TInt a3 = aMessage.Int3();
239 aMessage.Complete(a0);
242 aMessage.Complete(a1);
245 aMessage.Complete(a2);
248 aMessage.Complete(a3);
251 aMessage.Complete(a0+a1+a2+a3);
254 aMessage.Complete(a0*a0+a1*a1+a2*a2+a3*a3);
265 case CMyServer::EDisplay:
266 DisplayName(aMessage);
268 case CMyServer::ERead:
269 testSvr.Printf(_L("read message received\n"));
270 r=aMessage.Read(0,b);
271 if (r==KErrNone && b!=_L("Testing read"))
275 r=aMessage.Read(0,b,-1);
281 if (r==KErrNone && HaveVirtMem())
283 r=aMessage.Read(1,b);
286 if (r==KErrBadDescriptor)
290 case CMyServer::EWrite:
291 testSvr.Printf(_L("write message received\n"));
292 r=aMessage.Write(0,_L("It worked!"));
293 RDebug::Print(_L("Write returns %d"),r);
296 r=aMessage.Write(0,b,-1);
304 r=aMessage.Write(1,b);
307 if (r==KErrBadDescriptor)
310 if (r==KErrNone && HaveVirtMem())
312 r=aMessage.Write(2,b);
315 if (r==KErrBadDescriptor)
319 case CMyServer::ETest:
321 case CMyServer::EStop:
322 testSvr.Printf(_L("stop message received\n"));
323 CActiveScheduler::Stop();
325 case CMyServer::EHold:
332 case CMyServer::ERelease:
334 r = Release(aMessage);
337 case CMyServer::EGetCompleteIndex:
345 aMessage.Complete(r);
348 TInt CMySession::Hold(const RMessage2& a)
353 TInt r = GetClientName(a, fn);
354 testSvr(r==KErrNone);
355 testSvr.Printf(_L("Hold message from %S ord %08x arg %08x\n"), &fn, ord, arg);
356 r = iAsyncMsgArray.InsertInOrder((const TInt*)a.Handle(), &AsyncMsgOrder);
360 TInt CMySession::Release(const RMessage2& a)
362 TInt req_count = a.Int0();
363 TInt avail = iAsyncMsgArray.Count();
364 TInt count = Min(req_count, avail);
366 TInt r = GetClientName(a, fn);
367 testSvr(r==KErrNone);
368 testSvr.Printf(_L("Release message from %S req_count=%d count=%d\n"), &fn, req_count, count);
371 TInt mp = (TInt)iAsyncMsgArray[0];
372 iAsyncMsgArray.Remove(0);
373 RMessage2 m(*(const RMessagePtr2*)&mp);
375 TInt code = arg ? arg ^ iCompleteIndex : 0;
376 r = GetClientName(m, fn);
377 testSvr(r==KErrNone);
378 testSvr.Printf(_L("Releasing %S arg=%08x index=%08x code=%08x\n"), &fn, arg, iCompleteIndex, code);
385 void CMyActiveScheduler::Error(TInt anError) const
387 // Called if any Run() method leaves.
391 testSvr.Panic(anError,_L("CMyActiveScheduler::Error"));
394 TInt RDisplay::Open()
396 TInt r=CreateSession(KServerName,Version(),8); // use fixed pool of 8 slots
402 TInt RDisplay::OpenUS()
404 return CreateSession(KServerName,Version(),8,EIpcSession_Unsharable); // use fixed pool of 8 slots
407 TInt RDisplay::OpenS()
409 return CreateSession(KServerName,Version(),8,EIpcSession_Sharable); // use fixed pool of 8 slots
412 TInt RDisplay::OpenGS()
414 return CreateSession(KServerName,Version(),8,EIpcSession_GlobalSharable); // use fixed pool of 8 slots
417 TInt RDisplay::OpenNoAsync()
420 TInt r=CreateSession(KServerName,Version(),0); // no asynchronous messages allowed
426 TInt RDisplay::OpenDynamic()
428 TInt r=CreateSession(KServerName,Version(),-1); // use global dynamic message pool
434 TInt RDisplay::Display(const TDesC& aMessage)
436 // Display a message.
440 TBuf<0x100> b(aMessage);
441 return SendReceive(CMyServer::EDisplay, TIpcArgs(&b));
444 TInt RDisplay::Read()
446 // Get session to test CSession2::ReadL.
450 TBuf<0x10> b(_L("Testing read"));
451 TBuf<0x10>* bad = (TBuf<0x10> *)(0x30000000);
453 return SendReceive(CMyServer::ERead, TIpcArgs(&b, bad));
456 TInt RDisplay::Write()
458 // Get session to test CSession2::WriteL.
463 TBufC<0x10> c; // Bad descriptor - read only
464 TBuf<0x10>* bad = (TBuf<0x10> *)(0x30000000);
465 TInt r=SendReceive(CMyServer::EWrite, TIpcArgs(&b, &c, bad));
466 if (r==KErrNone && b!=_L("It worked!"))
471 TInt RDisplay::Test()
473 // Send a message and wait for completion.
477 return SendReceive(CMyServer::ETest, TIpcArgs());
480 TInt RDisplay::Stop()
486 return SendReceive(CMyServer::EStop, TIpcArgs());
489 TVersion RDisplay::Version()
491 // Return the current version.
495 TVersion v(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
499 TInt RDisplay::Echo(TInt aWhat, TInt a0, TInt a1, TInt a2, TInt a3)
501 return SendReceive(0x40000000|aWhat, TIpcArgs(a0,a1,a2,a3));
504 TInt RDisplay::Hold(TInt aOrder, TInt aArg)
507 return Send(CMyServer::EHold, TIpcArgs(aOrder, aArg));
510 void RDisplay::Hold(TRequestStatus& aStatus, TInt aOrder, TInt aArg)
513 SendReceive(CMyServer::EHold, TIpcArgs(aOrder, aArg), aStatus);
516 TInt RDisplay::Release(TInt aCount)
519 return SendReceive(CMyServer::ERelease, TIpcArgs(aCount));
522 TInt RDisplay::CompleteIndex()
524 return SendReceive(CMyServer::EGetCompleteIndex, TIpcArgs());
527 TInt serverThreadEntryPoint(TAny*)
529 // The entry point for the producer thread.
534 testSvr.Start(_L("Create CActiveScheduler"));
535 CMyActiveScheduler* pR=new CMyActiveScheduler;
537 CActiveScheduler::Install(pR);
539 testSvr.Next(_L("Create CMyServer"));
540 CMyServer* pS=CMyServer::New(0);
543 testSvr.Next(_L("Start CMyServer"));
544 TInt r=pS->Start(KServerName);
545 testSvr(r==KErrNone);
547 testSvr.Next(_L("Signal to client that we have started"));
550 testSvr.Next(_L("Start CActiveScheduler"));
551 CActiveScheduler::Start();
553 testSvr.Next(_L("Exit server"));
559 TInt speedyThreadEntryPoint(TAny* aDisplay)
561 // The entry point for the speed test thread.
565 RDisplay& t=*(RDisplay*)aDisplay;
567 testSpeedy(r==KErrNone);
570 while ((r=t.Test())==KErrNone)
572 testSpeedy(r==KErrServerTerminated);
576 TInt RunPanicThread(RThread& aThread)
580 TBool jit = User::JustInTime();
581 User::SetJustInTime(EFalse);
583 User::WaitForRequest(s);
584 User::SetJustInTime(jit);
588 TInt RogueThread1(TAny*)
590 // try to kill the kernel
592 TPtrC* p=(TPtrC*)0x30000000;
593 mutex.CreateGlobal(*p,EOwnerProcess); // this should panic the thread
597 class RMessageT : public RMessage2
600 RMessageT(TLinAddr anAddr) { iFunction=0; iHandle=(TInt)anAddr; }
603 TInt RogueThread2(TAny*)
605 // try to kill the kernel
606 RMessageT m(0x30000000);
607 m.Complete(KErrNone); // this should panic the thread
611 TInt RogueThread3(TAny*)
613 // try to kill the kernel
614 RMessageT m(0x80000000);
615 m.Complete(KErrNone); // this should panic the thread
619 TInt RogueThread4(TAny*)
621 // try to kill the kernel
622 RMessageT m(0x800fff00); // this should be off the end of the kernel heap
623 m.Complete(KErrNone); // this should panic the thread
627 void DisplayThreadExitInfo(const RThread& aThread)
629 TFullName fn=aThread.FullName();
630 TExitType exitType=aThread.ExitType();
631 TInt exitReason=aThread.ExitReason();
632 TBuf<32> exitCat=aThread.ExitCategory();
633 test.Printf(_L("Thread %S exited %d,%d,%S\n"),&fn,exitType,exitReason,&exitCat);
636 void RogueThreadTest()
642 test.Next(_L("Rogue thread test 1"));
643 r=thread.Create(_L("Rogue1"),RogueThread1,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
645 RunPanicThread(thread); // wait for rogue thread to die
646 DisplayThreadExitInfo(thread);
647 test(thread.ExitType()==EExitPanic);
648 test(thread.ExitReason()==ECausedException);
652 test.Next(_L("Rogue thread test 2"));
653 r=thread.Create(_L("Rogue2"),RogueThread2,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
655 RunPanicThread(thread); // wait for rogue thread to die
656 DisplayThreadExitInfo(thread);
657 test(thread.ExitType()==EExitPanic);
658 test(thread.ExitReason()==EBadMessageHandle);
661 test.Next(_L("Rogue thread test 3"));
662 r=thread.Create(_L("Rogue3"),RogueThread3,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
664 RunPanicThread(thread); // wait for rogue thread to die
665 DisplayThreadExitInfo(thread);
666 test(thread.ExitType()==EExitPanic);
667 test(thread.ExitReason()==EBadMessageHandle);
670 test.Next(_L("Rogue thread test 4"));
671 r=thread.Create(_L("Rogue4"),RogueThread4,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
673 RunPanicThread(thread); // wait for rogue thread to die
674 DisplayThreadExitInfo(thread);
675 test(thread.ExitType()==EExitPanic);
676 test(thread.ExitReason()==EBadMessageHandle);
680 TInt SecondClient(TAny* aSession)
683 d.SetHandle(TInt(aSession));
684 TInt r=d.Display(_L("Second client"));
687 r = d.Echo(0,19,31,83,487);
690 r = d.Echo(1,19,31,83,487);
693 r = d.Echo(2,19,31,83,487);
696 r = d.Echo(3,19,31,83,487);
699 r = d.Echo(4,19,31,83,487);
702 r = d.Echo(5,19,31,83,487);
715 TInt ThirdClient(TAny* aSession)
718 d.SetHandle(TInt(aSession));
719 TInt r=d.Display(_L("Third client"));
734 void TestSecondClient(RSessionBase& aSession)
737 TInt r=t.Create(_L("SecondClient"),SecondClient,0x1000,NULL,(TAny*)aSession.Handle());
742 User::WaitForRequest(s);
743 test_KErrNone(s.Int());
747 void TestThirdClient(RSessionBase& aSession)
750 TInt r=t.Create(_L("ThirdClient"),ThirdClient,0x1000,NULL,(TAny*)aSession.Handle());
755 User::WaitForRequest(s);
756 test_KErrNone(s.Int());
760 TInt FourthClient(TAny* aSession)
763 d.SetHandle(TInt(aSession));
764 TInt r=d.Display(_L("Fourth client"));
771 void TestSessionClose()
776 TRequestStatus msgStat;
778 test(msgStat==KRequestPending);
780 r=t.Create(_L("FourthClient"),FourthClient,0x1000,NULL,(TAny*)d.Handle());
785 User::WaitForRequest(s);
786 test_KErrNone(s.Int());
788 User::After(1000000);
789 test(msgStat==KRequestPending);
792 TInt FifthClient(TAny* aDisplay)
794 RDisplay& d=*(RDisplay*)aDisplay;
798 r=d.Display(_L("Fifth client"));
804 void TestZeroShares()
809 TInt r=t.Create(_L("FifthClient"),FifthClient,0x1000,NULL,&d);
814 User::WaitForRequest(s);
815 test_KErrNone(s.Int());
818 r=d.Display(_L("Access after last share closed"));
823 TInt AttachClient1(TAny* aSession)
826 d.SetHandle(TInt(aSession));
828 TInt r=d.Display(_L("Attach client 1"));
829 __KHEAP_MARKEND; // shouldn't need to allocate memory
833 TInt AttachClient2(TAny* aSession)
836 d.SetHandle(TInt(aSession));
837 TInt r=d.Display(_L("Attach client 2"));
841 r=d.Display(_L("Attach client 2"));
842 __KHEAP_MARKEND; // check no memory was allocated by message send
846 void TestAttach(RSessionBase& aSession)
848 test.Next(_L("Test Attach"));
850 TInt r=t.Create(_L("AttachClient1"),AttachClient1,0x1000,NULL,(TAny*)aSession.Handle());
852 r=RunPanicThread(t); // wait for thread to die
854 test(t.ExitType()==EExitKill);
855 test_KErrNone(t.ExitReason());
858 r=t.Create(_L("AttachClient2"),AttachClient2,0x1000,NULL,(TAny*)aSession.Handle());
863 User::WaitForRequest(s);
864 test_KErrNone(s.Int());
865 test(t.ExitType()==EExitKill);
866 test_KErrNone(t.ExitReason());
870 TInt SixthClient(TAny* aDisplay)
872 RDisplay& d=*(RDisplay*)aDisplay;
873 TInt r=d.Display(_L("Sixth client"));
877 User::WaitForRequest(s);
881 TInt SeventhClient(TAny* aDisplay)
883 RDisplay& d=*(RDisplay*)aDisplay;
884 TInt r=d.Display(_L("Seventh client"));
888 User::WaitForRequest(s);
892 TInt EighthClient(TAny* aDisplay)
894 RDisplay& d=*(RDisplay*)aDisplay;
895 TInt r=d.Display(_L("Eighth client"));
899 User::WaitForRequest(s);
903 TInt NinthClient(TAny* aDisplay)
905 RDisplay& d=*(RDisplay*)aDisplay;
906 TInt r=d.Display(_L("Ninth client"));
910 User::WaitForRequest(s);
914 void TestAsync(RDisplay& aD)
916 TInt ci = aD.CompleteIndex();
917 TRequestStatus s[128];
920 for (i=0; i<128; ++i)
924 aD.Hold(s[i], ord, arg);
925 if (s[i]==KErrServerBusy)
927 User::WaitForRequest(s[i]);
930 test(s[i]==KRequestPending);
935 for (j=0; j<128; ++j)
939 TInt code = s[j^0x55].Int();
940 TInt expected = ci ^ ((j^0x55)+1);
941 if (code != expected)
943 test.Printf(_L("j=%02x i=%02x expected=%08x got=%08x\n"),j,j^0x55,expected,code);
946 User::WaitForRequest(s[j^0x55]);
951 void TestSession(RDisplay& aSess)
955 test.Next(_L("Test all args passed"));
956 test(aSess.Echo(0,3,5,7,11)==3);
957 test(aSess.Echo(1,3,5,7,11)==5);
958 test(aSess.Echo(2,3,5,7,11)==7);
959 test(aSess.Echo(3,3,5,7,11)==11);
960 test(aSess.Echo(4,3,5,7,11)==26);
961 test(aSess.Echo(5,3,5,7,11)==204);
963 test.Next(_L("Send to server"));
964 r=aSess.Display(_L("First message"));
967 test.Next(_L("Read"));
971 test.Next(_L("Write"));
975 TestThirdClient(aSess);
976 User::After(1000000);
977 TestSecondClient(aSess);
978 User::After(1000000);
980 User::After(1000000);
982 User::After(1000000);
984 User::After(1000000);
987 void TestUnsharableSession(RDisplay& aSess)
991 test.Next(_L("Test all args passed"));
992 test(aSess.Echo(0,3,5,7,11)==3);
993 test(aSess.Echo(1,3,5,7,11)==5);
994 test(aSess.Echo(2,3,5,7,11)==7);
995 test(aSess.Echo(3,3,5,7,11)==11);
996 test(aSess.Echo(4,3,5,7,11)==26);
997 test(aSess.Echo(5,3,5,7,11)==204);
999 test.Next(_L("Send to server"));
1000 r=aSess.Display(_L("First message"));
1003 test.Next(_L("Read"));
1007 test.Next(_L("Write"));
1011 TInt h = aSess.Handle();
1012 test.Printf(_L("HANDLE %08x\n"), h);
1013 test((h & KHandleFlagLocal)!=0);
1016 void TestSessionCreateLLeaving()
1018 SessionCreateLResult=KErrGeneral;
1020 TInt c=SessionCostructCount;
1021 TInt d=SessionDestructCount;
1025 test(r==SessionCreateLResult);
1027 test(SessionCostructCount==c+1);
1028 test(SessionDestructCount==d+1);
1030 SessionCreateLResult=KErrNone;
1033 GLDEF_C TInt E32Main()
1040 test.Start(_L("Creating client semaphore"));
1041 TInt r=client.CreateLocal(0);
1044 test.Next(_L("Creating server thread"));
1046 r=server.Create(_L("Server"),serverThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
1048 server.SetPriority(EPriorityMore);
1050 test.Next(_L("Resume server thread"));
1054 test.Next(_L("Wait for server to start"));
1057 test.Next(_L("Connect to server"));
1059 r = t.OpenNoAsync();
1061 test.Next(_L("Send to server"));
1062 r=t.Display(_L("AsyncMsg"));
1066 test(s0==KErrServerBusy);
1069 test.Next(_L("Test Session::CreateL leaving"));
1070 TestSessionCreateLLeaving();
1072 test.Next(_L("Async fixed pool"));
1078 test.Next(_L("Async global pool"));
1079 r = t.OpenDynamic();
1092 test.Printf(_L("OpenS -> %d\n"),r);
1098 test.Printf(_L("OpenGS -> %d\n"),r);
1099 test(r==KErrPermissionDenied);
1103 test.Printf(_L("OpenUS -> %d\n"),r);
1105 TestUnsharableSession(tt);
1108 test.Next(_L("Starting speedy client"));
1110 TRequestStatus speedyStat;
1111 r=speedy.Create(_L("Speedy"),speedyThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,&t);
1113 speedy.Logon(speedyStat);
1122 r=t1.Create(_L("SixthClient"),SixthClient,0x1000,NULL,&t);
1125 r=t2.Create(_L("SeventhClient"),SeventhClient,0x1000,NULL,&t);
1128 r=t3.Create(_L("EighthClient"),EighthClient,0x1000,NULL,&t);
1131 r=t4.Create(_L("NinthClient"),NinthClient,0x1000,NULL,&t);
1138 User::After(1000000);
1140 test.Next(_L("Wait for speedy to start"));
1141 speedy.SetPriority(EPriorityNormal);
1142 RThread().SetPriority(EPriorityMuchMore);
1146 test.Printf(_L("Starting speed test...\n"));
1147 User::After(300000);
1149 User::After(3000000);
1151 test.Printf(_L("Count = %d in 1 second\n"),(n-b)/3);
1153 test.Next(_L("Stop server"));
1156 User::After(0); // Allow the speed client to die
1158 test.Next(_L("Close extra threads"));
1160 User::WaitForRequest(s1);
1161 test(t1.ExitType()==EExitKill && s1==KErrNone);
1163 User::WaitForRequest(s2);
1164 test(t2.ExitType()==EExitKill && s2==KErrNone);
1166 User::WaitForRequest(s3);
1167 test(t3.ExitType()==EExitKill && s3==KErrNone);
1169 User::WaitForRequest(s4);
1170 test(t4.ExitType()==EExitKill && s4==KErrNone);
1171 User::WaitForRequest(speedyStat);
1172 test(speedy.ExitType()==EExitKill && speedyStat==KErrNone);
1174 test.Next(_L("Close all"));
1183 test.Next(_L("Close connection"));