lowlevellibsandfws/apputils/tsrc/T_COMMAND.CPP
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-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 "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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32cons.h>
       
    17 #include <e32test.h>
       
    18 
       
    19 LOCAL_D RTest test(_L("t_command"));
       
    20 LOCAL_D RProcess me;
       
    21 
       
    22 /**
       
    23 @SYMTestCaseID          SYSLIB-BAFL-CT-0485
       
    24 @SYMTestCaseDesc        Tests the behaviour of long command line arguments
       
    25 @SYMTestPriority        High
       
    26 @SYMTestActions         Tests for long command line arguments by creating another process.
       
    27 @SYMTestExpectedResults Tests must not fail
       
    28 @SYMREQ                 REQ0000
       
    29 */
       
    30 void RunChildProcessL()
       
    31 	{
       
    32 	//passing a very long command line argument with more than 256 characters
       
    33 	TBuf<300> longargument(_L("verylongargument verylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargumentverylongargument"));
       
    34 	test.Printf(_L("Test for command line argument with %d characters \n"),longargument.Length());
       
    35 
       
    36 	//Creating another process to run T_CLINE with very long command line arguments
       
    37 	TInt err=me.Create(_L("T_CLINE"),longargument);
       
    38 	if (err==KErrNotFound)
       
    39 		err=me.Create(_L("z:\\test\\T_CLINE"),longargument);
       
    40 	test(err==KErrNone);
       
    41 
       
    42 	//Checking that the child proces T_CLINE executes properly with no panic
       
    43 	TRequestStatus status;
       
    44 	me.Logon(status);
       
    45 	me.Resume();
       
    46 	User::WaitForRequest(status);
       
    47 	test(status==KErrNone);
       
    48 
       
    49 	test(me.ExitType()==EExitKill);
       
    50 	test(me.ExitReason()==KErrNone);
       
    51 	me.Close();
       
    52 
       
    53 
       
    54 	}
       
    55 
       
    56 
       
    57 
       
    58 GLDEF_C TInt E32Main()
       
    59     {
       
    60 	test.Title();
       
    61 	test.Start(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0485 Starting tests... "));
       
    62 	__UHEAP_MARK;
       
    63 	CTrapCleanup* cleanup=CTrapCleanup::New();
       
    64 	TRAPD(error,RunChildProcessL());
       
    65 	test(error==KErrNone);
       
    66 	test.End();
       
    67 	test.Close();
       
    68 	delete cleanup;
       
    69 	__UHEAP_MARKEND;
       
    70 	return 0;
       
    71     }
       
    72