sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <e32cons.h>
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
LOCAL_D RTest test(_L("T_UCRT0P1"));
|
sl@0
|
21 |
LOCAL_D RProcess me;
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
/**
|
sl@0
|
25 |
@SYMTestCaseID SYSLIB-STDLIB-UT-1669
|
sl@0
|
26 |
@SYMTestCaseDesc Testing whether increasing KMaxArgC from 20 to 25 results in the extra arguments
|
sl@0
|
27 |
passed in to a new process to be handled correctly.
|
sl@0
|
28 |
@SYMTestPriority High
|
sl@0
|
29 |
@SYMTestActions Starts a new process (T_UCRT0P2) passing in a set of arguments and this new process
|
sl@0
|
30 |
checks all the arguements were handled correctly.
|
sl@0
|
31 |
@SYMTestExpectedResults The test should not fail.
|
sl@0
|
32 |
@SYMDEF DEF074278
|
sl@0
|
33 |
*/
|
sl@0
|
34 |
void Defect_DEF074278()
|
sl@0
|
35 |
{
|
sl@0
|
36 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-STDLIB-UT-1669 - Defect_DEF074278... "));
|
sl@0
|
37 |
|
sl@0
|
38 |
TBuf<180> arguments(_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
|
39 |
|
sl@0
|
40 |
test.Printf(_L("Create a new process passing in a large number of arguements\n"));
|
sl@0
|
41 |
//Creating another process to run T_UCRT0P2 passing in 24 arguments (25th will be the
|
sl@0
|
42 |
//path and name of the exe). T_UCRT0P2 should only be run via this test and not on it's own.
|
sl@0
|
43 |
TInt err=me.Create(_L("T_UCRT0P2"),arguments);
|
sl@0
|
44 |
if (err==KErrNotFound)
|
sl@0
|
45 |
err=me.Create(_L("z:\\test\\T_UCRT0P2"),arguments);
|
sl@0
|
46 |
if (err==KErrNotFound)
|
sl@0
|
47 |
err=me.Create(_L("c:\\test\\T_UCRT0P2"),arguments);
|
sl@0
|
48 |
if (err==KErrNotFound)
|
sl@0
|
49 |
err=me.Create(_L("z:\\sys\\bin\\T_UCRT0P2"),arguments);
|
sl@0
|
50 |
test(err==KErrNone);
|
sl@0
|
51 |
|
sl@0
|
52 |
//Checking that the child proces T_UCRT0P2 executes properly with no panic
|
sl@0
|
53 |
TRequestStatus status;
|
sl@0
|
54 |
me.Logon(status);
|
sl@0
|
55 |
me.Resume();
|
sl@0
|
56 |
User::WaitForRequest(status);
|
sl@0
|
57 |
//Test to make sure the child process ended correctly
|
sl@0
|
58 |
test(status==KErrNone);
|
sl@0
|
59 |
test(me.ExitReason()==KErrNone);
|
sl@0
|
60 |
me.Close();
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
/**
|
sl@0
|
65 |
@SYMTestCaseID SYSLIB-STDLIB-UT-4003
|
sl@0
|
66 |
@SYMTestCaseDesc When there are heap memory allocation failures in __crt0, any locally allocated
|
sl@0
|
67 |
heap memory should be cleaned up before the pointers go out of scope, preventing a memory leak.
|
sl@0
|
68 |
@SYMTestPriority Medium
|
sl@0
|
69 |
@SYMTestActions Start new process (T_UCRT0P3) passing arguments. Set heap allocation to fail at certain
|
sl@0
|
70 |
points in __crt0. Clean up any locally allocated before routine returns. Check pointers
|
sl@0
|
71 |
are set to NULL and there are no memory leaks.
|
sl@0
|
72 |
@SYMTestExpectedResults No memory is leaked and pointer are NULL.
|
sl@0
|
73 |
@SYMDEF DEF124477
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
void Defect_DEF124477()
|
sl@0
|
76 |
{
|
sl@0
|
77 |
test.Next(_L("@SYMTestCaseID:SYSLIB-STDLIB-UT-4003 - Defect_DEF124477..."));
|
sl@0
|
78 |
|
sl@0
|
79 |
TBuf<20> arguments(_L("random arguements"));
|
sl@0
|
80 |
|
sl@0
|
81 |
test.Printf(_L("Create a new process passing in the arguements\n"));
|
sl@0
|
82 |
//Creating another process to run T_UCRT0P3 passing in the arguments.
|
sl@0
|
83 |
// T_UCRT0P3 should only be run via this test and not on it's own.
|
sl@0
|
84 |
TInt err=me.Create(_L("T_UCRT0P3"),arguments);
|
sl@0
|
85 |
if (err==KErrNotFound)
|
sl@0
|
86 |
err=me.Create(_L("z:\\test\\T_UCRT0P3"),arguments);
|
sl@0
|
87 |
test(err==KErrNone);
|
sl@0
|
88 |
|
sl@0
|
89 |
//Checking that the child proces T_UCRT0P3 executes properly with no panic
|
sl@0
|
90 |
TRequestStatus status;
|
sl@0
|
91 |
me.Logon(status);
|
sl@0
|
92 |
me.Resume();
|
sl@0
|
93 |
User::WaitForRequest(status);
|
sl@0
|
94 |
//Test to make sure the child process ended correctly
|
sl@0
|
95 |
test(status==KErrNone);
|
sl@0
|
96 |
test(me.ExitReason()==KErrNone);
|
sl@0
|
97 |
me.Close();
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
/**
|
sl@0
|
101 |
Invoke the tests
|
sl@0
|
102 |
*/
|
sl@0
|
103 |
LOCAL_C void RunTestsL()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
Defect_DEF074278();
|
sl@0
|
106 |
#ifdef _DEBUG
|
sl@0
|
107 |
Defect_DEF124477(); // OOM related test.
|
sl@0
|
108 |
#endif
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
|
sl@0
|
112 |
GLDEF_C TInt E32Main()
|
sl@0
|
113 |
{
|
sl@0
|
114 |
test.Title();
|
sl@0
|
115 |
test.Start(_L(" Running T_UCRT0P1 tests..."));
|
sl@0
|
116 |
__UHEAP_MARK;
|
sl@0
|
117 |
CTrapCleanup* cleanup=CTrapCleanup::New();
|
sl@0
|
118 |
test(cleanup != NULL);
|
sl@0
|
119 |
TRAPD(error,RunTestsL());
|
sl@0
|
120 |
test(error==KErrNone);
|
sl@0
|
121 |
test.End();
|
sl@0
|
122 |
test.Close();
|
sl@0
|
123 |
delete cleanup;
|
sl@0
|
124 |
__UHEAP_MARKEND;
|
sl@0
|
125 |
return 0;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|