sl@0: // Copyright (c) 2005-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 "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: // T_WAITPIDLAUNCH.CPP sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: LOCAL_D RTest test(_L("WAITPID DEF073739")); sl@0: LOCAL_D RProcess me; sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-STDLIB-UT-1575 sl@0: @SYMTestCaseDesc Testing if POSIX waitpid function conforms to POSIX standard sl@0: @SYMTestPriority High sl@0: @SYMTestActions Starts a new process (T_WAITPID) this new process sl@0: creates some processes and tests the POSIX waitpid function behaves correctly sl@0: by waiting for these processes. sl@0: @SYMTestExpectedResults The test should not fail. sl@0: @SYMDEF INC073739 sl@0: */ sl@0: sl@0: //INC073739 Incorrect error codes returned from waitpid() in STDLIB sl@0: void Defect_073739() sl@0: { sl@0: sl@0: sl@0: test.Printf(_L("Create a new process t_waitpid to test POSIX waitpid\n")); sl@0: //Creating another process to run T_WAITPID and test if it completed correctly sl@0: TInt err=me.Create(_L("T_WAITPID"),_L("")); sl@0: if (err==KErrNotFound) sl@0: err=me.Create(_L("z:\\test\\T_WAITPID"),_L("")); sl@0: if (err==KErrNotFound) sl@0: err=me.Create(_L("c:\\test\\T_WAITPID"),_L("")); sl@0: if (err==KErrNotFound) sl@0: err=me.Create(_L("c:\\sys\\bin\\T_WAITPID"),_L("")); sl@0: test(err==KErrNone); sl@0: sl@0: //Checking that the child proces T_WAITPID executes properly with no panic sl@0: TRequestStatus status; sl@0: me.Logon(status); sl@0: me.Resume(); sl@0: User::WaitForRequest(status); sl@0: //Test to make sure the child process ended correctly sl@0: test(status==KErrNone); sl@0: test(me.ExitReason()==KErrNone); sl@0: me.Close(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Invoke the tests sl@0: */ sl@0: LOCAL_C void RunTestsL () sl@0: { sl@0: Defect_073739(); sl@0: } sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: test.Start(_L(" @SYMTestCaseID:SYSLIB-STDLIB-UT-1575 Starting the T_WAITPID tests... ")); sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup=CTrapCleanup::New(); sl@0: test(cleanup != NULL); sl@0: TRAPD(error,RunTestsL()); sl@0: test(error==KErrNone); sl@0: test.End(); sl@0: test.Close(); sl@0: delete cleanup; sl@0: __UHEAP_MARKEND; sl@0: return 0; sl@0: }