sl@0
|
1 |
// Copyright (c) 1997-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 |
// TESTFIXES.CPP
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32base.h>
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include <csch_cli.h>
|
sl@0
|
21 |
#include <f32file.h>
|
sl@0
|
22 |
#include "Thelpers.h"
|
sl@0
|
23 |
#include "TestUtils.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
// Globals
|
sl@0
|
26 |
static RTest TheTest(_L("TestFixes"));
|
sl@0
|
27 |
static RScheduler TheScheduler;
|
sl@0
|
28 |
static RFs TheFsSession;
|
sl@0
|
29 |
|
sl@0
|
30 |
// Type definitions
|
sl@0
|
31 |
typedef CArrayFixFlat<TScheduleEntryInfo> CScheduleEntryInfoArray;
|
sl@0
|
32 |
typedef CArrayFixFlat<TTaskInfo> CTaskInfoArray;
|
sl@0
|
33 |
|
sl@0
|
34 |
//***********************************************************************************
|
sl@0
|
35 |
static TInt RegisterClient(RScheduler& aScheduler)
|
sl@0
|
36 |
//
|
sl@0
|
37 |
// Utility function to simplify registering a client with the task scheduler
|
sl@0
|
38 |
//
|
sl@0
|
39 |
{
|
sl@0
|
40 |
TFileName filename = _L("Z:\\System\\Bin\\MinimalTaskHandler.exe");
|
sl@0
|
41 |
return aScheduler.Register(filename, 27);
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
//***********************************************************************************
|
sl@0
|
45 |
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-1023
|
sl@0
|
48 |
@SYMTestCaseDesc Tests for defect EDNHLJT-4WDEJV
|
sl@0
|
49 |
A Kern Exec3 panic occurs 30 minutes after scheduling 300 tasks to complete at once.
|
sl@0
|
50 |
@SYMTestPriority High
|
sl@0
|
51 |
@SYMTestActions Create the schedule for the task.Create 300 tasks and enable the schedule and wait for 30 seconds.Check if any panic occurs
|
sl@0
|
52 |
@SYMTestExpectedResults Check if any panic occurs
|
sl@0
|
53 |
@SYMREQ REQ0000
|
sl@0
|
54 |
*/
|
sl@0
|
55 |
static void Test1L()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
// Test title
|
sl@0
|
58 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-1023 \nTest for defect EDNHLJT-4WDEJV "));
|
sl@0
|
59 |
// A Kern Exec3 panic occurs after 30ish minutes after scheduling 300 tasks to complete at once.
|
sl@0
|
60 |
|
sl@0
|
61 |
// Constants / vars used in this function
|
sl@0
|
62 |
TSchedulerItemRef itemRef;
|
sl@0
|
63 |
|
sl@0
|
64 |
TheTest.Next(_L("Connect to Scheduler"));
|
sl@0
|
65 |
TInt res = TheScheduler.Connect();
|
sl@0
|
66 |
TheTest (res==KErrNone);
|
sl@0
|
67 |
|
sl@0
|
68 |
TheTest.Next(_L("Registering Client"));
|
sl@0
|
69 |
TheTest (RegisterClient(TheScheduler) == KErrNone);
|
sl@0
|
70 |
|
sl@0
|
71 |
// Create some scheduling entries
|
sl@0
|
72 |
CArrayFixFlat<TScheduleEntryInfo>* entries = new(ELeave) CArrayFixFlat<TScheduleEntryInfo>(10);
|
sl@0
|
73 |
CleanupStack::PushL(entries);
|
sl@0
|
74 |
|
sl@0
|
75 |
TScheduleEntryInfo entry1;
|
sl@0
|
76 |
entry1.iIntervalType = EHourly;
|
sl@0
|
77 |
entry1.iStartTime = SchSvrHelpers::TimeBasedOnOffset(1);
|
sl@0
|
78 |
entry1.iInterval = 1;
|
sl@0
|
79 |
entry1.iValidityPeriod = 20;
|
sl@0
|
80 |
entries->AppendL(entry1);
|
sl@0
|
81 |
|
sl@0
|
82 |
// Create the schedule for the task...
|
sl@0
|
83 |
res = TheScheduler.CreatePersistentSchedule(itemRef, *entries);
|
sl@0
|
84 |
TheTest(res == KErrNone);
|
sl@0
|
85 |
|
sl@0
|
86 |
// Disable the schedule straight away
|
sl@0
|
87 |
res = TheScheduler.DisableSchedule(itemRef.iHandle);
|
sl@0
|
88 |
TheTest(res == KErrNone);
|
sl@0
|
89 |
|
sl@0
|
90 |
if (res == KErrNone)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
for(TInt i=0; i<300; i++)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
// Create the tasks themselves..
|
sl@0
|
95 |
TTaskInfo task;
|
sl@0
|
96 |
task.iRepeat = 1; // repeat once
|
sl@0
|
97 |
task.iName = _L("Test Task For Defect Verification");
|
sl@0
|
98 |
task.iPriority = 100;
|
sl@0
|
99 |
//
|
sl@0
|
100 |
HBufC* taskData = HBufC::NewMaxLC(100);
|
sl@0
|
101 |
taskData->Des().Repeat(_L(" "));
|
sl@0
|
102 |
//
|
sl@0
|
103 |
res = TheScheduler.ScheduleTask(task, *taskData, itemRef.iHandle);
|
sl@0
|
104 |
TheTest(res == KErrNone);
|
sl@0
|
105 |
|
sl@0
|
106 |
CleanupStack::PopAndDestroy(taskData);
|
sl@0
|
107 |
}
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
res = TheScheduler.EnableSchedule(itemRef.iHandle);
|
sl@0
|
111 |
TheTest(res == KErrNone);
|
sl@0
|
112 |
|
sl@0
|
113 |
CleanupStack::PopAndDestroy(entries);
|
sl@0
|
114 |
|
sl@0
|
115 |
TheTest.Printf(_L("Waiting for 30 minutes\n"));
|
sl@0
|
116 |
// Wait for thirty minutes to see if a Kern Exec3 panic occurs
|
sl@0
|
117 |
User::After(1000000 * 60 * 30); // thirty mins
|
sl@0
|
118 |
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
//***********************************************************************************
|
sl@0
|
122 |
|
sl@0
|
123 |
GLDEF_C TInt DoTheTestsL()
|
sl@0
|
124 |
//
|
sl@0
|
125 |
// Kickoff method
|
sl@0
|
126 |
//
|
sl@0
|
127 |
{
|
sl@0
|
128 |
// Add tests here:-
|
sl@0
|
129 |
Test1L();
|
sl@0
|
130 |
|
sl@0
|
131 |
return KErrNone;
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
//***********************************************************************************
|
sl@0
|
135 |
GLDEF_C TInt E32Main()
|
sl@0
|
136 |
//
|
sl@0
|
137 |
// Entry point
|
sl@0
|
138 |
//
|
sl@0
|
139 |
{
|
sl@0
|
140 |
__UHEAP_MARK;
|
sl@0
|
141 |
TheTest.Title();
|
sl@0
|
142 |
TheTest.Start(_L("TheTest Task Scheduler Fixes"));
|
sl@0
|
143 |
|
sl@0
|
144 |
TInt error = KErrNone;
|
sl@0
|
145 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
146 |
if (!cleanup)
|
sl@0
|
147 |
return KErrNoMemory;
|
sl@0
|
148 |
|
sl@0
|
149 |
TheFsSession.Connect();
|
sl@0
|
150 |
TRAP(error, DoTheTestsL());
|
sl@0
|
151 |
TEST(error == KErrNone);
|
sl@0
|
152 |
TheFsSession.Close();
|
sl@0
|
153 |
TheTest(error == KErrNone);
|
sl@0
|
154 |
delete cleanup;
|
sl@0
|
155 |
|
sl@0
|
156 |
TheTest.End();
|
sl@0
|
157 |
TheTest.Close();
|
sl@0
|
158 |
__UHEAP_MARKEND;
|
sl@0
|
159 |
return(KErrNone);
|
sl@0
|
160 |
}
|