0
|
1 |
// Copyright (c) 2006-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 the License "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 |
// Carries out integrity checking of a disk and fixing errors
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "basetestfat32checkdisk.h"
|
|
19 |
|
|
20 |
/**
|
|
21 |
Class Constructor
|
|
22 |
*/
|
|
23 |
CBaseTestFat32CheckDisk::CBaseTestFat32CheckDisk()
|
|
24 |
{
|
|
25 |
SetTestStepName(KTestStepCheckDisk);
|
|
26 |
}
|
|
27 |
|
|
28 |
/**
|
|
29 |
Class Destructor
|
|
30 |
*/
|
|
31 |
CBaseTestFat32CheckDisk::~CBaseTestFat32CheckDisk()
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
|
|
36 |
/**
|
|
37 |
The function performs the following actions
|
|
38 |
1. Verify the integrity of the disk by calling RFs::ScanDisk()
|
|
39 |
2. Check whether the code returned match the code specified in the ini file.
|
|
40 |
3. If scan dsik is specified in the ini file then call RFs::ScanDrive()
|
|
41 |
|
|
42 |
@return EPass if test passes and EFail if test fails
|
|
43 |
*/
|
|
44 |
TVerdict CBaseTestFat32CheckDisk::doTestStepL()
|
|
45 |
{
|
|
46 |
SetTestStepResult(EFail);
|
|
47 |
TInt r;
|
|
48 |
_LIT(KCheckCode,"CheckCode");
|
|
49 |
TInt checkcode;
|
|
50 |
_LIT(KScan,"Scan");
|
|
51 |
TInt scan;
|
|
52 |
_LIT(KPassRegardless,"PassRegardless");
|
|
53 |
TBuf<4> passRegardless;
|
|
54 |
TPtrC16 passregardless = passRegardless;
|
|
55 |
TBool alright = GetIntFromConfig(ConfigSection(), KCheckCode, checkcode);
|
|
56 |
if(alright)
|
|
57 |
{
|
|
58 |
TBool alright2 = GetStringFromConfig(ConfigSection(), KPassRegardless, passregardless);
|
|
59 |
if(alright2)
|
|
60 |
{
|
|
61 |
// Perform a check disk.
|
|
62 |
r=iTheFs.CheckDisk(iSessionPath);
|
|
63 |
if (r!=checkcode)
|
|
64 |
{
|
|
65 |
// If the code returned does not match the code expected and would
|
|
66 |
// like only a warning to be displayed as opposed to failing the
|
|
67 |
// test
|
|
68 |
if (passregardless == _L("Y"))
|
|
69 |
{
|
|
70 |
SetTestStepResult(EPass);
|
|
71 |
_LIT(KErrorPass, "RFs::CheckDisk() returns %d & does not match expected value %d");
|
|
72 |
INFO_PRINTF3(KErrorPass, r, checkcode);
|
|
73 |
}
|
|
74 |
// If the code returned does not match the code expected and would
|
|
75 |
// like to fail the test
|
|
76 |
else
|
|
77 |
{
|
|
78 |
SetTestStepResult(EFail);
|
|
79 |
_LIT(KCheckDiskFail, "RFs::CheckDisk() returns %d & does not match expected value %d");
|
|
80 |
INFO_PRINTF3(KCheckDiskFail, r, checkcode);
|
|
81 |
}
|
|
82 |
}
|
|
83 |
else
|
|
84 |
{
|
|
85 |
SetTestStepResult(EPass);
|
|
86 |
_LIT(KCheckDiskPass, "RFs::CheckDisk() returns %d & matches expected value %d");
|
|
87 |
INFO_PRINTF3(KCheckDiskPass, r, checkcode);
|
|
88 |
}
|
|
89 |
// If specified in the ini file, perform a ScanDrive on the volume
|
|
90 |
TBool alright = GetIntFromConfig(ConfigSection(), KScan, scan);
|
|
91 |
if(alright)
|
|
92 |
{
|
|
93 |
r=iTheFs.ScanDrive(iSessionPath);
|
|
94 |
if (r!=KErrNone)
|
|
95 |
{
|
|
96 |
SetTestStepResult(EFail);
|
|
97 |
_LIT(KScanFail, "RFs::ScanDrive() failed returns %d");
|
|
98 |
INFO_PRINTF2(KScanFail, r);
|
|
99 |
}
|
|
100 |
else
|
|
101 |
{
|
|
102 |
SetTestStepResult(EPass);
|
|
103 |
_LIT(KScanPass, "RFs::ScanDrive() passed");
|
|
104 |
INFO_PRINTF1(KScanPass);
|
|
105 |
}
|
|
106 |
}
|
|
107 |
else
|
|
108 |
{
|
|
109 |
_LIT(KNoScan, "RFs::ScanDrive() not indicated in ini file");
|
|
110 |
INFO_PRINTF1(KNoScan);
|
|
111 |
}
|
|
112 |
return TestStepResult();
|
|
113 |
}
|
|
114 |
|
|
115 |
else
|
|
116 |
{
|
|
117 |
_LIT(KReadIniFail, "Could not read PassRegardless from ini file");
|
|
118 |
INFO_PRINTF1(KReadIniFail);
|
|
119 |
return TestStepResult();
|
|
120 |
}
|
|
121 |
}
|
|
122 |
else
|
|
123 |
{
|
|
124 |
_LIT(KReadIniFail, "Could not read CheckCode from ini file");
|
|
125 |
INFO_PRINTF1(KReadIniFail);
|
|
126 |
return TestStepResult();
|
|
127 |
}
|
|
128 |
}
|