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: // *IMPORTANT*: This should only be run when called from T_UCRT0P1. sl@0: // See TestCase SYSLIB-0001 in T_UCRT0P1.CPP for more information. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: RTest TheTest(_L("T_UCRT0P2")); sl@0: sl@0: sl@0: //Test macros and functions sl@0: LOCAL_C void Check(TInt aValue, TInt aLine) sl@0: { sl@0: if(!aValue) sl@0: TheTest(EFalse, aLine); sl@0: } sl@0: sl@0: LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine) sl@0: { sl@0: if(aValue != aExpected) sl@0: { sl@0: RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); sl@0: TheTest(EFalse, aLine); sl@0: } sl@0: } sl@0: sl@0: #define TEST(arg) ::Check((arg), __LINE__) sl@0: #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) sl@0: sl@0: sl@0: sl@0: //DEF074278: Java VM requires more command line testArguments. sl@0: void Defect_DEF074278_Part2() sl@0: { sl@0: TBuf<180> testArguments(_L("one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four ")); sl@0: TBuf<210> inputArguments; sl@0: sl@0: TUint testArgNo = 25; sl@0: sl@0: int argc=0; sl@0: char** argv=0; sl@0: char** envp=0; sl@0: sl@0: TheTest.Printf(_L("Retrieving the arguments passed in from T_UCRT0P1\n")); sl@0: __crt0(argc,argv,envp); // get args & environment from somewhere sl@0: sl@0: //Get all the arguments into a descriptor, beginning at pos 1, as pos 0 contains sl@0: //the T_UCRT0P2 exe path and name. sl@0: for (TInt i=1; i < argc; i++) sl@0: { sl@0: char *str=argv[i]; sl@0: while(*str) sl@0: inputArguments.Append((TChar)*str++); sl@0: inputArguments.Append(' '); sl@0: } sl@0: sl@0: //tests all the arguments were passed to the new process correctly. sl@0: TheTest.Printf(_L("Checking all arguements were passed to the new process correctly... ")); sl@0: TEST(testArguments == inputArguments ); sl@0: TEST2(testArgNo, argc); sl@0: sl@0: exit(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_DEF074278_Part2(); sl@0: } sl@0: sl@0: /** sl@0: /This should only be called from T_UCRT0P1, as it is part of the same test. sl@0: */ sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: CTrapCleanup* tc = CTrapCleanup::New(); sl@0: TheTest(tc != NULL); sl@0: __UHEAP_MARK; sl@0: sl@0: TheTest.Title(); sl@0: TheTest.Printf(_L("Starting the tests in the child process T_UCRT0P2 ...\n")); sl@0: TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-STDLIB-LEGACY-T_UCRT0P2-0001 ")); sl@0: TRAPD(error,RunTestsL()); sl@0: TEST2(error,KErrNone); sl@0: sl@0: TheTest.End(); sl@0: TheTest.Close(); sl@0: __UHEAP_MARKEND; sl@0: delete tc; sl@0: return 0; sl@0: } sl@0: