kerneltest/f32test/server/t_fsys.cpp
author hgs
Mon, 04 Oct 2010 12:03:52 +0100
changeset 279 957c583b417b
parent 271 dc268b18d709
child 291 206a6eaaeb71
permissions -rw-r--r--
201039_07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     2
// All rights reserved.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     7
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     8
// Initial Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    10
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    11
// Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    12
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    13
// Description:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    14
// f32test\server\t_fsys.cpp
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    15
// 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    16
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    17
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    18
#define __E32TEST_EXTENSION__
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    19
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    20
#include <f32file.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    21
#include <f32file_private.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    22
#include <e32test.h>
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    23
#include <e32math.h>
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    24
#include "t_server.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    25
#include "fat_utils.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    26
#include "filesystem_fat.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    27
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    28
using namespace Fat_Test_Utils;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    29
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    30
RTest test(_L("T_FSYS"));
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    31
static TInt64   gRndSeed;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    32
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    33
_LIT(KTestFsy,  "T_TFSYS");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    34
_LIT(KTestFsy2, "T_TFSYS2");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    35
_LIT(KTestFsy3, "T_TFSYS3");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    36
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    37
_LIT(KTestFsName,  "Test");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    38
_LIT(KTestFsName2, "Test2");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    39
_LIT(KTestFsName3, "Test3");
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    40
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    41
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
    42
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    43
//---------------------------------------------------
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    44
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    45
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    46
void InitGlobals()
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    47
{
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    48
    //-- initialise random generator 
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    49
    gRndSeed = 0xf73c1ab;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    50
    Math::Rand(gRndSeed);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    51
}
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    52
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    53
//---------------------------------------------------
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    54
void DestroyGlobals()
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    55
{
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    56
}
1560c419b176 201033_10
hgs
parents: 122
diff changeset
    57
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    58
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    59
//---------------------------------------------------
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    60
/**
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    61
    Test CFsMountHelper class functionality
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    62
*/
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    63
void TestFsMountHelper()
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    64
{
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    65
    test.Next(_L("Test CFsMountHelper class functionality\n"));
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    66
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    67
    if(Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    68
    {
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    69
        test.Printf(_L("Can't test on a simulated drive, skipping!\n"));
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    70
        return;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    71
    }
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    72
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    73
    TInt    nRes;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    74
    TFSName fsName;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    75
    TFSName fsName1;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    76
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    77
    CFsMountHelper* pHelper1 = CFsMountHelper::New(TheFs, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    78
    test(pHelper1 !=0);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    79
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    80
    CFsMountHelper* pHelper2 = CFsMountHelper::New(TheFs, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    81
    test(pHelper2 !=0);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    82
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    83
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    84
    //-- 1. store the original file system state
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    85
    nRes = pHelper1->GetMountProperties();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    86
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    87
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    88
    //-- 1.1 simple case. dismount the file system and mount it back
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    89
    nRes = TheFs.FileSystemName(fsName, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    90
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    91
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    92
    nRes = pHelper1->DismountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    93
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    94
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    95
    nRes = pHelper1->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    96
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    97
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    98
    nRes = TheFs.FileSystemName(fsName1, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
    99
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   100
    test(fsName1 == fsName);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   101
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   102
    //-- 1.2 attempts to dismount FS that has files opened
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   103
    _LIT(KFileName, "\\myfile");
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   104
    _LIT8(KFileData, "\\this is the file data");
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   105
    RFile file;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   106
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   107
    nRes = file.Replace(TheFs, KFileName, EFileWrite);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   108
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   109
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   110
    //-- 1.2.1 simplistic API
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   111
    nRes = pHelper1->DismountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   112
    test_Value(nRes, nRes == KErrInUse);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   113
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   114
    //-- 1.2.1 more advanced asynchronous API
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   115
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   116
    TRequestStatus stat;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   117
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   118
    //-- 1.2.1.1 simple normal dismounting, Rfs::DismountFileSystem() analog
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   119
    pHelper1->DismountFileSystem(stat, CFsMountHelper::ENormal);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   120
    User::WaitForRequest(stat);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   121
    test_Value(stat.Int(), stat.Int() == KErrInUse);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   122
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   123
    //-- 1.2.1.2 dismount with notifying clients (no clients, so it should succeed)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   124
    //-- this will be a kind of forced dismounting
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   125
    pHelper1->DismountFileSystem(stat, CFsMountHelper::ENotifyClients);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   126
    User::WaitForRequest(stat);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   127
    test_KErrNone(stat.Int());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   128
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   129
    nRes = file.Write(KFileData);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   130
    test_Value(nRes, nRes == KErrNotReady); //-- no file system on the drive
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   131
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   132
    //-- mount the file system back
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   133
    nRes = pHelper1->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   134
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   135
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   136
    nRes = file.Write(KFileData);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   137
    test_Value(nRes, nRes == KErrDisMounted);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   138
    file.Close();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   139
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   140
    //-- 1.2.1.3 forced dismounting
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   141
    nRes = file.Replace(TheFs, KFileName, EFileWrite);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   142
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   143
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   144
    pHelper1->DismountFileSystem(stat, CFsMountHelper::ENormal);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   145
    User::WaitForRequest(stat);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   146
    test_Value(stat.Int(), stat.Int() == KErrInUse);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   147
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   148
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   149
    pHelper1->DismountFileSystem(stat, CFsMountHelper::EForceImmediate);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   150
    User::WaitForRequest(stat);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   151
    test_KErrNone(stat.Int());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   152
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   153
    nRes = file.Write(KFileData);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   154
    test_Value(nRes, nRes == KErrNotReady); //-- no file system on the drive
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   155
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   156
    file.Close();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   157
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   158
    //-- there is no file system on the drive. 
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   159
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   160
    //-- test weird use cases 
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   161
    nRes = pHelper2->GetMountProperties();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   162
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   163
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   164
    //nRes = pHelper2->MountFileSystem(); //-- this will trigger an assert in debug mode
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   165
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   166
    //-- 2. test extensions
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   167
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   168
    //-- 2.1 mount the file system back
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   169
    nRes = pHelper1->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   170
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   171
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   172
    //-- 2.2 install secondary extension
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   173
    _LIT(KExtensionLog,"T_LOGEXT");     //-- test secondary extension module name *.fxt
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   174
    _LIT(KExtensionLogName,"Logger");   //-- extension name
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   175
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   176
    nRes = TheFs.AddExtension(KExtensionLog);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   177
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   178
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   179
    nRes = TheFs.MountExtension(KExtensionLogName, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   180
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   181
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   182
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 0); //-- extension slot 0
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   183
    test(nRes == KErrNone);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   184
    test(fsName1 == KExtensionLogName);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   185
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   186
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 1); //-- extension slot 1
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   187
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   188
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   189
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   190
    //-- 2.3 dismount the file system, it has now different set of properties comparing to ones stored in the pHelper1
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   191
    nRes = pHelper2->GetMountProperties();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   192
    test(nRes == KErrNone);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   193
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   194
    nRes = pHelper2->DismountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   195
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   196
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   197
    //-- 2.3.1 mount the original FS (without extension)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   198
    nRes = pHelper1->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   199
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   200
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   201
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 0); //-- extension slot 0
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   202
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   203
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   204
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 1); //-- extension slot 1
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   205
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   206
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   207
    nRes = pHelper1->DismountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   208
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   209
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   210
    //-- 2.3.2 mount back the FS with extension
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   211
    nRes = pHelper2->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   212
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   213
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   214
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 0); //-- extension slot 0
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   215
    test(nRes == KErrNone);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   216
    test(fsName1 == KExtensionLogName);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   217
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   218
    //-- 2.4 remove the extensions and dismount the file system with properties stored in pHelper2
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   219
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 1); //-- extension slot 1
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   220
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   221
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   222
    nRes = pHelper2->DismountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   223
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   224
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   225
    nRes = TheFs.RemoveExtension(KExtensionLogName);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   226
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   227
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   228
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   229
    //-- 2.4 restore the original file system
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   230
    nRes = pHelper1->MountFileSystem();
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   231
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   232
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   233
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 0); //-- extension slot 0
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   234
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   235
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   236
    nRes = TheFs.ExtensionName(fsName1, CurrentDrive(), 1); //-- extension slot 1
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   237
    test_Value(nRes, nRes == KErrNotFound)
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   238
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   239
    nRes = TheFs.FileSystemName(fsName1, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   240
    test_KErrNone(nRes);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   241
    test(fsName1 == fsName);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   242
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   243
    delete pHelper1;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   244
    delete pHelper2;
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   245
}
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   246
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   247
//---------------------------------------------------
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   248
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   249
/**
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   250
    The maximum length for the file system and extension names is KMaxFSNameLength
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   251
    test how the file server supports this
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   252
*/
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   253
void TestFileSystemNameLength()
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   254
{
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   255
    test.Next(_L("Test file system name length limits\n"));
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   256
    if(Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   257
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   258
        test.Printf(_L("Can't test on a simulated drive, skipping!\n"));
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   259
        return;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   260
    }
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   261
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   262
    TInt nRes;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   263
    TBuf<1024> name;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   264
    TInt i;
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   265
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   266
    _LIT(KEmptyName, "");                //-- invalid length == 0
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   267
    _LIT(KDoesNotExist,  "RubbishName"); //-- valid length == 11
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   268
    _LIT(KDoesNotExist1, "RubbishName123456789012345678901"); //-- valid length == 32 (KMaxFSNameLength)
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   269
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   270
    _LIT(KNameTooLong1,  "RubbishName123456789012345678901_"); //-- invalid length == 33 (KMaxFSNameLength+1)
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   271
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   272
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   273
    test(KDoesNotExist1().Length() == KMaxFSNameLength);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   274
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   275
    //-- generate a very long name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   276
    name.Zero();
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   277
    for(i=0; i<(name.MaxLength()/KDoesNotExist1().Length()); ++i)
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   278
    {
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   279
        name.Append(KDoesNotExist1);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   280
    }
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   281
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   282
    //-- 1. try to dismount the existing FS/extension specifying invalid name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   283
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   284
    //-- 1.1 try empty names
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   285
    nRes = TheFs.DismountFileSystem(KEmptyName, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   286
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   287
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   288
    nRes = TheFs.DismountExtension(KEmptyName, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   289
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   290
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   291
    //-- 1.2 valid length, but non-existing name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   292
    nRes = TheFs.DismountFileSystem(KDoesNotExist, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   293
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   294
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   295
    nRes = TheFs.DismountExtension(KDoesNotExist, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   296
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   297
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   298
    //-- 1.2 valid length == KMaxFSNameLength, but non-existing name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   299
    nRes = TheFs.DismountFileSystem(KDoesNotExist1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   300
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   301
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   302
    nRes = TheFs.DismountExtension(KDoesNotExist1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   303
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   304
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   305
    //-- 1.3 too long name == KMaxFSNameLength+1, 
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   306
    nRes = TheFs.DismountFileSystem(KNameTooLong1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   307
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   308
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   309
    nRes = TheFs.DismountExtension(KNameTooLong1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   310
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   311
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   312
    //-- 1.4 a very long name ~ 1024 characters, 
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   313
    nRes = TheFs.DismountFileSystem(name, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   314
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   315
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   316
    nRes = TheFs.DismountExtension(name, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   317
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   318
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   319
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   320
    //-- try mounting extensions with valid, bu non-existing names
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   321
    nRes = TheFs.MountExtension(KDoesNotExist, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   322
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   323
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   324
    nRes = TheFs.MountExtension(KDoesNotExist1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   325
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   326
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   327
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   328
    //====================================================
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   329
    //-- dismount original file system from the drive
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   330
    
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   331
    CFsMountHelper* pHelper = CFsMountHelper::New(TheFs, CurrentDrive());
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   332
    test(pHelper !=0);
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   333
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   334
    nRes = pHelper->GetMountProperties();
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   335
    test_KErrNone(nRes);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   336
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   337
    nRes = pHelper->DismountFileSystem();
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   338
    test_KErrNone(nRes);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   339
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   340
    //-- 2. try to mount a FS/extension with the invalid name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   341
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   342
    //-- 2.1 try empty names
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   343
    nRes = TheFs.MountFileSystem(KEmptyName, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   344
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   345
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   346
    nRes = TheFs.MountExtension(KEmptyName, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   347
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   348
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   349
    //-- 1.2 valid length, but non-existing name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   350
    nRes = TheFs.MountFileSystem(KDoesNotExist, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   351
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   352
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   353
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   354
    //-- 1.2 valid length == KMaxFSNameLength, but non-existing name
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   355
    nRes = TheFs.MountFileSystem(KDoesNotExist1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   356
    test_Value(nRes, nRes == KErrNotFound);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   357
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   358
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   359
    //-- 1.3 too long name == KMaxFSNameLength+1, 
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   360
    nRes = TheFs.MountFileSystem(KNameTooLong1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   361
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   362
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   363
    nRes = TheFs.MountExtension(KNameTooLong1, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   364
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   365
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   366
    //-- 1.4 a very long name ~ 1024 characters, 
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   367
    nRes = TheFs.MountFileSystem(name, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   368
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   369
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   370
    nRes = TheFs.MountExtension(name, CurrentDrive());
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   371
    test_Value(nRes, nRes == KErrArgument);
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   372
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   373
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   374
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   375
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   376
    //-- mount original file system back to the drive
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   377
    nRes = pHelper->MountFileSystem();
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   378
    test_KErrNone(nRes);
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   379
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
   380
    delete pHelper;
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   381
}
1560c419b176 201033_10
hgs
parents: 122
diff changeset
   382
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   383
//---------------------------------------------------
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   384
static void TestFileSystemNames()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   385
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   386
    test.Next(_L("TestFileSystemNames(). Read file system names for all drives\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   387
    TFullName name;
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   388
    TBuf<60>  buf;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   389
    TInt nRes;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   390
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   391
    TDriveList drvList;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   392
    nRes = TheFs.DriveList(drvList);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   393
    test_KErrNone(nRes);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   394
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   395
    for(TInt i=0; i<KMaxDrives; ++i)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   396
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   397
        buf.Format(_L("drv %C: att:0x%02x"), 'A'+i, drvList[i]);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   398
        
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   399
        nRes = TheFs.FileSystemName(name, i);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   400
        test_Value(nRes, nRes == KErrNone || nRes==KErrNotFound);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   401
        
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   402
        if(nRes == KErrNone)
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   403
            {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   404
            buf.AppendFormat(_L(" Mounted FS:%S"), &name);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   405
            }
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   406
        else
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   407
            {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   408
            buf.Append(_L(" Mounted FS:"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   409
            }
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   410
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   411
        buf.Append(_L("\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   412
        test.Printf(buf);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   413
        }
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   414
    
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   415
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   416
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   417
//---------------------------------------------------
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   418
static void CheckDismount(TDesC& aFs,TInt aDrive)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   419
    {
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   420
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   421
    if (aDrive==EDriveC) // ??? Can't test on C: - see below
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   422
        return;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   423
    TInt r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   424
    TFullName oldSess, newSess;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   425
    r=TheFs.SessionPath(oldSess);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   426
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   427
    TChar c;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   428
    r=TheFs.DriveToChar(aDrive,c);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   429
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   430
    newSess.Append(c);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   431
    newSess.Append(':');
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   432
    newSess.Append('\\');
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   433
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   434
    TBuf<128> b;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   435
    TDriveInfo di;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   436
    r=TheFs.Drive(di,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   437
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   438
    b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)\n"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   439
    test.Next(b);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   440
    
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   441
    // Test cannot dismount on rom drive
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   442
    test.Next(_L("Test cannot dismount on Rom drive\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   443
    TFullName zName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   444
    r=TheFs.FileSystemName(zName,EDriveZ);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   445
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   446
    r=TheFs.DismountFileSystem(zName,EDriveZ);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   447
    test.Printf(_L("r=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   448
    // NB if paging is enabled on a ROFS partition which is part of the composite file system then the 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   449
    // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   450
    test_Value(r, r == KErrAccessDenied || r==KErrInUse);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   451
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   452
    // Test cannot dismount on wrong drive
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   453
    test.Next(_L("Test cannot dismount on wrong drive\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   454
    r=TheFs.DismountFileSystem(aFs,EDriveA);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   455
    test_Value(r, r == KErrNotReady);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   456
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   457
    // Test cannot dismount with wrong name
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   458
    test.Next(_L("Test cannot dismount with wrong file system name\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   459
    r=TheFs.DismountFileSystem(_L("abc"),aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   460
    test_Value(r, r == KErrNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   461
 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   462
    // Test cannot dismount with a file open
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   463
    test.Next(_L("Test cannot dismount with a file open\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   464
    r=TheFs.SetSessionPath(newSess);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   465
    RFile file;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   466
    r=file.Replace(TheFs,_L("abc"),EFileShareAny);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   467
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   468
    r=TheFs.SessionPath(newSess);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   469
    TBool open;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   470
    r=TheFs.IsFileOpen(_L("abc"),open);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   471
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   472
    test(open);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   473
    r=TheFs.DismountFileSystem(aFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   474
    test_Value(r, r == KErrInUse);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   475
    file.Close();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   476
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   477
    // Now test dismount works
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   478
    test.Next(_L("Test dismounts OK\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   479
    r=TheFs.DismountFileSystem(aFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   480
    if(r!=KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   481
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   482
        test.Printf(_L("Error = %d\n"),r);    
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   483
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   484
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   485
    TFullName n;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   486
    r=TheFs.FileSystemName(n,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   487
    test_Value(r, r == KErrNone || r==KErrNotFound);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   488
    test(!n.Length());
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   489
    r=file.Replace(TheFs,_L("abc"),EFileShareAny);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   490
    test_Value(r, r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   491
    file.Close();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   492
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   493
    r=TheFs.MountFileSystem(aFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   494
    if(r!=KErrNone) 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   495
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   496
        test.Printf(_L("error = %d\n"),r);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   497
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   498
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   499
    r=TheFs.FileSystemName(n,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   500
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   501
    test(n.Compare(aFs)==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   502
    r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   503
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   504
    file.Close();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   505
    r=TheFs.SetSessionPath(oldSess);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   506
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   507
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   508
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   509
static void TestDismountFileSystem(TInt aDrive)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   510
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   511
    test.Next(_L("TestDismountFileSystem()\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   512
    TInt r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   513
    TFullName name;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   514
    r=TheFs.FileSystemName(name,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   515
    test_Value(r, r == KErrNone || r==KErrNotFound);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   516
    if(name.Length())
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   517
        CheckDismount(name,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   518
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   519
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   520
//---------------------------------------------------
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   521
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   522
// Mount a new CTestFileSystem on the drive under test
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   523
//
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   524
static void TestFileSystem(TInt aDrive)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   525
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   526
    test.Next(_L("TestFileSystem()\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   527
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   528
    if(Is_SimulatedSystemDrive(TheFs, aDrive))
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   529
        {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   530
        test.Printf(_L("Can't test on a simulated drive, skipping!\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   531
        return;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   532
        }
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   533
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   534
    TBuf<64> b;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   535
    TChar c;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   536
    TInt r=TheFs.DriveToChar(aDrive,c);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   537
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   538
    TDriveInfo di;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   539
    r=TheFs.Drive(di,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   540
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   541
    b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)\n"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   542
    test.Next(b);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   543
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   544
    test.Next(_L("Test mounting of test file system\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   545
    r=TheFs.AddFileSystem(KTestFsy);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   546
    if(r!=KErrNone && r!=KErrAlreadyExists)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   547
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   548
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   549
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   550
        }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   551
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   552
    TFullName oldFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   553
    r=TheFs.FileSystemName(oldFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   554
//  TFileName oldFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   555
//  r=TheFs.FileSystemName(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   556
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   557
    r=TheFs.DismountFileSystem(oldFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   558
    if(r!=KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   559
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   560
        test.Printf(_L("Error = %d\n"),r);    
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   561
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   562
        }
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   563
    r=TheFs.MountFileSystem(KTestFsName,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   564
    test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   565
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   566
    TFileName newFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   567
    r=TheFs.FileSystemName(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   568
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   569
    test(newFs.Compare(KTestFsName)==0);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   570
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   571
    // Check attributes
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   572
    TDriveInfo info;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   573
    r=TheFs.Drive(info,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   574
    test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   575
 
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   576
    test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType, (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   577
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   578
    //Try to remove filesystem without dismounting.
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   579
    r=TheFs.RemoveFileSystem(KTestFsName);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   580
    if(r!=KErrInUse)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   581
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   582
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   583
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   584
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   585
    r=TheFs.FileSystemName(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   586
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   587
    test(newFs.Compare(KTestFsName)==0);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   588
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   589
    r=TheFs.DismountFileSystem(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   590
    test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   591
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   592
    r=TheFs.MountFileSystem(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   593
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   594
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   595
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   596
//---------------------------------------------------
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   597
static void TestMountInvalidDrive()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   598
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   599
    test.Next(_L("TestMountInvalidDrive(). Try mounting FS on an invalid drive\n"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   600
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   601
    //-- 1. find an invalid drive
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   602
    TInt drv = 0;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   603
    TDriveList drvList;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   604
    
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   605
    TInt nRes = TheFs.DriveList(drvList);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   606
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   607
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   608
    for(drv =0; drv<KMaxDrives; ++drv)
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   609
        {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   610
        if(!drvList[drv])
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   611
            break;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   612
        }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   613
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   614
    test.Printf(_L("Try mounting a test FS onto drive:%C:\n"), 'A'+drv);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   615
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   616
    nRes = TheFs.AddFileSystem(KTestFsy);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   617
    test_Value(nRes, nRes == KErrNone || nRes == KErrAlreadyExists);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   618
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   619
    nRes = TheFs.MountFileSystem(KTestFsName, drv);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   620
    test_Value(nRes, nRes == KErrArgument);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   621
    
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   622
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   623
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   624
// Additional step for INC083446: Corrupted miniSD not detected as corrupted by phone 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   625
static void TestMountingBrokenMedia(TInt aDrive)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   626
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   627
// Mount a new CTestFileSystem on the drive under test
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   628
//
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   629
    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   630
    if (aDrive==EDriveC) // ??? Can't test on C:
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   631
        return;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   632
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   633
    TBuf<64> b;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   634
    TChar c;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   635
    TInt r=TheFs.DriveToChar(aDrive,c);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   636
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   637
    TDriveInfo di;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   638
    r=TheFs.Drive(di,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   639
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   640
    b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)\n"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   641
    test.Next(b);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   642
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   643
    test.Next(_L("Test mounting of test file system\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   644
    r=TheFs.AddFileSystem(KTestFsy2);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   645
    if(r!=KErrNone && r!=KErrAlreadyExists)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   646
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   647
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   648
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   649
        }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   650
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   651
    TFullName oldFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   652
    r=TheFs.FileSystemName(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   653
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   654
    r=TheFs.DismountFileSystem(oldFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   655
    if(r!=KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   656
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   657
        test.Printf(_L("Error = %d\n"),r);    
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   658
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   659
        }
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   660
    r=TheFs.MountFileSystem(KTestFsName2 ,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   661
    test_Value(r, r == KErrCorrupt);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   662
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   663
    TFileName newFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   664
    r=TheFs.FileSystemName(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   665
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   666
    test(newFs.Compare(KTestFsName2)==0);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   667
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   668
    // Get the number of remounts by checking the volume attributes -
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   669
    // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   670
    TDriveInfo info;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   671
    TInt remounts;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   672
    r=TheFs.Drive(info,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   673
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   674
    test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   675
        (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   676
    remounts = (TInt) info.iBattery;
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   677
    test.Printf(_L("Initial remounts = %d\n"), remounts);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   678
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   679
    // Make the file server attempt to remount the drive by looking for a non-existant DLL
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   680
    // The file server should setop trying to remount the driver after KMaxMountFailures attempts
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   681
    const TInt KMaxMountFailures = 3;   // copied from sf_drv.cpp
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   682
    const TInt KEntryAttempts = 10;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   683
    TInt entryAttempts;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   684
    for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   685
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   686
        TEntry entry;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   687
        _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   688
        r = TheFs.Entry(KNonExistantFilename, entry);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   689
        test_Value(r, r == KErrCorrupt);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   690
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   691
    r=TheFs.Drive(info,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   692
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   693
    test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   694
        (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   695
    remounts = (TInt) info.iBattery;
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   696
    test.Printf(_L("Remounts = %d\n"), remounts);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   697
    test(remounts ==  KMaxMountFailures);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   698
    
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   699
    // simulate a media change to reset failure count
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   700
    r = TheFs.RemountDrive(aDrive, NULL, 0);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   701
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   702
    // now try mounting again & verify the the file server attempts to mount the drive again
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   703
    for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   704
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   705
        TEntry entry;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   706
        _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   707
        r = TheFs.Entry(KNonExistantFilename, entry);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   708
        test_Value(r, r == KErrCorrupt);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   709
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   710
    r=TheFs.Drive(info,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   711
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   712
    test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   713
        (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   714
    remounts = (TInt) info.iBattery;
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   715
    test.Printf(_L("Remounts = %d\n"), remounts);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   716
    test(remounts ==  KMaxMountFailures * 2);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   717
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   718
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   719
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   720
    r=TheFs.DismountFileSystem(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   721
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   722
    r=TheFs.MountFileSystem(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   723
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   724
    
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   725
    r=TheFs.RemoveFileSystem(KTestFsName2);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   726
    if(r!=KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   727
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   728
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   729
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   730
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   731
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   732
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   733
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   734
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   735
    Testing obtaining media serial number for the substituted drives
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   736
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   737
static void TestSubstDriveMediaSerialNumber()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   738
{
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   739
    test.Next(_L("Test obtaining media serial number for the substituted drives\n"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   740
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   741
    TInt  nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   742
    const TInt currDrvNum=CurrentDrive();
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   743
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   744
    TDriveInfo drvInfo;
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   745
    nRes=TheFs.Drive(drvInfo, currDrvNum);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   746
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   747
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   748
    if(drvInfo.iDriveAtt & (KDriveAttRom | KDriveAttRedirected | KDriveAttSubsted))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   749
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   750
        test.Printf(_L("Can't test on this drive!\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   751
        return;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   752
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   753
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   754
    TMediaSerialNumber serNum;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   755
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   756
    //-- test Media Serial Number on unexisting drive
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   757
    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   758
    for(TInt drvNum=EDriveA; drvNum<=EDriveZ; ++drvNum)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   759
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   760
        TDriveInfo drvInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   761
        if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   762
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   763
            // found a non-extant drive, test it...
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   764
            nRes = TheFs.GetMediaSerialNumber(serNum, drvNum);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   765
            test_Value(nRes, nRes == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   766
            break;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   767
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   768
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   769
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   770
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   771
    nRes = TheFs.GetMediaSerialNumber(serNum, currDrvNum);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   772
    if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   773
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   774
        test.Printf(_L("Test is inconsintent on this drive!\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   775
        return;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   776
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   777
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   778
    TFileName substPath;                //-- path to the directory to substitute
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   779
    const TInt KSubstDrv = EDriveO;     //-- drive to be substituted
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   780
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   781
    //-- make directory, which will be substituted ad a drive
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   782
    substPath.Format(_L("%c:\\SubstDrv1\\"), (TUint8)'A'+currDrvNum);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   783
    MakeDir(substPath);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   784
  
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   785
    nRes = TheFs.SetSubst(substPath, KSubstDrv);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   786
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   787
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   788
    //-- an attempt to obtain Media Serial Number on a substed drive shall result in KErrNotSupported
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   789
    nRes = TheFs.GetMediaSerialNumber(serNum, KSubstDrv);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   790
    test_Value(nRes, nRes == KErrNotSupported);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   791
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   792
    //-- delete substed drive
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   793
    nRes = TheFs.SetSubst(_L(""), KSubstDrv);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   794
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   795
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   796
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   797
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   798
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   799
//! @SYMTestCaseID      PBASE-t_fsys-0317
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   800
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   801
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   802
//! @SYMTestCaseDesc    This test case is testing querying file system sub type name using 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   803
//!                     RFs::QueryVolumeInfoExt() API.
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   804
//! @SYMTestActions     1   querys sub type of file system on volumes mounted with 'Fat' file system
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   805
//!                     2   querys sub type of file system on volumes mounted with 'Lffs' file system
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   806
//!                     3   querys sub type of file system on volumes mounted with 'rofs' file system
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   807
//!                     4   querys sub type of file system on volumes mounted with other file systems
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   808
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   809
//!                     1   returned error code should be KErrNone, descriptor should match 'FAT12' or 'FAT16' or 'FAT32'
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   810
//!                     2   returned error code should be KErrNotSupported, descriptor should match 'Lffs'
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   811
//!                     3   returned error code should be KErrNotSupported, descriptor should match 'rofs'
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   812
//!                     4   returned error code should be KErrNotSupported, descriptor length should not be zero
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   813
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   814
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   815
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   816
static void TestFileSystemSubTypeQuery()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   817
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   818
    test.Next(_L("Test querying sub type of the mounted file system\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   819
    TFSName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   820
    TPckgBuf<TFSName> subName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   821
    TInt i, r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   822
    TDriveInfo driveInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   823
    TPckgBuf<TBool> fDrvSyncBuf;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   824
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   825
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   826
    for(i = EDriveA; i <= EDriveZ; ++i, subName.Zero())
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   827
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   828
        r = TheFs.FileSystemName(fsName, i);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   829
        if (r == KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   830
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   831
            test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   832
            r=TheFs.Drive(driveInfo, i);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   833
            test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   834
            
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   835
            if (driveInfo.iType==EMediaNotPresent)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   836
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   837
                test.Printf(_L("The media is not present.\n"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   838
                r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   839
                test_Value(r, r == KErrNone || r == KErrNotReady);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   840
                }
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   841
            else if (driveInfo.iType==EMediaCdRom)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   842
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   843
                test.Printf(_L("CD ROM with no media will report not ready!\n"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   844
                r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   845
                test_Value(r, r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   846
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   847
            else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   848
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   849
                r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   850
                test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   851
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   852
                //-- test EIsDriveSync command
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   853
                r = TheFs.QueryVolumeInfoExt(i, EIsDriveSync, fDrvSyncBuf);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   854
                test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   855
                if(fDrvSyncBuf())
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   856
                    test.Printf(_L("The drive is Synchronous.\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   857
                else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   858
                    test.Printf(_L("The drive is Asynchronous.\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   859
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   860
                //-----------------
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   861
                
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   862
                // if Fat, testing returning sub type name
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   863
                if (fsName.CompareF(KFileSystemName_FAT)==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   864
                    {
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   865
                    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   866
                    test(subName().CompareF(KFSSubType_FAT12)==0 ||
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   867
                         subName().CompareF(KFSSubType_FAT16)==0 ||
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   868
                         subName().CompareF(KFSSubType_FAT32)==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   869
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   870
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   871
                
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   872
                // if Lffs, testing returning file system name
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   873
                if (fsName.CompareF(_L("Lffs"))==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   874
                    {
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   875
                    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   876
                    test(subName().CompareF(_L("Lffs"))==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   877
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   878
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   879
                // if rofs, testing returning file system name
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   880
                if (fsName.CompareF(_L("rofs"))==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   881
                    {
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   882
                    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   883
                    test(subName().CompareF(_L("rofs"))==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   884
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   885
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   886
                // if Composite, testing returning file system name
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   887
                if (fsName.CompareF(_L("Composite"))==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   888
                    {
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   889
                    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   890
                    test(subName().CompareF(_L("Composite"))==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   891
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   892
                    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   893
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   894
                // else
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   895
                test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   896
                test(subName().Length()!=0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   897
                
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   898
                }
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   899
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   900
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   901
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   902
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   903
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   904
//! @SYMTestCaseID      PBASE-t_fsys-0318
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   905
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   906
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   907
//! @SYMTestCaseDesc    This test case is testing querying file system's cluster size using 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   908
//!                     RFs::QueryVolumeInfoExt() API.
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   909
//! @SYMTestActions     1   querys cluster size of file system on volumes mounted with 'Fat' file system
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   910
//!                     2   querys cluster size of file system on volumes mounted with 'Lffs' file system
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   911
//!                     3   querys cluster size of file system on volumes mounted with other file systems
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   912
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   913
//!                     1   returned error code should be KErrNone, cluster size should be non-zero
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   914
//!                     2   returned error code should be KErrNone, cluster size should be 512
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   915
//!                     3   returned error code should be KErrNone, cluster size should be KErrNotSupported
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   916
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   917
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   918
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   919
static void TestFileSystemClusterSizeQuery()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   920
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
   921
    test.Next(_L("Test querying cluster size information of the mounted file system\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   922
    TFullName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   923
    TPckgBuf<TVolumeIOParamInfo> ioInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   924
    TInt i, r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   925
    TDriveInfo driveInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   926
    for(i = EDriveA; i <= EDriveZ; ++i)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   927
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   928
        r = TheFs.FileSystemName(fsName, i);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   929
        if (r == KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   930
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   931
            test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   932
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   933
            r=TheFs.Drive(driveInfo, i);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   934
            test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   935
            // if no media present
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   936
            if (driveInfo.iType==EMediaNotPresent)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   937
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   938
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   939
                test_Value(r, r == KErrNone || r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   940
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   941
            else if (driveInfo.iType==EMediaCdRom)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   942
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   943
                test.Printf(_L("CD ROM with no media!\n"));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   944
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   945
                test_Value(r, r == KErrNone || r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   946
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   947
            else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   948
                {
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   949
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   950
                test(KErrNone == r);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   951
                // if Fat
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   952
                if (fsName.CompareF(KFileSystemName_FAT)==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   953
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   954
                    test(ioInfo().iClusterSize != 0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   955
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   956
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   957
                // else if Lffs
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   958
                if (fsName.CompareF(_L("Lffs"))==0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   959
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   960
                        TBusLocalDrive drive;   
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   961
                        TBool changeFlag = EFalse;  
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   962
                        TInt locDriveNumber;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   963
                        TLocalDriveCaps DriveCaps;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   964
                        TLocalDriveCapsV7 DriveCapsV7;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   965
                        for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   966
                        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   967
                            r = drive.Connect(locDriveNumber,changeFlag);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   968
                            if(r==KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   969
                            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   970
                                
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   971
                                TPckg<TLocalDriveCaps> capsPckg(DriveCaps);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   972
                                r=drive.Caps(capsPckg);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   973
                                if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   974
                                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   975
                                    break;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   976
                                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   977
                                drive.Disconnect();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   978
                            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   979
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   980
                        TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   981
                        r=drive.Caps(capsPckg);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
   982
                        test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   983
                        drive.Disconnect();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   984
                        if(DriveCapsV7.iObjectModeSize == 0)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   985
                        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   986
                    test(ioInfo().iClusterSize == 512);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   987
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   988
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   989
                        else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   990
                        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   991
                            test((TUint32)(ioInfo().iClusterSize) == DriveCapsV7.iObjectModeSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   992
                            continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   993
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   994
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   995
                // else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   996
                //-- we can not suggest anything about unknown filesystem, thus do not check the result.
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   997
                //test(ioInfo().iClusterSize == KErrNotSupported);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   998
                
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   999
                }
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1000
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1001
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1002
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1003
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1004
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1005
//! @SYMTestCaseID      PBASE-t_fsys-0319
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1006
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1007
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1008
//! @SYMTestCaseDesc    This test case is testing querying block size of underlying media using 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1009
//!                     RFs::QueryVolumeInfoExt() API.
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1010
//! @SYMTestActions     1   querys block size on volumes mounted with MMC card type of media
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1011
//!                     2   querys block size on volumes mounted with RAM type of media
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1012
//!                     3   querys block size on volumes mounted with NOR flash type of media
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1013
//!                     4   querys block size on volumes mounted with Nand flash (code) type of media
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1014
//!                     5   querys block size on volumes mounted with Nand flash (data) type of media
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1015
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1016
//!                     1   returned error code should be KErrNone, block size should be 512
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1017
//!                     2   returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1018
//!                     3   returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1019
//!                     4   returned error code should be KErrNone, block size should be 512
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1020
//!                     5   returned error code should be KErrNone, block size should be 512
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1021
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1022
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1023
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1024
static void TestMediaBlockSizeQuery()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1025
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1026
    test.Next(_L("Test querying block size information of the underlying media\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1027
    #if defined(__WINS__)
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1028
        test.Printf(_L("This test case runs on hardware only\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1029
        return;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1030
    #else   // test runs on hardware only.
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1031
 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1032
    TFSName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1033
    TPckgBuf<TVolumeIOParamInfo> ioInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1034
    TInt i, r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1035
    TDriveInfo driveInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1036
    for(i = EDriveA; i <= EDriveZ; ++i)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1037
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1038
        r = TheFs.FileSystemName(fsName, i);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1039
        if (r == KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1040
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1041
            test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1042
            r=TheFs.Drive(driveInfo, i);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1043
            test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1044
            // if no media present
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1045
            if (driveInfo.iType==EMediaNotPresent)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1046
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1047
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1048
                test_Value(r, r == KErrNone || r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1049
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1050
            else if (driveInfo.iType==EMediaCdRom)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1051
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1052
                test.Printf(_L("CD ROM with no media will report not ready!\n"));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1053
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1054
                test_Value(r, r == KErrNotReady);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1055
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1056
            else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1057
                {
31
56f325a607ea Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1058
                r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1059
                test(KErrNone == r);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1060
                // if MMC, test block size >= 512;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1061
                // (Version 4.3 MMC cards introduce the concept of a "Super Page" which should be used as
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1062
                // guide when calculating the cluster size. For these cards the reported block size may be 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1063
                // any multiple of 512).
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1064
                if ((driveInfo.iType == EMediaHardDisk) && 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1065
                    (driveInfo.iDriveAtt & KDriveAttRemovable) &&
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1066
                    (driveInfo.iDriveAtt & KDriveAttLocal))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1067
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1068
                    test(ioInfo().iBlockSize >= 512);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1069
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1070
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1071
                // if RAM, test block size == 1;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1072
                if ((driveInfo.iType == EMediaRam) && 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1073
                    (driveInfo.iDriveAtt & KDriveAttLocal) &&
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1074
                    (driveInfo.iDriveAtt & KDriveAttInternal))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1075
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1076
                    test(ioInfo().iBlockSize == 1);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1077
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1078
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1079
                // if NOR flash, test block size == 512 (default block size);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1080
                if ((driveInfo.iType == EMediaFlash) && 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1081
                    (driveInfo.iDriveAtt & KDriveAttLocal) &&
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1082
                    (driveInfo.iDriveAtt & KDriveAttInternal))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1083
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1084
                    TBusLocalDrive drive;   
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1085
                    TBool changeFlag = EFalse;  
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1086
                    TInt locDriveNumber;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1087
                    TLocalDriveCaps DriveCaps;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1088
                    TLocalDriveCapsV7 DriveCapsV7;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1089
                    for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1090
                        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1091
                        r = drive.Connect(locDriveNumber,changeFlag);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1092
                        if(r==KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1093
                            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1094
                            TPckg<TLocalDriveCaps> capsPckg(DriveCaps);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1095
                            r=drive.Caps(capsPckg);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1096
                            if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1097
                                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1098
                                break;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1099
                                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1100
                            drive.Disconnect();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1101
                            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1102
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1103
                    TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1104
                    r=drive.Caps(capsPckg);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1105
                    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1106
                    if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1107
                        {                   
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1108
                        test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1109
                        continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1110
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1111
                    else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1112
                        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1113
                        test(ioInfo().iBlockSize == (TInt) KDefaultVolumeBlockSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1114
                        continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1115
                        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1116
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1117
                // if Nand flash (with Fat file system), test block size == 512 (small-block) or 2048 (large-block)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1118
                if ((driveInfo.iType == EMediaNANDFlash) &&
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1119
                    (driveInfo.iDriveAtt & KDriveAttLocal) &&
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1120
                    (driveInfo.iDriveAtt & KDriveAttInternal))
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1121
                    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1122
                    test(ioInfo().iBlockSize == 512 || ioInfo().iBlockSize == 2048);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1123
                    continue;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1124
                    }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1125
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1126
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1127
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1128
    #endif // __WINS__
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1129
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1130
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1131
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1132
//! @SYMTestCaseID      PBASE-t_fsys-0320
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1133
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1134
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1135
//! @SYMTestCaseDesc    This test case is testing wrapper API RFs::FileSystemSubType() has the same
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1136
//!                     behaviours as RFs::QueryVolumeInfoExt()
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1137
//! @SYMTestActions     1   querys file system sub type name by both APIs
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1138
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1139
//!                     1   returned error codes and descriptors of both API should be identical
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1140
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1141
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1142
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1143
static void TestFileSystemSubType()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1144
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1145
    test.Next(_L("Test wrapper API RFs::FileSystemSubType()'s behaviour\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1146
    TFSName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1147
    TPckgBuf<TFSName> subName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1148
    TInt r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1149
    TFSName subName1;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1150
    TInt r1;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1151
    
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1152
    for(TInt i = EDriveA; i <= EDriveZ; ++i)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1153
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1154
        r = TheFs.FileSystemName(fsName, i);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1155
        if (r == KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1156
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1157
            test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1158
            r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1159
            r1 = TheFs.FileSystemSubType(i, subName1);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1160
            test_Value(r, r == r1);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1161
            if (subName().Length())
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1162
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1163
                test(subName().CompareF(subName1)==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1164
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1165
            else
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1166
                {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1167
                test(subName1.Length()==0);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1168
                }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1169
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1170
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1171
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1172
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1173
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1174
//! @SYMTestCaseID      PBASE-t_fsys-0321
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1175
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1176
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1177
//! @SYMTestCaseDesc    This test case is testing wrapper API RFs::VolumeIOParam() has the same
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1178
//!                     behaviours as RFs::QueryVolumeInfoExt()
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1179
//! @SYMTestActions     1   querys volume IO params by both APIs
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1180
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1181
//!                     1   returned error codes and IO param values of both API should be identical
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1182
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1183
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1184
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1185
static void TestVolumeIOParam()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1186
    {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1187
    test.Next(_L("Test wrapper API RFs::VolumeIOParam()'s behaviour\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1188
    TFSName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1189
    TPckgBuf<TVolumeIOParamInfo> ioInfo;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1190
    TInt r;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1191
    TVolumeIOParamInfo ioInfo1;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1192
    TInt r1;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1193
    
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1194
    for(TInt i = EDriveA; i <= EDriveZ; ++i)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1195
        {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1196
        r = TheFs.FileSystemName(fsName, i);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1197
        if (r == KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1198
            {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1199
            test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1200
            r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1201
            r1 = TheFs.VolumeIOParam(i, ioInfo1);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1202
            test_Value(r, r == r1);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1203
            test(ioInfo().iBlockSize == ioInfo1.iBlockSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1204
            test(ioInfo().iClusterSize == ioInfo1.iClusterSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1205
            test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1206
            test(ioInfo().iRecWriteBufSize == ioInfo1.iRecWriteBufSize);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1207
            }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1208
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1209
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1210
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1211
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1212
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1213
//! @SYMTestCaseID      PBASE-t_fsys-0322
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1214
//! @SYMTestType        CIT
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1215
//! @SYMPREQ            CR0882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1216
//! @SYMTestCaseDesc    This test case is testing RFs::QueryVolumeInfoExt() API on a testing file system
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1217
//! @SYMTestActions     0   mounts testing file system on a certain drive
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1218
//!                     1   querys file system's sub type name on the drive under testing
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1219
//!                     2   querys file system's cluster size on the drive under testing
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1220
//! @SYMTestExpectedResults 
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1221
//!                     1   returned error code should be KErrNone, sub type name should match 'Test3SubType'
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1222
//!                     2   returned error code should be KErrNone, cluster size should equal 1024
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1223
//! @SYMTestPriority        High
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1224
//! @SYMTestStatus          Implemented
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1225
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1226
static void TestQueryVolumeInfoExtOnTestFS(TInt aDrive)
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1227
    {
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1228
    if (aDrive==EDriveC) // Can't test on C:
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1229
        return;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1230
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1231
    TInt r;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1232
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1233
    test.Printf(_L("Tested on drive: %c.\n"), (char)(aDrive+'A'));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1234
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1235
    // Mount a new CTestFileSystem on the drive under test
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1236
    test.Next(_L("Test RFs::QueryVolumeInfoExt() on Testing File System\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1237
    r = TheFs.AddFileSystem(KTestFsy3);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1238
    if (r != KErrNone && r != KErrAlreadyExists)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1239
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1240
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1241
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1242
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1243
    TFSName oldFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1244
    r = TheFs.FileSystemName(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1245
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1246
    r = TheFs.DismountFileSystem(oldFs,aDrive);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1247
    if (r != KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1248
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1249
        test.Printf(_L("Error = %d\n"),r);    
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1250
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1251
        }
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1252
    r = TheFs.MountFileSystem(KTestFsName3, aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1253
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1254
    TFSName newFs;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1255
    r = TheFs.FileSystemName(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1256
    test_KErrNone(r);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1257
    test(newFs.Compare(KTestFsName3)==0);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1258
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1259
    // Sub type name query: 
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1260
    TPckgBuf<TFSName> subNameP;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1261
    r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1262
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1263
    test(subNameP() == _L("Test3SubType"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1264
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1265
    // Cluster size querys:
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1266
    TPckgBuf<TVolumeIOParamInfo> ioInfoP;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1267
    r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1268
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1269
    test(ioInfoP().iClusterSize==1024);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1270
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1271
    // Mount the original file system back
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1272
    r=TheFs.DismountFileSystem(newFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1273
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1274
    r=TheFs.MountFileSystem(oldFs,aDrive);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1275
    test_KErrNone(r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1276
    
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1277
    r=TheFs.RemoveFileSystem(KTestFsName3);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1278
    if(r!=KErrNone)
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1279
        {
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1280
        test.Printf(_L("error=%d\n"),r);
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1281
        test(EFalse);
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1282
        }
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1283
    }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1284
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1285
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1286
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1287
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1288
    Test remounting the file system with objects opened.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1289
    scenario:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1290
    1. create a file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1291
    2. open it.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1292
    3. forcedly remount the file system 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1293
    4. read this file (this will imply remounting the filesystem)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1294
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1295
static void TestRemountFSWithOpenedObjects()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1296
{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1297
    test.Next(_L("Testing forcedly remounting FS with objects opened.\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1298
    
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1299
    //-- don't perform this test on a non-removable drive, generating media change on such drive
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1300
    //-- doesn't always work
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1301
    TInt nRes;
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1302
    const TInt drvNumber = CurrentDrive();
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1303
    TDriveInfo driveInfo;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1304
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1305
    nRes = TheFs.Drive(driveInfo, drvNumber);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1306
    test_KErrNone(nRes);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1307
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1308
    if(! (driveInfo.iDriveAtt & KDriveAttRemovable))
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1309
    {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1310
        test.Printf(_L("Can't perform this test on a non-removable drive. Skippping!\n"));
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1311
        return;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1312
    }
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1313
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1314
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1315
    //-- 1. create a file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1316
    _LIT(KFile, "\\test_file.file");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1317
    const TUint KFileSz = 5000;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1318
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1319
    nRes = CreateCheckableStuffedFile(TheFs, KFile, KFileSz);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1320
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1321
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1322
    RFile file;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1323
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1324
    //-- 2. open this file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1325
    nRes = file.Open(TheFs, KFile, EFileRead);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1326
    test_KErrNone(nRes);
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1327
    
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1328
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1329
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1330
    //-- 2.1 try to dismount the FS, it must fail because of the opened object.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1331
    TBuf<40> fsName;
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1332
    nRes = TheFs.FileSystemName(fsName, drvNumber);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1333
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1334
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1335
    nRes = TheFs.DismountFileSystem(fsName, drvNumber);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1336
    test_Value(nRes, nRes == KErrInUse);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1337
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1338
    // Flag from locmedia.h to simulate ejecting and re-inserting the media.
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1339
    const TUint KMediaRemountForceMediaChange = 0x00000001;
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1340
    TRequestStatus changeStatus;
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1341
    TheFs.NotifyChange(ENotifyAll, changeStatus);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1342
    
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1343
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1344
    //-- 3. forcedly remount the drive
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1345
    nRes = TheFs.RemountDrive(drvNumber, NULL, KMediaRemountForceMediaChange);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1346
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1347
    if(nRes == KErrNotSupported)
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1348
    	{//-- this feature is not supported and the test is inconsistent.
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1349
        test.Printf(_L("RemountDrive() is not supported, the test is inconsistent!\n"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1350
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1351
        //-- remounting must work at least on MMC drives
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1352
        const TBool isFAT = Is_Fat(TheFs, drvNumber);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1353
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1354
        nRes = TheFs.Drive(driveInfo, drvNumber);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1355
        test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1356
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1357
        test_Value(driveInfo.iDriveAtt, !isFAT || (!(driveInfo.iDriveAtt & KDriveAttRemovable)));
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1358
    	}
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1359
    else
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1360
    	{
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1361
		test_Value(nRes, nRes == KErrNotReady || nRes == KErrNone);
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1362
		test.Printf(_L("Waiting for the simulated media change...\n"));
122
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1363
		
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1364
		//-- 3.1 wait for media change to complete
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1365
		do
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1366
			{
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1367
			// Waiting for media change...
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1368
			User::WaitForRequest(changeStatus);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1369
			nRes = TheFs.Drive(driveInfo, drvNumber);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1370
			TheFs.NotifyChange(ENotifyAll, changeStatus);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1371
			}
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1372
		while (nRes == KErrNotReady);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1373
		
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1374
		test_KErrNone(nRes);
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1375
		User::After(1000*K1mSec);	// Wait 1 sec (needed by certain platforms)
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1376
    	}
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1377
    
70ba09fd07a5 201015_09
hgs
parents: 33
diff changeset
  1378
    TheFs.NotifyChangeCancel(changeStatus);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1379
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1380
    //-- 4. read this file. The FS will be remounted and the read must be OK.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1381
    TBuf8<40> buf;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1382
    nRes = file.Read(0, buf, 30);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1383
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1384
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1385
    file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1386
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1387
    //-- 5. verify the file, just in case.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1388
    nRes = VerifyCheckableFile(TheFs, KFile);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1389
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1390
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1391
    //-- 6. delete the file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1392
    TheFs.Delete(KFile);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1393
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1394
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1395
//----------------------------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1396
static void TestFileSystem_MaxSupportedFileSizeQuery()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1397
{
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1398
    test.Next(_L("Test querying max. supported file size on this file system\n"));
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1399
    TFullName fsName;
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1400
    TPckgBuf<TVolumeIOParamInfo> ioInfo;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1401
    TVolumeIOParamInfo& volInfo = ioInfo();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1402
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1403
    const TInt drvNo=CurrentDrive();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1404
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1405
    TInt nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1406
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1407
    nRes = TheFs.FileSystemName(fsName, drvNo);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1408
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1409
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1410
    nRes = TheFs.QueryVolumeInfoExt(drvNo, EIOParamInfo, ioInfo);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1411
    test_KErrNone(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1412
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1413
    test.Printf(_L("FS:'%S' Max File Size:0x%LX\n"), &fsName, volInfo.iMaxSupportedFileSize);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1414
    if(volInfo.iMaxSupportedFileSize == KMaxTUint64)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1415
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1416
        test.Printf(_L("Max File Size query isn't supported by this FS\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1417
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1418
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1419
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1420
    //-- check the value for FAT FS only. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1421
    if(Is_Fat(TheFs, drvNo))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1422
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1423
        test(volInfo.iMaxSupportedFileSize == KMaxSupportedFatFileSize);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1424
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1425
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1426
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1427
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1428
//----------------------------------------------------------------------------------------------
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1429
void CallTestsL()
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1430
    {
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1431
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1432
    //-- set up console output 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1433
    Fat_Test_Utils::SetConsole(test.Console()); 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1434
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1435
    const TInt drive=CurrentDrive();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1436
    PrintDrvInfo(TheFs, drive);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1437
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1438
    //Do not run this test on the NAND drive, as this has the FTL mounted as a primary extension
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1439
    //which causes the test to fail
269
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1440
    
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1441
    TFSName pExtName;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1442
    pExtName.Zero();
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1443
   
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1444
    TInt nRes = TheFs.ExtensionName(pExtName, drive, 0);
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1445
   
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1446
    if(nRes == KErrNone && pExtName.Length())
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1447
        {
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1448
        test.Printf(_L("This test can't be run on a drive that has a primary extension:%S\n"), &pExtName);   
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1449
        return;
d57b86b1867a 201035_03
hgs
parents: 254
diff changeset
  1450
        }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1451
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1452
    //---------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1453
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1454
    InitGlobals();
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1455
    
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1456
    //---------------------------------------
271
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
  1457
dc268b18d709 201037_07
hgs
parents: 269
diff changeset
  1458
    TestFsMountHelper();
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1459
    TestFileSystemNames();
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1460
    TestFileSystemNameLength();
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1461
    TestDismountFileSystem(CurrentDrive());
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1462
    TestFileSystem(CurrentDrive());
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1463
    TestMountInvalidDrive();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1464
    TestMountingBrokenMedia(CurrentDrive());
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1465
    TestSubstDriveMediaSerialNumber();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1466
33
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1467
    TestFileSystemSubTypeQuery();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1468
    TestFileSystemClusterSizeQuery();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1469
    TestMediaBlockSizeQuery();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1470
    TestFileSystemSubType();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1471
    TestVolumeIOParam();
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1472
    TestQueryVolumeInfoExtOnTestFS(CurrentDrive());
0173bcd7697c Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
  1473
    TestFileSystem_MaxSupportedFileSizeQuery();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1474
    TestRemountFSWithOpenedObjects();
254
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1475
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1476
    //---------------------------------------
1560c419b176 201033_10
hgs
parents: 122
diff changeset
  1477
    DestroyGlobals();    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1478
    }