sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\misc\t_proc3.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include "u32std.h" sl@0: #include "../misc/prbs.h" sl@0: sl@0: _LIT(KSecondProcessName,"T_PROC3A"); sl@0: sl@0: RTest test(_L("T_PROC3")); sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: test.Start(_L("Testing thread create/process kill")); sl@0: TUint seed[2]; sl@0: seed[0]=0xc90fdaa2; sl@0: seed[1]=0; sl@0: sl@0: TInt n=0; sl@0: FOREVER sl@0: { sl@0: TUint x=Random(seed); sl@0: TBuf<16> buf; sl@0: buf.Num(x,EHex); sl@0: RProcess p; sl@0: TInt r=p.Create(KSecondProcessName,buf); sl@0: if (r!=KErrNone) sl@0: { sl@0: test.Printf(_L("Process create failed, code %d\n"),r); sl@0: test.Getch(); sl@0: test(0); sl@0: } sl@0: TRequestStatus s; sl@0: p.Logon(s); sl@0: test(s==KRequestPending); sl@0: ++n; sl@0: p.Resume(); sl@0: User::WaitForRequest(s); sl@0: if (p.ExitType()!=EExitKill || (TUint)p.ExitReason()!=x) sl@0: { sl@0: TExitCategoryName aExitCategory = p.ExitCategory(); sl@0: test.Printf(_L("Exit %d,%d,%S\n"),p.ExitType(),p.ExitReason(),&aExitCategory); sl@0: test.Printf(_L("Should be 0,%d,Kill\n"),x); sl@0: test.Getch(); sl@0: test(0); sl@0: } sl@0: p.Close(); sl@0: test.Printf(_L("%d\n"),n); sl@0: } sl@0: sl@0: // test.End(); sl@0: }