1082 test_Value(stat.Int(), stat == KErrNone); |
1082 test_Value(stat.Int(), stat == KErrNone); |
1083 test.Printf(_L("ok\n")); |
1083 test.Printf(_L("ok\n")); |
1084 } |
1084 } |
1085 |
1085 |
1086 |
1086 |
1087 |
|
1088 //----------------------------------------------------------------------------- |
1087 //----------------------------------------------------------------------------- |
|
1088 /** |
|
1089 Test that the reserving some drive space does not takes more space than required. |
|
1090 */ |
|
1091 void Test0() |
|
1092 { |
|
1093 test.Next(_L("test ReserveDriveSpace threshold")); |
|
1094 |
|
1095 TInt nRes; |
|
1096 TVolumeIOParamInfo volIop; |
|
1097 TInt64 freespace=0; |
|
1098 |
|
1099 //-- 1. format the volume |
|
1100 FormatDrive(); |
|
1101 |
|
1102 GetFreeDiskSpace(freespace); |
|
1103 const TInt64 freeSpace1 = freespace; //-- initial amount of free space on the volume |
|
1104 |
|
1105 nRes = TheFs.VolumeIOParam(gTestDrive, volIop); |
|
1106 test_KErrNone(nRes); |
|
1107 const TInt KClusterSz = volIop.iClusterSize; |
|
1108 if(!IsPowerOf2(KClusterSz)) |
|
1109 { |
|
1110 test.Next(_L("The FS hasn't reported a cluster size. The test is inconsistent, skipping")); |
|
1111 return; |
|
1112 } |
|
1113 |
|
1114 //-- reserve exactly 1 cluster worth drive space. |
|
1115 nRes = TheFs.ReserveDriveSpace(gTestDrive, KClusterSz); |
|
1116 test_KErrNone(nRes); |
|
1117 |
|
1118 GetFreeDiskSpace(freespace); |
|
1119 const TInt64 freeSpace2 = freespace; |
|
1120 test((freeSpace1 - freeSpace2) == KClusterSz); |
|
1121 |
|
1122 //-- fill up a drive (it has a reserved space) |
|
1123 FillUpDisk(); |
|
1124 |
|
1125 //-- delete 1 file; |
|
1126 nRes = DeleteFileX(KBaseName, 0); |
|
1127 test_KErrNone(nRes); |
|
1128 |
|
1129 //-- try to create a file with the size that is exacly the same as free space; it should succeed |
|
1130 GetFreeDiskSpace(freespace); |
|
1131 |
|
1132 nRes = CreateEmptyFile(TheFs, _L("\\aaa1"), freespace); |
|
1133 test_KErrNone(nRes); |
|
1134 |
|
1135 GetFreeDiskSpace(freespace); |
|
1136 test(freespace == 0); |
|
1137 |
|
1138 //-- return the drive space to the system |
|
1139 nRes = TheFs.ReserveDriveSpace(gTestDrive,0); |
|
1140 test_KErrNone(nRes); |
|
1141 |
|
1142 //-- release drive space |
|
1143 nRes = TheFs.ReleaseReserveAccess(gTestDrive); |
|
1144 test_KErrNone(nRes); |
|
1145 |
|
1146 GetFreeDiskSpace(freespace); |
|
1147 test(freespace == KClusterSz); |
|
1148 |
|
1149 FormatDrive(); |
|
1150 } |
|
1151 |
|
1152 //----------------------------------------------------------------------------- |
1089 |
1153 |
1090 GLDEF_C void CallTestsL() |
1154 GLDEF_C void CallTestsL() |
1091 // |
1155 // |
1092 // Do tests relative to session path |
1156 // Do tests relative to session path |
1093 // |
1157 // |
1094 { |
1158 { |
1095 //-- set up console output |
1159 //-- set up console output |
1096 Fat_Test_Utils::SetConsole(test.Console()); |
1160 Fat_Test_Utils::SetConsole(test.Console()); |
1097 |
1161 |
1098 // If TESTFAST mode (for automated test builds) is set, don't run LFFS tests. |
1162 // If TESTFAST mode (for automated test builds) is set, don't run LFFS tests. |
1099 if ((UserSvr::DebugMask(2) & 0x00000002) && IsTestingLFFS()) |
1163 if ((UserSvr::DebugMask(2) & 0x00000002) && IsTestingLFFS()) |
1100 { |
1164 { |
1101 test.Printf(_L("TEST NOT RUN FOR LFFS DRIVE")); |
1165 test.Printf(_L("TEST NOT RUN FOR LFFS DRIVE")); |
1102 return; |
1166 return; |