1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/TSTLIB/t_waitpid_launch.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// T_WAITPIDLAUNCH.CPP
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32cons.h>
1.22 +#include <e32test.h>
1.23 +
1.24 +
1.25 +LOCAL_D RTest test(_L("WAITPID DEF073739"));
1.26 +LOCAL_D RProcess me;
1.27 +
1.28 +
1.29 +/**
1.30 +@SYMTestCaseID SYSLIB-STDLIB-UT-1575
1.31 +@SYMTestCaseDesc Testing if POSIX waitpid function conforms to POSIX standard
1.32 +@SYMTestPriority High
1.33 +@SYMTestActions Starts a new process (T_WAITPID) this new process
1.34 + creates some processes and tests the POSIX waitpid function behaves correctly
1.35 + by waiting for these processes.
1.36 +@SYMTestExpectedResults The test should not fail.
1.37 +@SYMDEF INC073739
1.38 +*/
1.39 +
1.40 +//INC073739 Incorrect error codes returned from waitpid() in STDLIB
1.41 +void Defect_073739()
1.42 + {
1.43 +
1.44 +
1.45 + test.Printf(_L("Create a new process t_waitpid to test POSIX waitpid\n"));
1.46 + //Creating another process to run T_WAITPID and test if it completed correctly
1.47 + TInt err=me.Create(_L("T_WAITPID"),_L(""));
1.48 + if (err==KErrNotFound)
1.49 + err=me.Create(_L("z:\\test\\T_WAITPID"),_L(""));
1.50 + if (err==KErrNotFound)
1.51 + err=me.Create(_L("c:\\test\\T_WAITPID"),_L(""));
1.52 + if (err==KErrNotFound)
1.53 + err=me.Create(_L("c:\\sys\\bin\\T_WAITPID"),_L(""));
1.54 + test(err==KErrNone);
1.55 +
1.56 + //Checking that the child proces T_WAITPID executes properly with no panic
1.57 + TRequestStatus status;
1.58 + me.Logon(status);
1.59 + me.Resume();
1.60 + User::WaitForRequest(status);
1.61 + //Test to make sure the child process ended correctly
1.62 + test(status==KErrNone);
1.63 + test(me.ExitReason()==KErrNone);
1.64 + me.Close();
1.65 + }
1.66 +
1.67 +
1.68 +/**
1.69 +Invoke the tests
1.70 +*/
1.71 +LOCAL_C void RunTestsL ()
1.72 + {
1.73 + Defect_073739();
1.74 + }
1.75 +
1.76 +
1.77 +GLDEF_C TInt E32Main()
1.78 + {
1.79 + test.Title();
1.80 + test.Start(_L(" @SYMTestCaseID:SYSLIB-STDLIB-UT-1575 Starting the T_WAITPID tests... "));
1.81 + __UHEAP_MARK;
1.82 + CTrapCleanup* cleanup=CTrapCleanup::New();
1.83 + test(cleanup != NULL);
1.84 + TRAPD(error,RunTestsL());
1.85 + test(error==KErrNone);
1.86 + test.End();
1.87 + test.Close();
1.88 + delete cleanup;
1.89 + __UHEAP_MARKEND;
1.90 + return 0;
1.91 + }