|
1 // Copyright (c) 2005-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 // *IMPORTANT*: This should only be run when called from T_UCRT0P1. |
|
15 // See TestCase SYSLIB-0001 in T_UCRT0P1.CPP for more information. |
|
16 // |
|
17 // |
|
18 |
|
19 #include <stdlib.h> |
|
20 #include <e32debug.h> |
|
21 #include <e32test.h> |
|
22 #include <estlib.h> |
|
23 |
|
24 |
|
25 RTest TheTest(_L("T_UCRT0P2")); |
|
26 |
|
27 |
|
28 //Test macros and functions |
|
29 LOCAL_C void Check(TInt aValue, TInt aLine) |
|
30 { |
|
31 if(!aValue) |
|
32 TheTest(EFalse, aLine); |
|
33 } |
|
34 |
|
35 LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine) |
|
36 { |
|
37 if(aValue != aExpected) |
|
38 { |
|
39 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
|
40 TheTest(EFalse, aLine); |
|
41 } |
|
42 } |
|
43 |
|
44 #define TEST(arg) ::Check((arg), __LINE__) |
|
45 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
|
46 |
|
47 |
|
48 |
|
49 //DEF074278: Java VM requires more command line testArguments. |
|
50 void Defect_DEF074278_Part2() |
|
51 { |
|
52 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 ")); |
|
53 TBuf<210> inputArguments; |
|
54 |
|
55 TUint testArgNo = 25; |
|
56 |
|
57 int argc=0; |
|
58 char** argv=0; |
|
59 char** envp=0; |
|
60 |
|
61 TheTest.Printf(_L("Retrieving the arguments passed in from T_UCRT0P1\n")); |
|
62 __crt0(argc,argv,envp); // get args & environment from somewhere |
|
63 |
|
64 //Get all the arguments into a descriptor, beginning at pos 1, as pos 0 contains |
|
65 //the T_UCRT0P2 exe path and name. |
|
66 for (TInt i=1; i < argc; i++) |
|
67 { |
|
68 char *str=argv[i]; |
|
69 while(*str) |
|
70 inputArguments.Append((TChar)*str++); |
|
71 inputArguments.Append(' '); |
|
72 } |
|
73 |
|
74 //tests all the arguments were passed to the new process correctly. |
|
75 TheTest.Printf(_L("Checking all arguements were passed to the new process correctly... ")); |
|
76 TEST(testArguments == inputArguments ); |
|
77 TEST2(testArgNo, argc); |
|
78 |
|
79 exit(0); |
|
80 } |
|
81 |
|
82 /** |
|
83 Invoke the tests |
|
84 */ |
|
85 LOCAL_C void RunTestsL () |
|
86 { |
|
87 Defect_DEF074278_Part2(); |
|
88 } |
|
89 |
|
90 /** |
|
91 /This should only be called from T_UCRT0P1, as it is part of the same test. |
|
92 */ |
|
93 GLDEF_C TInt E32Main() |
|
94 { |
|
95 CTrapCleanup* tc = CTrapCleanup::New(); |
|
96 TheTest(tc != NULL); |
|
97 __UHEAP_MARK; |
|
98 |
|
99 TheTest.Title(); |
|
100 TheTest.Printf(_L("Starting the tests in the child process T_UCRT0P2 ...\n")); |
|
101 TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-STDLIB-LEGACY-T_UCRT0P2-0001 ")); |
|
102 TRAPD(error,RunTestsL()); |
|
103 TEST2(error,KErrNone); |
|
104 |
|
105 TheTest.End(); |
|
106 TheTest.Close(); |
|
107 __UHEAP_MARKEND; |
|
108 delete tc; |
|
109 return 0; |
|
110 } |
|
111 |