kerneltest/f32test/server/t_misc.cpp
author hgs
Fri, 09 Jul 2010 13:13:20 +0100
changeset 199 189ece41fa29
parent 123 fc55edbf3919
permissions -rw-r--r--
201027_05
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_misc.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
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    18
#define __E32TEST_EXTENSION__
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    19
#include <f32file.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    20
#include <e32test.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    21
#include "t_server.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    22
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    23
#include "f32_test_utils.h"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    24
using namespace F32_Test_Utils;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    25
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    26
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    27
// If there is an NFE media driver present, then because of the way EDeleteNotify requests work,
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    28
// the data retrieved from a deleted file will not be a buffer full of zero's, but instead a buffer
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    29
// full of decrypted zero's
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    30
#define __NFE_MEDIA_DRIVER_PRESENT__
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    31
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    32
#ifdef __VC32__
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    33
    // Solve compilation problem caused by non-English locale
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    34
    #pragma setlocale("english")
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    35
#endif
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    36
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    37
RTest test(_L("T_MISC"));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    38
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    39
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    40
TInt gDriveNum = -1;
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    41
const TUint KBufLength = 0x100;
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    42
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    43
static void Test1()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    44
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    45
// Open, write to and read from a file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    46
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    47
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    48
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    49
	test.Next(_L("Open, write to and read from a file"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    50
	TInt r=TheFs.SetSessionPath(gSessionPath);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    51
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    52
	RFile file;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    53
	r=file.Create(TheFs,_L("Hello.Wld"),EFileWrite);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    54
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    55
	r=file.Write(_L8("Hello World"),11);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    56
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    57
	file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    58
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    59
	r=file.Open(TheFs,_L("Hello.Wld"),EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    60
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    61
	TBuf8<256> buf;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    62
	r=file.Read(buf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    63
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    64
	test(buf==_L8("Hello World"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    65
	file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    66
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    67
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    68
static void Test2()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    69
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    70
// Open and read from a file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    71
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    72
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    73
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    74
	test.Next(_L("Open and read from a file"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    75
	TInt r=TheFs.SetSessionPath(gSessionPath);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    76
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    77
	RFile file;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    78
	r=file.Open(TheFs,_L("Hello.Wld"),EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    79
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    80
	TBuf8<256> buf;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    81
	r=file.Read(buf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    82
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    83
	test(buf==_L8("Hello World"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    84
	file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    85
	r=TheFs.Delete(_L("HELLO.WLD"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    86
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    87
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    88
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
    89
static void Test3()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    90
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    91
// Create nested directories
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    92
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    93
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    94
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    95
	test.Next(_L("Create nested directories"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    96
	TInt r=TheFs.SetSessionPath(gSessionPath);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
    97
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    98
	TheFs.ResourceCountMarkStart();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    99
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   100
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\A.B"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   101
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   102
	r=TheFs.MkDir(_L("\\F32-TST\\RIGHT\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   103
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   104
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   105
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\ONE\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   106
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   107
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\TWO\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   108
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   109
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\THREE\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   110
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   111
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\TWO\\BOTTOM\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   112
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   113
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   114
	r=TheFs.MkDirAll(_L("\\F32-TST\\RIGHT\\TOP\\MID\\BOT\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   115
	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   116
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   117
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   118
static void Test4()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   119
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   120
// Test returned error values
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   121
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   122
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   123
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   124
	test.Next(_L("Test returned error values"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   125
	TInt r=TheFs.SetSessionPath(gSessionPath);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   126
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   127
	TheFs.ResourceCountMarkStart();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   128
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   129
	r=TheFs.MkDir(_L("\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   130
	test_Value(r, r == KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   131
	r=TheFs.MkDir(_L("\\LEFT"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   132
	test_Value(r, r == KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   133
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   134
	test_Value(r, r == KErrAlreadyExists);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   135
	r=TheFs.MkDir(_L("\\F32-TST\\LEFT\\..\\NEWDIR\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   136
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   137
	r=TheFs.MkDir(_L("\\F32-TST\\NEWDIR\\SUBDIR\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   138
	test_Value(r, r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   139
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   140
	r=TheFs.RmDir(_L("\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   141
	test_Value(r, r == KErrInUse);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   142
	r=TheFs.RmDir(_L("\\PROG"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   143
	test_Value(r, r == KErrInUse);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   144
	r=TheFs.RmDir(_L("\\F32-TST\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   145
	test_Value(r, r == KErrInUse);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   146
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   147
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   148
	RDir dir;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   149
	r=dir.Open(TheFs,_L("V:\\asdf"),KEntryAttNormal);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   150
	test_Value(r, r == KErrNone || r==KErrNotReady || r==KErrNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   151
	if (r==KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   152
		dir.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   153
	r=dir.Open(TheFs,_L("L:\\asdf"),KEntryAttNormal);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   154
	test_Value(r, r == KErrNone || r==KErrNotReady || r==KErrNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   155
	dir.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   156
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   157
	TEntry entry;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   158
	r=TheFs.Entry(_L("z:\\NOTEXiSTS\\file.txt"),entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   159
	test_Value(r, r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   160
	r=TheFs.Entry(_L("z:\\NOTEXiSTS\\"),entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   161
	test_Value(r, r == KErrNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   162
	r=TheFs.Entry(_L("z:\\SYSTEM\\"),entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   163
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   164
	r=TheFs.Entry(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("z:\\SYS\\BIN\\ESHELL.EXE"):_L("z:\\SYSTEM\\BIN\\ESHELL.EXE"),entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   165
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   166
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   167
	r=dir.Open(TheFs,_L("\\*"),NULL);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   168
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   169
	TEntry dirEntry;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   170
	r=dir.Read(dirEntry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   171
	test_Value(r, r == KErrNone || r==KErrEof);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   172
	if (r==KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   173
		test.Printf(_L("%S\n"),&dirEntry.iName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   174
	dir.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   175
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   176
	r=dir.Open(TheFs,_L("A:\\*"),NULL);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   177
	test_Value(r, r == KErrNotReady || r==KErrNone);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   178
	dir.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   179
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   180
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   181
static void Test5()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   182
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   183
// Read files directly from the rom
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   184
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   185
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   186
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   187
	test.Next(_L("Read Files directly from the rom"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   188
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   189
	TInt pos=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   190
	TInt r;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   191
	_LIT(KTFileCpp, "Z:\\test\\T_FILE.CPP");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   192
	_LIT(KTFsrvCpp, "Z:\\test\\T_FSRV.CPP");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   193
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   194
	if ( TheFs.IsFileInRom(KTFileCpp) != NULL && TheFs.IsFileInRom(KTFsrvCpp) != NULL )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   195
		{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   196
		RFile f;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   197
		r=f.Open(TheFs,KTFileCpp,EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   198
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   199
		r=f.Seek(ESeekAddress,pos);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   200
		TText8* ptrPos=*(TText8**)&pos;
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   201
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   202
		TBuf8<1024> readBuf;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   203
		r=f.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   204
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   205
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   206
		TPtrC8 memBuf(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   207
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   208
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   209
		ptrPos+=9913;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   210
		pos=9913;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   211
		r=f.Seek(ESeekStart,pos);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   212
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   213
		readBuf.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   214
		r=f.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   215
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   216
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   217
		memBuf.Set(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   218
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   219
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   220
		RFile f2;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   221
		pos=10;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   222
		r=f2.Open(TheFs,KTFsrvCpp,EFileRead);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   223
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   224
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   225
		r=f2.Seek(ESeekAddress,pos);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   226
		ptrPos=*(TText8**)&pos;
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   227
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   228
		readBuf.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   229
		pos=10;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   230
		r=f2.Seek(ESeekStart,pos);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   231
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   232
		r=f2.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   233
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   234
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   235
		memBuf.Set(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   236
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   237
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   238
		ptrPos+=2445;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   239
		pos=10+2445;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   240
		r=f2.Seek(ESeekStart,pos);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   241
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   242
		readBuf.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   243
		r=f2.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   244
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   245
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   246
		memBuf.Set(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   247
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   248
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   249
		pos=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   250
		r=f.Seek(ESeekAddress,pos);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   251
		ptrPos=*(TText8**)&pos;
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   252
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   253
		readBuf.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   254
		pos=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   255
		r=f.Seek(ESeekStart,pos);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   256
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   257
		r=f.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   258
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   259
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   260
		memBuf.Set(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   261
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   262
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   263
		ptrPos+=5245;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   264
		pos=5245;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   265
		r=f.Seek(ESeekStart,pos);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   266
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   267
		readBuf.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   268
		r=f.Read(readBuf);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   269
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   270
		test(readBuf.Length()==readBuf.MaxLength());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   271
		memBuf.Set(ptrPos,readBuf.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   272
		test(memBuf==readBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   273
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   274
		f.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   275
		f2.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   276
		}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   277
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   278
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   279
static void Test6()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   280
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   281
// Test rom return values
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   282
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   283
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   284
	test.Next(_L("Test rom return values"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   285
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   286
	RFile f;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   287
	TInt r=f.Replace(TheFs,_L("Z:\\Test\\T_Fsrv.Cpp"),EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   288
	test_Value(r, r == KErrAccessDenied);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   289
	r=f.Create(TheFs,_L("Z:\\Test\\newT_Fsrv.Cpp"),EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   290
	test_Value(r, r == KErrAccessDenied);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   291
	r=f.Open(TheFs,_L("Z:\\Test\\T_Fsrv.Cpp"),EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   292
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   293
	f.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   294
	r=f.Open(TheFs,_L("Z:\\Test\\T_Fsrv.Cpp"),EFileRead|EFileWrite);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   295
	test_Value(r, r == KErrAccessDenied);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   296
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   297
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   298
static void Test7()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   299
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   300
// Test cache
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   301
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   302
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   303
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   304
	test.Next(_L("Test cache updated when writing to a file"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   305
	TUidType uid1(TUid::Uid(1),TUid::Uid(2),TUid::Uid(3));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   306
	TBuf8<32> contents1=_L8("asdf asdf asdf");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   307
	TBuf<32> file1=_L("\\TMISC\\CACHE.FILE");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   308
	MakeFile(file1,uid1,contents1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   309
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   310
	TEntry entry;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   311
	TInt r=TheFs.Entry(file1,entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   312
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   313
	test(entry.iType==uid1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   314
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   315
	TUidType uid2(TUid::Uid(4),TUid::Uid(5),TUid::Uid(6));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   316
	TCheckedUid checkedUid(uid2);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   317
	TPtrC8 uidData((TUint8*)&checkedUid,sizeof(TCheckedUid));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   318
	RFile f;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   319
	r=f.Open(TheFs,file1,EFileRead|EFileWrite);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   320
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   321
	r=f.Write(uidData);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   322
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   323
	r = f.Flush();
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   324
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   325
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   326
	r=TheFs.Entry(file1,entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   327
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   328
	test(entry.iType==uid2);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   329
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   330
	f.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   331
	r=TheFs.Entry(file1,entry);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   332
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   333
	test(entry.iType==uid2);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   334
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   335
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   336
static void Test8()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   337
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   338
// Test IsValidName
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   339
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   340
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   341
	test.Next(_L("Test RFs::IsValidName(TDesC)"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   342
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   343
	// tests calling IsValidName() with invalid name as first call to session
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   344
	// see defect EXT-57KH9K
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   345
	_LIT(KInvalidName, "test\\i1.jpg");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   346
	RFs fs;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   347
	test(KErrNone==fs.Connect());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   348
	test(fs.IsValidName(KInvalidName)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   349
	fs.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   350
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   351
	test(TheFs.IsValidName(_L("*"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   352
	test(TheFs.IsValidName(_L("?"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   353
	test(TheFs.IsValidName(_L(">"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   354
	test(TheFs.IsValidName(_L("<"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   355
	test(TheFs.IsValidName(_L(":"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   356
	test(TheFs.IsValidName(_L("\""))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   357
	test(TheFs.IsValidName(_L("/"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   358
	test(TheFs.IsValidName(_L("|"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   359
	test(TheFs.IsValidName(_L("\\"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   360
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   361
	test(TheFs.IsValidName(_L("xx*yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   362
	test(TheFs.IsValidName(_L("xx?yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   363
	test(TheFs.IsValidName(_L("xx>yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   364
	test(TheFs.IsValidName(_L("xx<yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   365
	test(TheFs.IsValidName(_L("xx:yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   366
	test(TheFs.IsValidName(_L("xx\"yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   367
	test(TheFs.IsValidName(_L("xx/yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   368
	test(TheFs.IsValidName(_L("xx|yy"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   369
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   370
	test(TheFs.IsValidName(_L("C:\\*\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   371
	test(TheFs.IsValidName(_L("C:\\?\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   372
	test(TheFs.IsValidName(_L("C:\\>\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   373
	test(TheFs.IsValidName(_L("C:\\<\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   374
	test(TheFs.IsValidName(_L("C:\\:\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   375
	test(TheFs.IsValidName(_L("C:\\\"\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   376
	test(TheFs.IsValidName(_L("C:\\/\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   377
	test(TheFs.IsValidName(_L("C:\\|\\group\\release.txt"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   378
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   379
	test(TheFs.IsValidName(_L(""))==EFalse); // must be a name or extension present
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   380
	test(TheFs.IsValidName(_L(".ext")));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   381
	test(TheFs.IsValidName(_L("C:\\asdf.blarg\\"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   382
	test(TheFs.IsValidName(_L("\\"))==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   383
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   384
	test(TheFs.IsValidName(_L("as(){}@~#;!\xA3$%^&()df.blarg")));	//	Valid names
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   385
	test(TheFs.IsValidName(_L("C:\\asdf.blarg\\asdf.blarg")));	//	Valid names
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   386
	test(TheFs.IsValidName(_L("\'")));							//	Valid names
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   387
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   388
	test.Next(_L("Test RFs::IsValidName(TDesC, TDes) overload"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   389
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   390
	TText testChar;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   391
	test(TheFs.IsValidName(_L("*"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   392
	test(testChar=='*');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   393
	test(TheFs.IsValidName(_L("?"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   394
	test(testChar=='?');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   395
	test(TheFs.IsValidName(_L(">"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   396
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   397
	test(TheFs.IsValidName(_L("<"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   398
	test(testChar=='<');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   399
	test(TheFs.IsValidName(_L(":"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   400
	test(testChar==':');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   401
	test(TheFs.IsValidName(_L("\""),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   402
	test(testChar=='\"');	//	Tests that " is illegal
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   403
	test(TheFs.IsValidName(_L("/"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   404
	test(testChar=='/');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   405
	test(TheFs.IsValidName(_L("|"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   406
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   407
	test(TheFs.IsValidName(_L("\\"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   408
	test(testChar==' ');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   409
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   410
	test(TheFs.IsValidName(_L("xx*yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   411
 	test(testChar=='*');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   412
	test(TheFs.IsValidName(_L("xx?yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   413
	test(testChar=='?');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   414
	test(TheFs.IsValidName(_L("xx>yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   415
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   416
	test(TheFs.IsValidName(_L("xx<yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   417
	test(testChar=='<');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   418
	test(TheFs.IsValidName(_L("xx:yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   419
	test(testChar==':');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   420
	test(TheFs.IsValidName(_L("xx\"yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   421
	test(testChar=='\"');	//	Tests that " is illegal
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   422
	test(TheFs.IsValidName(_L("xx/yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   423
	test(testChar=='/');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   424
	test(TheFs.IsValidName(_L("xx|yy"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   425
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   426
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   427
	test(TheFs.IsValidName(_L("C:\\*\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   428
	test(testChar=='*');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   429
	test(TheFs.IsValidName(_L("C:\\?\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   430
	test(testChar=='?');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   431
	test(TheFs.IsValidName(_L("C:\\..\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   432
	test(testChar=='.');	//	Only one "." returned however many are in filename
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   433
	test(TheFs.IsValidName(_L("C:\\.\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   434
	test(testChar=='.');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   435
	test(TheFs.IsValidName(_L("C:\\>\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   436
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   437
	test(TheFs.IsValidName(_L("C:\\<\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   438
	test(testChar=='<');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   439
	test(TheFs.IsValidName(_L("C:\\HelloWorld\\:\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   440
	test(testChar==':');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   441
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   442
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   443
	test(TheFs.IsValidName(_L("C::\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   444
	test(testChar==':');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   445
	test(TheFs.IsValidName(_L(">\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   446
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   447
	test(TheFs.IsValidName(_L("C|group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   448
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   449
	test(TheFs.IsValidName(_L("C\\|\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   450
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   451
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   452
	test(TheFs.IsValidName(_L("\\>"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   453
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   454
	test(TheFs.IsValidName(_L("C:\\|group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   455
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   456
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   457
	test(TheFs.IsValidName(_L("C:\\\"\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   458
	test(testChar=='\"');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   459
	test(TheFs.IsValidName(_L("C:\\/\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   460
	test(testChar=='/');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   461
	test(TheFs.IsValidName(_L("C:\\|\\group\\release.txt"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   462
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   463
	test(TheFs.IsValidName(_L("C:\\ \\group\\release.txt"),testChar)==EFalse); // must be a name or extension present
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   464
	test(testChar==' ');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   465
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   466
//	Test that \ is not allowed in filenames
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   467
	TFileName filename;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   468
	filename=_L("C:\\HelloWorld\\\\\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   469
	TPtr pChar(&testChar,sizeof(TText),sizeof(TText));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   470
	test(TheFs.IsValidName(filename,testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   471
	test(pChar.Find(_L("\\"))!=KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   472
	filename=_L("C:\\\\\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   473
	test(TheFs.IsValidName(filename,testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   474
	test(pChar.Find(_L("\\"))!=KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   475
	filename=_L("C:\\Hello World\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   476
	filename[8]=KPathDelimiter;	//	Makes C:\\Hello World\\group\\release.txt
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   477
	test(TheFs.IsValidName(filename,testChar));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   478
	filename=_L("C:\\HelloWorld\\::\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   479
	test(TheFs.IsValidName(filename,testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   480
	test(pChar.Find(_L(":"))!=KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   481
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   482
	filename=_L("C:\\>>\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   483
	test(TheFs.IsValidName(filename,testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   484
	test(pChar.Find(_L(">"))!=KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   485
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   486
	test(TheFs.IsValidName(_L(""),testChar)==EFalse); // Must be a name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   487
	test(testChar==' ');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   488
	test(TheFs.IsValidName(_L(".ext"),testChar));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   489
	test(TheFs.IsValidName(_L("C:\\asdf.blarg\\"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   490
	test(testChar==' ');	//	Must be a name else testChar is set to blank
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   491
	test(TheFs.IsValidName(_L("C:\\asdf.blarg"),testChar));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   492
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   493
	test(TheFs.IsValidName(_L("C:\\asdf..blarg\\"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   494
	test(testChar==' ');	//	Must be a name else testChar is set to blank
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   495
	test(TheFs.IsValidName(_L("C:\\asdf..blarg"),testChar));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   496
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   497
	test(TheFs.IsValidName(_L("\\"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   498
	test(testChar==' ');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   499
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   500
//	Test multiple evil characters - parsing occurs from right to left
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   501
//	except that wildcarded characters take priority and are picked out first
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   502
	test(TheFs.IsValidName(_L("abc>def|ghi?jkl:mno<pqr*stu"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   503
	test(testChar=='*');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   504
	test(TheFs.IsValidName(_L("abc>def|ghi<jkl:mno?pqr"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   505
	test(testChar=='?');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   506
	test(TheFs.IsValidName(_L("abc>def|ghi<jkl:mno"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   507
	test(testChar==':');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   508
	test(TheFs.IsValidName(_L("abc>def|ghi<jkl"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   509
	test(testChar=='<');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   510
	test(TheFs.IsValidName(_L("abc>def|ghi"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   511
	test(testChar=='|');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   512
	test(TheFs.IsValidName(_L("abc>def"),testChar)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   513
	test(testChar=='>');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   514
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   515
	test(!TheFs.IsValidName(_L("C:\\v123456.."),testChar));				//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   516
	test(TheFs.IsValidName(_L("abc"),testChar));						//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   517
	test(TheFs.IsValidName(_L("as(){}@~#;!\xA3$%^&()df.blarg"),testChar));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   518
	test(TheFs.IsValidName(_L("C:\\asdf.blarg\\asdf.blarg"),testChar));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   519
	test(TheFs.IsValidName(_L("\'"),testChar));							//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   520
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   521
	//PDEF133084: The wild character in the extension was not being detected.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   522
	_LIT( KTestString, "E:\\My Videos\\Downloads\\1\\1\\Name.3gp?" );
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   523
    TBuf<50> path;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   524
    path = KTestString;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   525
    TBool validName( EFalse );
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   526
    TText badChar;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   527
    TInt badCharLoc( KErrNotFound );
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   528
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   529
    while ( ! validName )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   530
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   531
        validName = TheFs.IsValidName( path, badChar );
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   532
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   533
        if ( ! validName )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   534
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   535
            badCharLoc = path.LocateReverse( badChar );
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   536
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   537
            if ( KErrNotFound != badCharLoc )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   538
                {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   539
                path[badCharLoc] = '_';
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   540
                }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   541
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   542
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   543
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   544
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   545
static void Test9()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   546
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   547
// Test IsFileInRom
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   548
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   549
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   550
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   551
	test.Next(_L("Test RFs::IsFileInRom"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   552
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   553
	CFileMan* fMan=CFileMan::NewL(TheFs);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   554
	TInt r=fMan->Copy(_L("Z:\\TEST\\T_FILE.CPP"),_L("C:\\T_FILE.CPP"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   555
	test_Value(r, r == KErrNone || r==KErrAccessDenied);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   556
	delete fMan;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   557
	TUint8* addr=TheFs.IsFileInRom(_L("C:\\ESHELL.EXE"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   558
	test(addr==NULL);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   559
	addr=TheFs.IsFileInRom(_L("Z:\\TEST\\T_FILE.CPP"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   560
	if (addr!=NULL)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   561
		{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   562
		test(addr!=NULL);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   563
		TPtrC8 startOfFile(addr,12);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   564
		test(startOfFile==_L8("// Copyright"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   565
		}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   566
	else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   567
		{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   568
		test (addr==NULL);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   569
		}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   570
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   571
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   572
static void Test10()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   573
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   574
// Test drive names
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   575
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   576
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   577
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   578
	test.Next(_L("Test Drive Names"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   579
	TFileName driveName;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   580
	TInt i;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   581
	for(i=0;i<KMaxDrives;i++)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   582
		{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   583
		TInt r=TheFs.GetDriveName(i,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   584
		test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   585
		if (driveName.Length())
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   586
			test.Printf(_L("Default name of %c: == %S\n"),'A'+i,&driveName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   587
		}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   588
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   589
	TBuf<64> drive0=_L("Dilbert");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   590
	TBuf<64> drive4=_L("Dogbert");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   591
	TBuf<64> drive17=_L("Flibble");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   592
	TBuf<64> drive25=_L("RAMDRIVE");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   593
	TInt r=TheFs.SetDriveName(0,drive0);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   594
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   595
	r=TheFs.SetDriveName(4,drive4);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   596
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   597
	r=TheFs.SetDriveName(17,drive17);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   598
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   599
	r=TheFs.SetDriveName(25,drive25);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   600
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   601
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   602
	r=TheFs.GetDriveName(0,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   603
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   604
	test(driveName==drive0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   605
	r=TheFs.GetDriveName(4,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   606
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   607
	test(driveName==drive4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   608
	r=TheFs.GetDriveName(17,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   609
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   610
	test(driveName==drive17);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   611
	r=TheFs.GetDriveName(25,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   612
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   613
	test(driveName==drive25);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   614
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   615
	drive0=_L("askdjflsdfourewoqiuroiuaksjdvx,cvsdhwjhjhalsjhfshfkjhslj");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   616
	r=TheFs.SetDriveName(0,drive0);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   617
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   618
	r=TheFs.GetDriveName(0,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   619
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   620
	test(driveName==drive0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   621
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   622
//	Test with illegal characters in drive name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   623
	drive0=_L("Dil>bert");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   624
	drive4=_L("Dog?bert");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   625
	drive17=_L("Fli*bble");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   626
	drive25=_L("RAMD//RIVE");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   627
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   628
	r=TheFs.SetDriveName(0,drive0);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   629
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   630
	r=TheFs.SetDriveName(4,drive4);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   631
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   632
	r=TheFs.SetDriveName(17,drive17);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   633
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   634
	r=TheFs.SetDriveName(25,drive25);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   635
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   636
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   637
//	Test that it is OK to set the name to no characters
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   638
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   639
	drive0=_L("");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   640
	drive4=_L("");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   641
	drive17=_L("");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   642
	drive25=_L("");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   643
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   644
	r=TheFs.SetDriveName(0,drive0);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   645
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   646
	r=TheFs.SetDriveName(4,drive4);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   647
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   648
	r=TheFs.SetDriveName(17,drive17);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   649
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   650
	r=TheFs.SetDriveName(25,drive25);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   651
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   652
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   653
	r=TheFs.GetDriveName(0,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   654
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   655
	test(driveName==drive0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   656
	r=TheFs.GetDriveName(4,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   657
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   658
	test(driveName==drive4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   659
	r=TheFs.GetDriveName(17,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   660
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   661
	test(driveName==drive17);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   662
	r=TheFs.GetDriveName(25,driveName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   663
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   664
	test(driveName==drive25);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   665
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   666
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   667
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   668
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   669
static void Test11()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   670
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   671
// Miscellaneous tests
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   672
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   673
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   674
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   675
	test.Next(_L("Miscellaneous tests"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   676
	TVolumeInfo vol;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   677
	TInt r=TheFs.Volume(vol);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   678
	test.Printf(_L("VolumeName = %S\n"),&vol.iName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   679
	test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   680
	r=TheFs.RmDir(_L("\\asdfasdf.\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   681
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   682
	r=TheFs.MkDir(_L("\\asdfasdf.\\"));
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   683
	test_Value(r, r == KErrBadName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   684
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   685
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   686
static void Test12()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   687
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   688
// Test SetNotifyUser and GetNotifyUser
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   689
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   690
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   691
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   692
	test.Next(_L("Test Set and GetNotifyUser"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   693
	TBool notifyState=TheFs.GetNotifyUser();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   694
	test(notifyState);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   695
	notifyState=EFalse;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   696
	TheFs.SetNotifyUser(notifyState);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   697
	notifyState=TheFs.GetNotifyUser();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   698
	test(notifyState==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   699
	notifyState=ETrue;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   700
	TheFs.SetNotifyUser(notifyState);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   701
	notifyState=TheFs.GetNotifyUser();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   702
	test(notifyState);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   703
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   704
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   705
static void Test13()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   706
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   707
// Test return values from RFs::Volume on cf-cards
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   708
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   709
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   710
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   711
	test.Next(_L("Test RFs::Volume"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   712
	TVolumeInfo vol;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   713
	TInt r=TheFs.Volume(vol,EDriveB);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   714
	test_Value(r, r == KErrNotReady || r==KErrNone || r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   715
	test.Printf(_L("RFs::Volume EDriveB returned %d\n"),r);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   716
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   717
	r=TheFs.Volume(vol,EDriveC);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   718
	test_Value(r, r == KErrNotReady || r==KErrNone || r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   719
	test.Printf(_L("RFs::Volume EDriveC returned %d\n"),r);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   720
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   721
	r=TheFs.Volume(vol,EDriveD);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   722
	test_Value(r, r == KErrNotReady || r==KErrNone || r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   723
	test.Printf(_L("RFs::Volume EDriveD returned %d\n"),r);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   724
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   725
	r=TheFs.Volume(vol,EDriveE);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   726
	test_Value(r, r == KErrNotReady || r==KErrNone || r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   727
	test.Printf(_L("RFs::Volume EDriveE returned %d\n"),r);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   728
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   729
	r=TheFs.Volume(vol,EDriveF);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   730
	test_Value(r, r == KErrNotReady || r==KErrNone || r == KErrPathNotFound);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   731
	test.Printf(_L("RFs::Volume EDriveF returned %d\n"),r);
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
void    DoTest14(TInt aDrvNum);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   736
TInt    CreateStuffedFile(RFs& aFs, const TDesC& aFileName, TUint aFileSize);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   737
TBool   CheckFileContents(RFs& aFs, const TDesC& aFileName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   738
#ifndef __NFE_MEDIA_DRIVER_PRESENT__
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   739
TBool   CheckBufferContents(const TDesC8& aBuffer, TUint aPrintBaseAddr=0);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   740
#endif
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   741
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   742
/**
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   743
    Testing unallocated data initialization vulnerability in RFile
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   744
    This test is performed on RAM drives and non-removable media that supports DeleteNotify (KMediaAttDeleteNotify flag)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   745
    e.g. XSR NAND
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   746
*/
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   747
static void Test14()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   748
{
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.Next(_L("Testing unallocated data initialization vulnerability in RFile"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   751
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   752
    TDriveInfo driveInfo;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   753
	
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   754
    //-- get drive info
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   755
	test(TheFs.Drive(driveInfo, gDriveNum) == KErrNone);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   756
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   757
    const TBool bMediaSuitable = (driveInfo.iType == EMediaRam)     || //-- RAM drives should be tested
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   758
                                 (driveInfo.iType == EMediaFlash)   || //-- NOR FLASH drives should be tested
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   759
                                 (driveInfo.iType == EMediaNANDFlash && driveInfo.iMediaAtt & KMediaAttDeleteNotify); //-- NAND media with DeleteNotify support
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   760
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   761
    if(!bMediaSuitable)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   762
    {
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   763
        test.Printf(_L("This test can't be performed on this type of the media! Skipping.\n"));
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   764
        return;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   765
    }
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   766
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   767
    DoTest14(gDriveNum);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   768
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   769
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
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   772
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   773
    Actually perform the test on a drive aDrvNum.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   774
    @param  aDrvNum drive number
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   775
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   776
void DoTest14(TInt aDrvNum)
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
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   779
    TFileName fileName;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   780
    fileName.Format(_L("Testing drive %c:"), 'A'+aDrvNum);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   781
    test.Next(fileName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   782
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   783
    const TInt  KFileSize = 0x1000; //-- size of the files t be created
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   784
    TInt        nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   785
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   786
    fileName.Format(_L("%c:\\TestFile.bin"), aDrvNum+'A');
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   787
    TheFs.Delete(fileName); //-- just in case
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   788
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   789
    //==============================
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   790
    //== Scenario 1.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   791
    //== Create an empty file; AllocateSingleClusterL, ExtendClusterListL will be involved.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   792
    //== Check that the file doesn't contain any meaningful information
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   793
    //==============================
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   794
    test.Printf(_L("Testing scenario 1\n"));
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
    //-- 1. create an empty file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   797
    nRes = CreateEmptyFile(TheFs, fileName, KFileSize);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   798
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   799
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   800
#ifndef __NFE_MEDIA_DRIVER_PRESENT__	// can't easily check for illegitimate information if drive is encrypted
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   801
    //-- 1.1  check that this file doesn't contain illegitimate information.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   802
    nRes = CheckFileContents(TheFs, fileName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   803
    test_KErrNone(nRes);
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   804
#endif
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   805
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   806
    //-- 1.2 delete the empty file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   807
    nRes = TheFs.Delete(fileName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   808
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   809
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   810
    //==============================
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   811
    //== Scenario 2.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   812
    //== Create file, filling it with some pattern.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   813
    //== Delete this file, FreeClusterListL() will be involved.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   814
    //== Create an empty file supposedly of the place of just deleted one
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   815
    //== Check that the file doesn't contain any meaningful information
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   816
    //==============================
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   817
    test.Printf(_L("Testing scenario 2\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   818
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   819
    //-- 2. create file filled with some data pattern
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   820
    nRes = CreateStuffedFile(TheFs, fileName, KFileSize);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   821
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   822
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   823
    //-- 2.1 delete this file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   824
    TheFs.Delete(fileName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   825
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   826
    //-- 2.1 create an empty file on the place of just deleted one (hopefully)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   827
    nRes = CreateEmptyFile(TheFs, fileName, KFileSize);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   828
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   829
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   830
    //-- 2.2  check that this file doesn't contain illegitimate information.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   831
    nRes = CheckFileContents(TheFs, fileName);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
   832
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   833
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   834
    //-- 2.3 delete this file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   835
    TheFs.Delete(fileName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   836
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   837
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   838
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
   839
static void Test15()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   840
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   841
// Test IsValidName
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   842
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   843
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   844
	test.Next(_L("Test RFs::IsValidName(TDesC& ,RFs::TNameValidParam& )"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   845
	TBool useDefaultSessionPath = EFalse;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   846
	//tests under this loop are run twice
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   847
	//first, when the sessionPath is not used.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   848
	//second, when the sessionPath is used.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   849
	for(TInt i = 0; i<2; i++)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   850
		{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   851
		RFs::TNameValidParam param(useDefaultSessionPath);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   852
		test(TheFs.IsValidName(_L("*"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   853
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   854
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   855
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   856
		test(TheFs.IsValidName(_L("?"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   857
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   858
		test(param.InvalidCharPos() == 1);
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
		test(TheFs.IsValidName(_L(">"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   861
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   862
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   863
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   864
		test(TheFs.IsValidName(_L("<"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   865
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   866
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   867
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   868
		test(TheFs.IsValidName(_L(":"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   869
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   870
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   871
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   872
		test(TheFs.IsValidName(_L("\""),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   873
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   874
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   875
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   876
		test(TheFs.IsValidName(_L("/"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   877
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   878
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   879
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   880
		test(TheFs.IsValidName(_L("|"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   881
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   882
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   883
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   884
		test(TheFs.IsValidName(_L("xx*yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   885
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   886
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   887
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   888
		test(TheFs.IsValidName(_L("xx?yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   889
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   890
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   891
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   892
		test(TheFs.IsValidName(_L("xx>yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   893
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   894
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   895
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   896
		test(TheFs.IsValidName(_L("xx<yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   897
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   898
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   899
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   900
		test(TheFs.IsValidName(_L("xx:yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   901
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   902
		test(param.InvalidCharPos() == 3);
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
		test(TheFs.IsValidName(_L("xx\"yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   905
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   906
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   907
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   908
		test(TheFs.IsValidName(_L("xx/yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   909
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   910
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   911
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   912
		test(TheFs.IsValidName(_L("xx|yy"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   913
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   914
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   915
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   916
		test(TheFs.IsValidName(_L("C:\\*\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   917
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   918
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   919
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   920
		test(TheFs.IsValidName(_L("C:\\?\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   921
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   922
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   923
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   924
		test(TheFs.IsValidName(_L("C:\\..\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   925
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   926
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   927
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   928
		test(TheFs.IsValidName(_L("C:\\.\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   929
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   930
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   931
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   932
		test(TheFs.IsValidName(_L("C:\\>\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   933
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   934
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   935
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   936
		test(TheFs.IsValidName(_L("C:\\<\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   937
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   938
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   939
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   940
		test(TheFs.IsValidName(_L("C:\\HelloWorld\\:\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   941
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   942
		test(param.InvalidCharPos() == 15);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   943
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   944
		test(TheFs.IsValidName(_L("C::\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   945
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   946
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   947
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   948
		test(TheFs.IsValidName(_L(">\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   949
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   950
		test(param.InvalidCharPos() == 1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   951
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   952
		test(TheFs.IsValidName(_L("C|group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   953
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   954
		test(param.InvalidCharPos() == 2);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   955
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   956
		test(TheFs.IsValidName(_L("C\\|\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   957
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   958
		test(param.InvalidCharPos() == 3);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   959
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   960
		test(TheFs.IsValidName(_L("\\>"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   961
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   962
		test(param.InvalidCharPos() == 2);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   963
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   964
		test(TheFs.IsValidName(_L("C:\\|group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   965
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   966
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   967
				
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   968
		test(TheFs.IsValidName(_L("C:\\\"\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   969
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   970
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   971
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   972
		test(TheFs.IsValidName(_L("C:\\/\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   973
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   974
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   975
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   976
		test(TheFs.IsValidName(_L("C:\\|\\group\\release.txt"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   977
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   978
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   979
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   980
		test(TheFs.IsValidName(_L("C:\\ \\group\\release.txt"),param)==EFalse);//intermediate directory names cannot be blank
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   981
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   982
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   983
		//	Test that \ is not allowed in filenames
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   984
		TFileName filename;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   985
		filename=_L("C:\\HelloWorld\\\\\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   986
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   987
		test(TheFs.IsValidName(filename,param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   988
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   989
		test(param.InvalidCharPos() == 22);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   990
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   991
		filename=_L("C:\\\\\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   992
		test(TheFs.IsValidName(filename,param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   993
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   994
		test(param.InvalidCharPos() == 11);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   995
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   996
		filename=_L("C:\\Hello World\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   997
		filename[8]=KPathDelimiter;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   998
		test(TheFs.IsValidName(filename,param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   999
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1000
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1001
		filename=_L("C:\\HelloWorld\\::\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1002
		test(TheFs.IsValidName(filename,param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1003
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1004
		test(param.InvalidCharPos() == 16);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1005
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1006
		filename=_L("C:\\>>\\group\\release.txt");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1007
		test(TheFs.IsValidName(filename,param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1008
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1009
		test(param.InvalidCharPos() == 5);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1010
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1011
		test(TheFs.IsValidName(_L(""),param)==EFalse); // Must be a name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1012
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1013
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1014
		test(TheFs.IsValidName(_L(".ext"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1015
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1016
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1017
		test(TheFs.IsValidName(_L("C:\\asdf.blarg"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1018
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1019
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1020
		test(TheFs.IsValidName(_L("C:\\asdf..blarg"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1021
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1022
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1023
		//	Test multiple evil characters - parsing occurs from right to left
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1024
		//	except that wildcarded characters take priority and are picked out first
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1025
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1026
		test(TheFs.IsValidName(_L("abc>def|ghi?jkl:mno<pqr*stu"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1027
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1028
		test(param.InvalidCharPos() == 24);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1029
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1030
		test(TheFs.IsValidName(_L("abc>def|ghi<jkl:mno?pqr"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1031
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1032
		test(param.InvalidCharPos() == 20);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1033
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1034
		test(TheFs.IsValidName(_L("abc>def|ghi<jkl:mno"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1035
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1036
		test(param.InvalidCharPos() == 16);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1037
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1038
		test(TheFs.IsValidName(_L("abc>def|ghi<jkl:mno"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1039
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1040
		test(param.InvalidCharPos() == 16);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1041
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1042
		test(TheFs.IsValidName(_L("abc>def|ghi<jkl"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1043
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1044
		test(param.InvalidCharPos() == 12);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1045
				
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1046
		test(TheFs.IsValidName(_L("abc>def|ghi<jkl"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1047
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1048
		test(param.InvalidCharPos() == 12);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1049
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1050
		test(TheFs.IsValidName(_L("abc>def|ghi"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1051
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1052
		test(param.InvalidCharPos() == 8);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1053
			
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1054
		test(TheFs.IsValidName(_L("abc>def|ghi"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1055
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1056
		test(param.InvalidCharPos() == 8);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1057
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1058
		test(TheFs.IsValidName(_L("abc>def"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1059
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1060
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1061
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1062
		test(TheFs.IsValidName(_L("abc>def"),param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1063
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1064
		test(param.InvalidCharPos() == 4);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1065
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1066
		test(!TheFs.IsValidName(_L("C:\\v123456.."),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1067
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1068
		test(param.InvalidCharPos() == 11);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1069
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1070
		test(!TheFs.IsValidName(_L("C:\\v123456.."),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1071
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadCharacter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1072
		test(param.InvalidCharPos() == 11);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1073
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1074
		test(TheFs.IsValidName(_L("abc"),param));						//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1075
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1076
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1077
		test(TheFs.IsValidName(_L("abc"),param));						//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1078
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1079
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1080
		test(TheFs.IsValidName(_L("as(){}@~#;!\xA3$%^&()df.blarg"),param));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1081
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1082
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1083
		test(TheFs.IsValidName(_L("as(){}@~#;!\xA3$%^&()df.blarg"),param));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1084
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1085
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1086
		test(TheFs.IsValidName(_L("C:\\asdf.blarg\\asdf.blarg"),param));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1087
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1088
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1089
		test(TheFs.IsValidName(_L("C:\\asdf.blarg\\asdf.blarg"),param));	//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1090
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1091
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1092
		test(TheFs.IsValidName(_L("\'"),param));							//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1093
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1094
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1095
		test(TheFs.IsValidName(_L("\'"),param));							//	Valid name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1096
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1097
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1098
		//testing directory names
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1099
		test(TheFs.IsValidName(_L("\\"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1100
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);           // Valid Name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1101
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1102
		test(TheFs.IsValidName(_L("C:\\asdf.blarg\\"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1103
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);           // Valid Name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1104
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1105
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1106
		test(TheFs.IsValidName(_L("C:\\asdf..blarg\\"),param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1107
		test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);           // Valid Name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1108
		
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1109
		test(TheFs.IsValidName(_L("file1.txt\\\\"),param) == EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1110
		test(param.ErrorCode() == RFs::TNameValidParam::ErrBadName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1111
	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1112
		// test name which exceeds KMaxFileName only on prepending the session path
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1113
		_LIT(KNameLength250, "AAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAA");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1114
		if(useDefaultSessionPath)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1115
			{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1116
			test(TheFs.IsValidName(KNameLength250, param)==EFalse);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1117
			test(param.ErrorCode() == RFs::TNameValidParam::ErrNameTooLong);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1118
			break;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1119
			}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1120
		else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1121
			{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1122
			test(TheFs.IsValidName(KNameLength250, param));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1123
			test(param.ErrorCode() == RFs::TNameValidParam::ErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1124
			}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1125
		useDefaultSessionPath = ETrue;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1126
		}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1127
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1128
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1129
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
void TestGetMediaSerialNumber()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1132
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1133
	test.Next(_L("Test RFs::GetMediaSerialNumber"));	
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1134
    TInt theDrive;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1135
    TInt r = TheFs.CharToDrive(gDriveToTest,theDrive);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1136
    test_KErrNone(r);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1137
    TMediaSerialNumber serNum;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1138
    r = TheFs.GetMediaSerialNumber(serNum, theDrive);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1139
	if (r) test.Printf(_L("RFs::GetMediaSerialNumber returned error %d"), r);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1140
    test_Value(r, r == KErrNotSupported || r == KErrNotReady || r == KErrNone);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1141
    if (r == KErrNotSupported)
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
        test.Printf(_L("MediaSerialNumber: Not Supported\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1144
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1145
    else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1146
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1147
        test.Printf(_L("MediaSerialNumber: length=%d\n"), serNum.Length());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1148
        TBuf<20> str;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1149
        _LIT(KNumberString, "%02X");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1150
        _LIT(KNewLine, "\n");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1151
        TInt i;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1152
        for (i = 0; i < serNum.Length(); i++)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1153
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1154
            str.AppendFormat(KNumberString, serNum[i]);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1155
            if (i%8 == 7)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1156
                {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1157
                str.Append(KNewLine);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1158
                test.Printf(_L("%S"), &str);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1159
                str.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1160
                }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1161
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1162
        if (i%8 != 7)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1163
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1164
            test.Printf(KNewLine);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1165
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1166
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1167
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1168
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1169
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1170
//--------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1171
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
    Create a file of specified size filled with some data pattern.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1175
    @param  aFs		    ref. to the FS
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1176
    @param  aFileName   name of the file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1177
    @param  aFileSize   size of the file to be created
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1178
    @return    KErrNone on success, system-wide error code otherwise
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1179
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1180
TInt CreateStuffedFile(RFs& aFs, const TDesC& aFileName, TUint aFileSize)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1181
{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1182
	TInt    nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1183
    RFile   file;
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
	//-- create a buffer with some data
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1186
	TBuf8<KBufLength> buffer;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1187
	buffer.SetLength(KBufLength);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1188
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1189
    TUint i;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1190
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1191
	for(i = 0; i < KBufLength; i++)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1192
		buffer[i] = static_cast<TUint8> (i) ;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1193
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1194
	//-- create a file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1195
	nRes = file.Create(aFs, aFileName, EFileRead|EFileWrite);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1196
    if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1197
        return nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1198
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1199
    const TUint n1 = aFileSize / KBufLength;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1200
    const TUint n2 = aFileSize % KBufLength;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1201
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1202
    //-- fill the file with the data from buffer
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1203
    for(i=0; i<n1; ++i)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1204
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1205
        nRes = file.Write(buffer);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1206
        if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1207
            return nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1208
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1209
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1210
    if(n2)
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
        nRes = file.Write(buffer, n2); //-- write the rest of the data
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1213
        if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1214
            return nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1215
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1216
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1217
    file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1218
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1219
    return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1220
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1221
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1222
//--------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1223
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1224
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1225
    Check if the specified file contains illegitimate information i.e. something different from 0x00, 0xff, 0x03, 0xcc
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1226
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1227
    @param  aFs		    ref. to the FS
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1228
    @param  aFileName   name of the file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1229
    @return    KErrNone on success, KErrCorrupt otherwise
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1230
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1231
TInt   CheckFileContents(RFs& aFs, const TDesC& aFileName)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1232
{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1233
	TInt    nRes = KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1234
    RFile   file;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1235
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1236
	TBuf8<KBufLength> buffer;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1237
    buffer.SetLength(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1238
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1239
    //-- open the file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1240
    nRes = file.Open(aFs, aFileName, EFileRead);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1241
    test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1242
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1243
    //-- check file contents
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1244
    TUint nFilePos=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1245
    for(;;)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1246
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1247
        //-- read data from the file into the buffer
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1248
        nRes = file.Read(buffer);
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1249
        test_KErrNone(nRes);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1250
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1251
        if(buffer.Length() == 0)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1252
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1253
            nRes = KErrNone; //-- read all the file, no illegitimate information found
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1254
            break; //EOF
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1255
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1256
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1257
#ifdef __NFE_MEDIA_DRIVER_PRESENT__
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1258
		// check the buffer doesn't contain the same pattern written to it by CreateStuffedFile()
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1259
		TUint i;
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1260
		for(i = 0; i < KBufLength; i++)
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1261
			if (buffer[i] != static_cast<TUint8> (i))
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1262
				break;
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1263
		if (i == KBufLength)
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1264
			{
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1265
            nRes = KErrCorrupt; //-- indicate that the read buffer contains illegitimate information
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1266
            break; //-- comment this out if you need a full dump of the file
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1267
			}
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1268
#else
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1269
        //-- check if the buffer contains only allowed data (RAM page initialisation data, etc. e.g. 0x00, 0xff, 0x03, 0xcc)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1270
        if(!CheckBufferContents(buffer, nFilePos))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1271
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1272
            test.Printf(_L("\nCheckFileContents failed ! The file contains illegitimate information!\n"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1273
            nRes = KErrCorrupt; //-- indicate that the read buffer contains illegitimate information
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1274
            break; //-- comment this out if you need a full dump of the file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1275
        }
123
fc55edbf3919 201015_11
hgs
parents: 0
diff changeset
  1276
#endif
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1277
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1278
        nFilePos+=buffer.Length();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1279
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1280
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1281
    file.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1282
    return nRes;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1283
}
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
    Check if the buffer contains illegitimate information i.e. something different from 0x00, 0xff, 0x03, 0xcc
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1289
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1290
    @param  aBuffer         buffer descriptor to check
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1291
    @param  aPrintBaseAddr  dump base address, used for dumping buffer only
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1292
    @return ETrue on success
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1293
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1294
TBool CheckBufferContents(const TDesC8& aBuffer, TUint aPrintBaseAddr/*=0*/)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1295
{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1296
    TBool bRes = ETrue;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1297
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1298
    //-- check if the buffer filled with allowable data (RAM page initialisation data or something similar)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1299
    //-- but not something meaningful.
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1300
    //-- Actually, the buffer should be filled with uniformed bytes (most probably, 0x00)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1301
    for(TInt i=0; i<aBuffer.Size(); ++i)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1302
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1303
        TUint8 byte = aBuffer[i];
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1304
        if(byte != aBuffer[0])
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1305
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1306
            bRes = EFalse;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1307
            break;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1308
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1309
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1310
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1311
    //-- dump the buffer if it contains anything different than allowed data
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1312
	if (!bRes)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1313
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1314
		for (TInt n=0; n<aBuffer.Size(); )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1315
			{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1316
			TBuf16<3> byteBuffer;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1317
			TBuf16<256> lineBuffer;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1318
			lineBuffer.Format(_L("%08X: "), aPrintBaseAddr+n);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1319
			for (TInt m=0; m<16 && n<aBuffer.Size(); m++, n++)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1320
				{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1321
				byteBuffer.Format(_L("%02X "), aBuffer[n]);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1322
				lineBuffer.Append(byteBuffer);
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
			test.Printf(lineBuffer);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1325
			}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1326
	}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1327
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1328
    return bRes;
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
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1331
//--------------------------------------------------------
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1332
/**
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1333
    Check if the drive aDriveNo is finalised or not.
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1334
    The "CleanShutDown" is obtained by QueryVolumeInfoExt API which is FS-agnostic.
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1335
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1336
    @param  aDriveNo drive number to query.
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1337
    @return ETrue if the drive if finalised
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1338
*/
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1339
static TBool IsVolumeFinalised(TInt aDriveNo)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1340
{
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1341
    TInt nRes;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1342
    TPckgBuf<TBool> boolPckg;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1343
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1344
    //-- 1. get "Finalised" state by using the API
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1345
    nRes = TheFs.QueryVolumeInfoExt(aDriveNo, EIsDriveFinalised, boolPckg);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1346
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1347
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1348
    return boolPckg();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1349
}
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1350
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1351
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1352
//--------------------------------------------------------
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1353
/**
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1354
    This is a file system - agnostic test that verifies RFs::FinaliseDrive() API
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1355
    There are also file system - specific tests that check similar functionallity (see t_mount for example)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1356
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1357
*/
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1358
void TestDriveFinalisation()
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1359
{
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1360
    test.Next(_L("TestDriveFinalisation(). Testing RFs::FinaliseDrives() API\n"));    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1361
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1362
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1363
    if((!Is_Fat(TheFs, gDriveNum) && !Is_ExFat(TheFs, gDriveNum)) || Is_Fat12(TheFs, gDriveNum) )
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1364
    {
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1365
        test.Printf(_L("This test can't be performed on current file system, skipping.\n"));
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1366
        return;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1367
    }
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1368
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1369
    TVolumeInfo v;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1370
    TInt  nRes;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1371
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1372
    nRes = TheFs.Volume(v);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1373
    test(nRes==KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1374
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1375
    if(v.iDrive.iMediaAtt & KMediaAttVariableSize)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1376
        {
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1377
        test.Printf(_L("Skipping. RAM drive not tested.\n"));
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1378
        return;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1379
        }
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1380
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1381
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1382
    TBool bDriveFinalised;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1383
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1384
    //============= 1. finalise the drive (RW mode) and check the result
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1385
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1386
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1387
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1388
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1389
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1390
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1391
    //-- 1.1 finalise the drive second time EFinal_RW -> EFinal_RW shall work
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1392
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1393
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1394
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1395
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1396
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1397
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1398
    //============= 2. create a file. Shall succeed (EFinal_RW), the volume shall become unfinalised
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1399
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1400
    RFile file;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1401
    _LIT(KFileName, "\\my_file1.dat");
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1402
    _LIT8(KSomeData, "this is some data");
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1403
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1404
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1405
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1406
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1407
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1408
    test(!bDriveFinalised); //-- the volume has become "unfinalised"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1409
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1410
    //----------------------------------------------------------------------------------
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1411
    //-- test volume finalisation with opened objects
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1412
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1413
    //-- 2.1 having opened files should be OK for volume finalisation
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1414
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1415
    //-- 2.1.1 RW finalisation; after the volume finalised it should be possible to write to the opened file
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1416
    nRes = file.Open(TheFs, KFileName, EFileWrite | EFileWriteDirectIO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1417
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1418
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1419
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1420
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1421
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1422
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1423
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1424
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1425
    nRes = file.Write(0, KSomeData);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1426
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1427
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1428
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1429
    test(!bDriveFinalised); //-- the volume should become "unfinalised"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1430
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1431
    //-- 2.1.2 RO finalisation; after the volume finalised it shouldn't be possible to write to the opened file
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1432
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1433
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1434
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1435
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1436
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1437
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1438
    nRes = file.Write(0, KSomeData);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1439
    test(nRes == KErrAccessDenied);  //-- no write access to the volume
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1440
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1441
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1442
    test(bDriveFinalised); //-- the volume should become "unfinalised"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1443
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1444
    file.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1445
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1446
    //-- remount FS, the drive shall become RW
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1447
    nRes = RemountFS(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1448
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1449
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1450
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1451
    //-- 2.2 having opened directories should be OK for volume finalisation
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1452
    _LIT(KDirName,  "\\Dir11235tt\\");
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1453
    MakeDir(KDirName);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1454
    RDir dir;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1455
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1456
    //-- 2.2.1 RW finalisation; after the volume finalised it should be possible to have write access to it
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1457
    nRes = dir.Open(TheFs, KDirName, KEntryAttNormal);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1458
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1459
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1460
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1461
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1462
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1463
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1464
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1465
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1466
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1467
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1468
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1469
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1470
    test(!bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1471
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1472
    //-- 2.1.2 RO finalisation; after the volume finalised it shouldn't be possible to write to it
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1473
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1474
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1475
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1476
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1477
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1478
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1479
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1480
    test(nRes == KErrAccessDenied);  //-- no write access to the volume
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1481
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1482
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1483
    test(bDriveFinalised); //-- the volume should become "unfinalised"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1484
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1485
    dir.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1486
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1487
    //-- remount FS, the drive shall become RW
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1488
    nRes = RemountFS(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1489
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1490
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1491
    //-- 2.3 having opened disk access objects, like formats or raw disks makes finalisation impossible
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1492
    RFormat  format;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1493
    RRawDisk rawDisk;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1494
    TInt     fmtCnt;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1495
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1496
    //-- 2.3.1 format
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1497
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1498
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1499
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1500
    nRes = format.Open(TheFs, gSessionPath, EFullFormat, fmtCnt);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1501
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1502
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1503
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1504
    test(nRes == KErrInUse);  
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1505
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1506
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1507
    test(nRes == KErrInUse);  
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1508
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1509
    format.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1510
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1511
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1512
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1513
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1514
    //-- 2.3.2 raw disk
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1515
    nRes = rawDisk.Open(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1516
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1517
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1518
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1519
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1520
    test(nRes == KErrInUse);  
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1521
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1522
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1523
    test(nRes == KErrInUse);  
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1524
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1525
    rawDisk.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1526
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1527
    //-- 2.4 Volume finalisation and file system dismounting
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1528
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1529
    //-- 2.4.1 "graceful" dismounting should finalise the drive correctly
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1530
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1531
    //-- "unfinalise the volume"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1532
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1533
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1534
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1535
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1536
    test(!bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1537
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1538
    TFSDescriptor fsDesc;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1539
    nRes = GetFileSystemDescriptor(TheFs, gDriveNum, fsDesc);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1540
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1541
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1542
    //-- gracefully dismount the file system
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1543
    nRes = TheFs.DismountFileSystem(fsDesc.iFsName, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1544
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1545
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1546
    //-- mount it back
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1547
    nRes = MountFileSystem(TheFs, gDriveNum, fsDesc);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1548
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1549
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1550
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1551
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1552
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1553
    //-- 2.4.2 "forced" dismounting, usually happens when "graceful doesn't work, because there are files opened on the volume.
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1554
    //-- Should also finalise the drive correctly
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1555
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1556
    //-- "unfinalise the volume"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1557
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1558
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1559
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1560
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1561
    test(!bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1562
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1563
    //-- open a file on the volume, this will prevent graceful dismounting
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1564
    nRes = file.Open(TheFs, KFileName, EFileWrite | EFileWriteDirectIO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1565
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1566
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1567
    nRes = GetFileSystemDescriptor(TheFs, gDriveNum, fsDesc);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1568
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1569
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1570
    //-- try gracefully dismount the file system
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1571
    nRes = TheFs.DismountFileSystem(fsDesc.iFsName, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1572
    test(nRes == KErrInUse); //-- no luck, as expected
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1573
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1574
    //-- now do dismounting by force
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1575
    TRequestStatus  rqStat;
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1576
    TheFs.NotifyDismount(gDriveNum, rqStat, EFsDismountForceDismount);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1577
    User::WaitForRequest(rqStat);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1578
    test_KErrNone(rqStat.Int());
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1579
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1580
    nRes = file.Write(0, KSomeData);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1581
    test(nRes == KErrNotReady);    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1582
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1583
    file.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1584
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1585
    //-- mount it back
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1586
    nRes = MountFileSystem(TheFs, gDriveNum, fsDesc);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1587
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1588
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1589
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1590
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1591
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1592
    //============= 3. test "unfinalise API"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1593
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EForceUnfinalise);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1594
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1595
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1596
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1597
    test(!bDriveFinalised); //-- the volume has become "unfinalised"
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1598
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1599
    //============= 4. test finalisation into RO mode
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1600
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO); //-- the volume becomes RO
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1601
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1602
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1603
    //-- try to write a file on RO volume; it shall fail with KErrAccessDenied
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1604
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1605
    test(nRes == KErrAccessDenied);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1606
    file.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1607
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1608
    //-- 4.1 try to finalise into EFinal_RW mode, shall fail with KErrAccessDenied
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1609
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1610
    test(nRes == KErrAccessDenied);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1611
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1612
    //-- 4.2 "unfinalise" the volume, it still shall remain RO
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1613
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EForceUnfinalise);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1614
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1615
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1616
    //-- try to write a file on RO volume; it shall fail with KErrAccessDenied
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1617
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1618
    test(nRes == KErrAccessDenied);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1619
    file.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1620
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1621
    //-- remount FS, the drive shall become RW
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1622
    nRes = RemountFS(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1623
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1624
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1625
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1626
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1627
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1628
    //-- try to write a file on RW volume, shall be OK
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1629
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1630
    test(nRes == KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1631
    file.Close();
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1632
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1633
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1634
    test(!bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1635
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1636
    //============= 5. test various finalisation modes
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1637
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1638
    //-- 5.1  Not finalised -> EFinal_RW (KErrNone)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1639
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1640
    test(nRes == KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1641
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1642
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1643
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1644
    //-- 5.2  EFinal_RW -> EFinal_RO (KErrNone)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1645
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RO);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1646
    test(nRes == KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1647
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1648
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1649
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1650
    //-- 5.2  EFinal_RO -> EFinal_RW  (KErrAccessDenied)
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1651
    nRes =TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1652
    test(nRes == KErrAccessDenied);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1653
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1654
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1655
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1656
    //-- 5.3 restore
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1657
    nRes = RemountFS(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1658
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1659
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1660
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1661
    //============= 6. test old RFs::FinaliseDrives API
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1662
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1663
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1664
    test(nRes == KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1665
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1666
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1667
    test(!bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1668
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1669
    TheFs.FinaliseDrives(); //-- shall work as TheFs.FinaliseDrive(gDriveNum, RFs::EFinal_RW) but for ALL drives
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1670
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1671
    bDriveFinalised = IsVolumeFinalised(gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1672
    test(bDriveFinalised);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1673
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1674
    nRes = CreateEmptyFile(TheFs, KFileName, 128000);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1675
    test(nRes == KErrNone);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1676
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1677
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1678
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1679
}
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1680
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1681
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1682
void CallTestsL()
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1683
	{
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1684
    //-- set up console output
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1685
    F32_Test_Utils::SetConsole(test.Console());
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1686
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1687
    TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1688
    test_KErrNone(nRes);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1689
    
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1690
    PrintDrvInfo(TheFs, gDriveNum);
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1691
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1692
    TestDriveFinalisation();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1693
	Test1();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1694
	Test2();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1695
	Test3();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1696
	Test4();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1697
	Test5();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1698
	Test6();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1699
	Test7();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1700
	Test8();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1701
	Test9();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1702
	Test10();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1703
	Test11();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1704
	Test12();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1705
	Test13();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1706
	Test14();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1707
	Test15();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1708
    TestGetMediaSerialNumber();
199
189ece41fa29 201027_05
hgs
parents: 123
diff changeset
  1709
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
  1710
	}