--- a/kerneltest/f32test/demandpaging/loader/t_pageldrtst.cpp Mon Dec 21 16:14:42 2009 +0000
+++ b/kerneltest/f32test/demandpaging/loader/t_pageldrtst.cpp Wed Dec 23 11:43:31 2009 +0000
@@ -4278,14 +4278,17 @@
TInt inFileSize[FILECOUNTMAX];
TInt inFilePos[FILECOUNTMAX];
TBool fileOk[FILECOUNTMAX];
-
+
TInt index;
TFileName newPath;
TFileName oldPath;
for (index = 0; index < FILECOUNTMAX; index ++)
{
- fileOk[index] = ETrue;
+ inFileSize[index] = 0;
+ inFilePos[index] = 0;
+ fileOk[index] = EFalse;
+
if (index < PAGELDRTST_MAX_DLLS)
{
oldPath.Format(_L("%S%S%d%S"), &KRomPath, &KDllBaseName, index, &TestPlExtNames[KTestMediaBase]);
@@ -4305,86 +4308,76 @@
retVal = theInFiles[index].Open(aFs, oldPath, EFileRead);
if (retVal != KErrNone)
{
- fileOk[index] = EFalse;
- DBGS_PRINT((_L("%S : Failed to open (%d)\n"), &oldPath, retVal));
- break;
- }
- retVal = theOutFiles[index].Replace(aFs, newPath, EFileWrite);
- if (retVal != KErrNone)
- {
- fileOk[index] = EFalse;
- DBGS_PRINT((_L("%S : Failed to open (%d)\n"), &newPath, retVal));
+ DBGS_PRINT((_L("%S : Failed to open for read (%d)\n"), &oldPath, retVal));
break;
}
retVal = theInFiles[index].Size(inFileSize[index]);
if (retVal != KErrNone)
{
- fileOk[index] = EFalse;
+ theInFiles[index].Close();
DBGS_PRINT((_L("%S : Failed to get file size (%d)\n"), &newPath, retVal));
break;
}
- inFilePos[index] = 0;
+ retVal = theOutFiles[index].Replace(aFs, newPath, EFileWrite);
+ if (retVal != KErrNone)
+ {
+ theInFiles[index].Close();
+ DBGS_PRINT((_L("%S : Failed to open for write (%d)\n"), &newPath, retVal));
+ break;
+ }
+
+ fileOk[index] = ETrue;
}
const TInt KBufferSize = 3333;
TBuf8<KBufferSize> buffer;
-
- TBool stillGoing = ETrue;
-
- while (stillGoing)
+ TBool stillGoing;
+
+ do
{
stillGoing = EFalse;
for (index = 0; index < FILECOUNTMAX; index ++)
{
+ if (!fileOk[index])
+ break;
if (inFilePos[index] < inFileSize[index])
{
- if (fileOk[index])
+ retVal = theInFiles[index].Read(buffer);
+ if (retVal != KErrNone)
+ {
+ DBGS_PRINT((_L("theInFiles[%d] read failed (%d)\n"), index, retVal));
+ break;
+ }
+ retVal = theOutFiles[index].Write(buffer);
+ if (retVal != KErrNone)
{
- retVal = theInFiles[index].Read(buffer);
- if (retVal != KErrNone)
- {
- DBGS_PRINT((_L("theInFiles[%d] read failed (%d)\n"), index, retVal));
- fileOk[index] = EFalse;
- break;
- }
- retVal = theOutFiles[index].Write(buffer);
- if (retVal != KErrNone)
- {
- DBGS_PRINT((_L("theOutFiles[%d] Write failed (%d)\n"), index, retVal));
- fileOk[index] = EFalse;
- break;
- }
- retVal = theOutFiles[index].Flush();
- if (retVal != KErrNone)
- {
- DBGS_PRINT((_L("theOutFiles[%d] flush failed (%d)\n"), index, retVal));
- fileOk[index] = EFalse;
- break;
- }
- inFilePos[index] += buffer.Length();
+ DBGS_PRINT((_L("theOutFiles[%d] Write failed (%d)\n"), index, retVal));
+ break;
}
- else
+ retVal = theOutFiles[index].Flush();
+ if (retVal != KErrNone)
+ {
+ DBGS_PRINT((_L("theOutFiles[%d] flush failed (%d)\n"), index, retVal));
break;
- }
- if ((inFilePos[index] < inFileSize[index]) && (fileOk[index]))
- {
- stillGoing = ETrue;
+ }
+ inFilePos[index] += buffer.Length();
+ if (inFilePos[index] < inFileSize[index])
+ stillGoing = ETrue;
}
}
- if (!fileOk[index])
- break;
}
-
- TBool allOk = ETrue;
+ while (stillGoing);
+
+ TBool allOk = retVal == KErrNone;
for (index = 0; index < FILECOUNTMAX; index ++)
{
- theInFiles[index].Close();
- theOutFiles[index].Close();
if (!fileOk[index])
{
allOk = EFalse;
- continue;
+ break;
}
+ theInFiles[index].Close();
+ theOutFiles[index].Close();
if (index < PAGELDRTST_MAX_DLLS)
{
newPath.Format(_L("%S%S%d%S"), &aPath, &KDllBaseName, index, &TestPlExtNames[aMediaType]);
@@ -4542,8 +4535,9 @@
TInt retVal = aFileMan->Delete(aFileName);
if (retVal != KErrNone)
{
- if (TestingReaper && (retVal == KErrInUse))
+ if (TestingReaper)
{
+ aFileMan->Attribs(aFileName, KEntryAttNormal, KEntryAttReadOnly, 0);
retVal = l.Delete(aFileName);
if (retVal != KErrNone)
{
@@ -4979,7 +4973,7 @@
if (TestWeAreTheTestBase)
CleanupFiles(ETrue);
-
+
CheckFilePresence(TestWeAreTheTestBase);
}