os/kernelhwsrv/kerneltest/e32test/system/t_kucopy.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\system\t_kucopy.cpp
sl@0
    15
// Test copying between kernel and user side.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#define __E32TEST_EXTENSION__
sl@0
    20
sl@0
    21
#include <e32test.h>
sl@0
    22
#include "d_kucopy.h"
sl@0
    23
#include "../mmu/mmudetect.h"
sl@0
    24
sl@0
    25
//#define QUICK
sl@0
    26
sl@0
    27
_LIT(KLddFileName,"D_KUCOPY.LDD");
sl@0
    28
_LIT(KLitKernExec,"KERN-EXEC");
sl@0
    29
sl@0
    30
RTest test(_L("T_KUCOPY"));
sl@0
    31
RKUCopy KU;
sl@0
    32
TInt BufSize;
sl@0
    33
TInt RandSize;
sl@0
    34
TUint8* Buf1;
sl@0
    35
TUint8* Buf2;
sl@0
    36
TUint8* Random;
sl@0
    37
TBool KernProt=EFalse;
sl@0
    38
sl@0
    39
_LIT8(KTest8_1,"1");
sl@0
    40
_LIT8(KTest8_2,"Test2");
sl@0
    41
_LIT8(KTest8_3,"extensionality emptyset pairset separation powerset unionset infinity foundation replacement choice");
sl@0
    42
_LIT8(KTest8_4,"And darkness and decay and the red death held illimitable dominion over all.");
sl@0
    43
sl@0
    44
_LIT16(KTest16_1,"39");
sl@0
    45
_LIT16(KTest16_2,"Test16");
sl@0
    46
_LIT16(KTest16_3,"extensionality emptyset pairset separation powerset unionset infinity foundation replacement choice.");
sl@0
    47
_LIT16(KTest16_4,"And darkness and decay and the red death held illimitable dominion over all.");
sl@0
    48
sl@0
    49
static const TDesC8* const TestStrings8[]=
sl@0
    50
	{
sl@0
    51
	&KTest8_1,
sl@0
    52
	&KTest8_2,
sl@0
    53
	&KTest8_3,
sl@0
    54
	&KTest8_4,
sl@0
    55
	};
sl@0
    56
sl@0
    57
static const TDesC16* const TestStrings16[]=
sl@0
    58
	{
sl@0
    59
	&KTest16_1,
sl@0
    60
	&KTest16_2,
sl@0
    61
	&KTest16_3,
sl@0
    62
	&KTest16_4,
sl@0
    63
	};
sl@0
    64
sl@0
    65
#define NTESTS8		((TInt)(sizeof(TestStrings8)/sizeof(const TDesC8*)))
sl@0
    66
#define NTESTS16	((TInt)(sizeof(TestStrings16)/sizeof(const TDesC16*)))
sl@0
    67
sl@0
    68
enum TTest
sl@0
    69
	{
sl@0
    70
	EPut,
sl@0
    71
	EGet,
sl@0
    72
	EPut32,
sl@0
    73
	EGet32,
sl@0
    74
	ESet,
sl@0
    75
	EDesPut8,
sl@0
    76
	EDesGet8,
sl@0
    77
	EDesInfo8,
sl@0
    78
	EDesPut16,
sl@0
    79
	EDesGet16,
sl@0
    80
	EDesInfo16,
sl@0
    81
	};
sl@0
    82
sl@0
    83
void DoPutGetTest(TInt aSrcOffset, TInt aDestOffset, TInt aLen, TTest aTest)
sl@0
    84
	{
sl@0
    85
	// Use the first BufSize of random data as background, the rest as copy data.
sl@0
    86
	// Use Buf1 as target
sl@0
    87
//	test.Printf(_L("s=%4d d=%4d l=%4d t=%d\n"),aSrcOffset,aDestOffset,aLen,aTest);
sl@0
    88
	switch (aTest)
sl@0
    89
		{
sl@0
    90
		case EPut:
sl@0
    91
			Mem::Move(Buf1,Random,BufSize);
sl@0
    92
			KU.Put(Buf1+aDestOffset,aSrcOffset+BufSize,aLen);
sl@0
    93
			break;
sl@0
    94
		case EGet:
sl@0
    95
			KU.Get(Random+BufSize+aSrcOffset,aDestOffset,aLen);
sl@0
    96
			KU.Read(Buf1);
sl@0
    97
			break;
sl@0
    98
		case EPut32:
sl@0
    99
			Mem::Move(Buf1,Random,BufSize);
sl@0
   100
			KU.Put32((TUint32*)(Buf1+aDestOffset),aSrcOffset+BufSize,aLen);
sl@0
   101
			break;
sl@0
   102
		case EGet32:
sl@0
   103
			KU.Get32((const TUint32*)(Random+BufSize+aSrcOffset),aDestOffset,aLen);
sl@0
   104
			KU.Read(Buf1);
sl@0
   105
			break;
sl@0
   106
		default:
sl@0
   107
			User::Panic(_L("PutGetTest"),aTest);
sl@0
   108
		}
sl@0
   109
sl@0
   110
	// Should now have:
sl@0
   111
	// Buf1[0...aDestOffset-1]=Random[0...aDestOffset-1]
sl@0
   112
	// Buf1[aDestOffset...aDestOffset+aLen-1]=Random[BufSize+aSrcOffset...BufSize+aSrcOffset+aLen-1]
sl@0
   113
	// Buf1[aDestOffset+aLen...BufSize-1]=Random[aDestOffset+aLen...BufSize-1]
sl@0
   114
	test(Mem::Compare(Buf1,aDestOffset,Random,aDestOffset)==0);
sl@0
   115
	test(Mem::Compare(Buf1+aDestOffset,aLen,Random+BufSize+aSrcOffset,aLen)==0);
sl@0
   116
	test(Mem::Compare(Buf1+aDestOffset+aLen,BufSize-aDestOffset-aLen,Random+aDestOffset+aLen,BufSize-aDestOffset-aLen)==0);
sl@0
   117
	}
sl@0
   118
sl@0
   119
void DoSetTest(TInt aOffset, TInt aLen, TUint8 aValue)
sl@0
   120
	{
sl@0
   121
	Mem::Move(Buf1,Random,BufSize);
sl@0
   122
	KU.Set(Buf1+aOffset,aLen,aValue);
sl@0
   123
	test(Mem::Compare(Buf1,aOffset,Random,aOffset)==0);
sl@0
   124
	TUint8* p=Buf1+aOffset;
sl@0
   125
	TUint8* pE=p+aLen;
sl@0
   126
	while (p<pE)
sl@0
   127
		test(*p++==aValue);
sl@0
   128
	test(Mem::Compare(Buf1+aOffset+aLen,BufSize-aOffset-aLen,Random+aOffset+aLen,BufSize-aOffset-aLen)==0);
sl@0
   129
	}
sl@0
   130
sl@0
   131
void TestDesGet8(const TDesC8& aSrc)
sl@0
   132
	{
sl@0
   133
	TPtr8 dest(Buf2,0,BufSize);
sl@0
   134
	KU.DesGet(dest,aSrc);
sl@0
   135
	test(dest==aSrc);
sl@0
   136
	}
sl@0
   137
sl@0
   138
void TestDesGet8()
sl@0
   139
	{
sl@0
   140
	TInt i;
sl@0
   141
	for (i=0; i<NTESTS8; ++i)
sl@0
   142
		{
sl@0
   143
		const TDesC8* orig=TestStrings8[i];
sl@0
   144
		TestDesGet8(*orig);	// test EBufC
sl@0
   145
		TBuf8<256> buf=*orig;
sl@0
   146
		TestDesGet8(buf);	// test EBuf
sl@0
   147
		TPtrC8 ptrc(orig->Ptr(),orig->Length());
sl@0
   148
		TestDesGet8(ptrc);	// test EPtrC
sl@0
   149
		TPtr8 ptr((TUint8*)orig->Ptr(),orig->Length(),orig->Length());
sl@0
   150
		TestDesGet8(ptr);	// test EPtr
sl@0
   151
		HBufC8* pH=orig->Alloc();
sl@0
   152
		test(pH!=NULL);
sl@0
   153
		TPtr8 bufCptr(pH->Des());
sl@0
   154
		TestDesGet8(bufCptr);	// test EBufCPtr
sl@0
   155
		User::Free(pH);
sl@0
   156
		}
sl@0
   157
	}
sl@0
   158
sl@0
   159
void TestDesPut8(TDesC8& aDest, const TDesC8* aExtraDest, const TDesC8& aSrc)
sl@0
   160
	{
sl@0
   161
	KU.DesPut((TDes8&)aDest,aSrc);
sl@0
   162
	test(aDest==aSrc);
sl@0
   163
	if (aExtraDest)
sl@0
   164
		test(*aExtraDest==aSrc);	// for testing EBufCPtr
sl@0
   165
	}
sl@0
   166
sl@0
   167
void TestDesPut8()
sl@0
   168
	{
sl@0
   169
	TInt i;
sl@0
   170
	for (i=0; i<NTESTS8; ++i)
sl@0
   171
		{
sl@0
   172
		const TDesC8* orig=TestStrings8[i];
sl@0
   173
		TBuf8<256> buf;
sl@0
   174
		TestDesPut8(buf,NULL,*orig);	// test EBuf
sl@0
   175
		Mem::FillZ((TAny*)buf.Ptr(),256);
sl@0
   176
		TPtr8 ptr((TUint8*)buf.Ptr(),0,256);
sl@0
   177
		TestDesPut8(ptr,NULL,*orig);	// test EPtr
sl@0
   178
		HBufC8* pH=HBufC8::New(256);
sl@0
   179
		test(pH!=NULL);
sl@0
   180
		TPtr8 bufCptr(pH->Des());
sl@0
   181
		TestDesPut8(bufCptr,pH,*orig);	// test EBufCPtr
sl@0
   182
		User::Free(pH);
sl@0
   183
		}
sl@0
   184
	}
sl@0
   185
sl@0
   186
void TestDesInfo8(const TDesC8& aDes, TInt aLength, TInt aMaxLength, const TUint8* aPtr)
sl@0
   187
	{
sl@0
   188
	SDesInfo info;
sl@0
   189
	KU.DesInfo(aDes,info);
sl@0
   190
	test(aLength==info.iLength);
sl@0
   191
	test(aMaxLength==info.iMaxLength);
sl@0
   192
	test((TAny*)aPtr==info.iPtr);
sl@0
   193
	}
sl@0
   194
sl@0
   195
void TestDesInfo8()
sl@0
   196
	{
sl@0
   197
	TInt i;
sl@0
   198
	for (i=0; i<NTESTS8; ++i)
sl@0
   199
		{
sl@0
   200
		const TDesC8* orig=TestStrings8[i];
sl@0
   201
		TestDesInfo8(*orig,orig->Length(),-1,orig->Ptr());	// test EBufC
sl@0
   202
		TBuf8<256> buf;
sl@0
   203
		TestDesInfo8(buf,0,256,buf.Ptr());				// test EBuf
sl@0
   204
		buf=*orig;
sl@0
   205
		TestDesInfo8(buf,orig->Length(),256,buf.Ptr());	// test EBuf
sl@0
   206
		TBuf8<203> buf2;
sl@0
   207
		TestDesInfo8(buf2,0,203,buf2.Ptr());			// test EBuf
sl@0
   208
		buf2=*orig;
sl@0
   209
		TestDesInfo8(buf2,orig->Length(),203,buf2.Ptr());	// test EBuf
sl@0
   210
		TPtrC8 ptrc(orig->Ptr(),orig->Length());
sl@0
   211
		TestDesInfo8(ptrc,orig->Length(),-1,orig->Ptr());	// test EPtrC
sl@0
   212
		TPtr8 ptr((TUint8*)orig->Ptr(),orig->Length(),orig->Length());
sl@0
   213
		TestDesInfo8(ptr,orig->Length(),orig->Length(),orig->Ptr());	// test EPtr
sl@0
   214
		HBufC8* pH=orig->Alloc();
sl@0
   215
		test(pH!=NULL);
sl@0
   216
		TPtr8 bufCptr(pH->Des());
sl@0
   217
		TestDesInfo8(*pH,orig->Length(),-1,pH->Ptr());
sl@0
   218
		TestDesInfo8(bufCptr,orig->Length(),User::AllocLen(pH)-sizeof(TDesC8),pH->Ptr());
sl@0
   219
		User::Free(pH);
sl@0
   220
		}
sl@0
   221
	}
sl@0
   222
sl@0
   223
void RunTestInThread(TThreadFunction aFn, TAny* aParameter, const TDesC* aPanicCat, TInt aExitCode, TInt aLine)
sl@0
   224
	{
sl@0
   225
	test.Printf(_L("Line %d\n"),aLine);
sl@0
   226
	RThread t;
sl@0
   227
	TInt r=t.Create(KNullDesC(),aFn,0x2000,NULL,aParameter);
sl@0
   228
	test(r==KErrNone);
sl@0
   229
	TRequestStatus s;
sl@0
   230
	t.Logon(s);
sl@0
   231
	t.Resume();
sl@0
   232
	User::WaitForRequest(s);
sl@0
   233
	if (aPanicCat)
sl@0
   234
		{
sl@0
   235
		test(t.ExitType()==EExitPanic);
sl@0
   236
		test(t.ExitCategory()==*aPanicCat);
sl@0
   237
		test(t.ExitReason()==aExitCode);
sl@0
   238
		}
sl@0
   239
	else
sl@0
   240
		{
sl@0
   241
		test(t.ExitType()==EExitKill);
sl@0
   242
		test(t.ExitReason()==aExitCode);
sl@0
   243
		}
sl@0
   244
	CLOSE_AND_WAIT(t);
sl@0
   245
	}
sl@0
   246
sl@0
   247
TInt DesGet8Thread(TAny* aPtr)
sl@0
   248
	{
sl@0
   249
	TBuf8<256> dest;
sl@0
   250
	KU.DesGet(dest, *(const TDesC8*)aPtr);
sl@0
   251
	return 0;
sl@0
   252
	}
sl@0
   253
sl@0
   254
TInt DesPut8Thread(TAny* aPtr)
sl@0
   255
	{
sl@0
   256
	KU.DesPut(*(TDes8*)aPtr,KTest8_4);
sl@0
   257
	return 0;
sl@0
   258
	}
sl@0
   259
sl@0
   260
TInt DesInfo8Thread(TAny* aPtr)
sl@0
   261
	{
sl@0
   262
	SDesInfo info;
sl@0
   263
	KU.DesInfo(*(TDesC8*)aPtr,info);
sl@0
   264
	return 0;
sl@0
   265
	}
sl@0
   266
sl@0
   267
void TestErrors()
sl@0
   268
	{
sl@0
   269
	TBool jit=User::JustInTime();
sl@0
   270
	User::SetJustInTime(EFalse);
sl@0
   271
	TUint8* Kern=KU.KernelBufferAddress();
sl@0
   272
	TUint x=0xffffffff;
sl@0
   273
	TBuf8<256> ubuf;
sl@0
   274
	TPtrC8 uptrc(Buf1,100);
sl@0
   275
	TPtrC8 kptrc(Kern,1);
sl@0
   276
	TPtr8 kptr(Kern,10,256);
sl@0
   277
	RunTestInThread(DesGet8Thread,&x,&KLitKernExec,EKUDesInfoInvalidType,__LINE__);
sl@0
   278
	RunTestInThread(DesGet8Thread,&ubuf,NULL,KErrNone,__LINE__);
sl@0
   279
	RunTestInThread(DesGet8Thread,&ubuf,NULL,KErrNone,__LINE__);
sl@0
   280
	if (KernProt)
sl@0
   281
		{
sl@0
   282
		RunTestInThread(DesGet8Thread,Kern,&KLitKernExec,ECausedException,__LINE__);
sl@0
   283
		RunTestInThread(DesGet8Thread,&kptrc,&KLitKernExec,ECausedException,__LINE__);
sl@0
   284
		RunTestInThread(DesGet8Thread,&kptr,&KLitKernExec,ECausedException,__LINE__);
sl@0
   285
		}
sl@0
   286
	RunTestInThread(DesPut8Thread,&x,&KLitKernExec,EKUDesInfoInvalidType,__LINE__);
sl@0
   287
	RunTestInThread(DesPut8Thread,&ubuf,NULL,KErrNone,__LINE__);
sl@0
   288
	RunTestInThread(DesPut8Thread,&uptrc,&KLitKernExec,EKUDesSetLengthInvalidType,__LINE__);
sl@0
   289
	if (KernProt)
sl@0
   290
		{
sl@0
   291
		RunTestInThread(DesPut8Thread,Kern,&KLitKernExec,ECausedException,__LINE__);
sl@0
   292
		RunTestInThread(DesPut8Thread,&kptrc,&KLitKernExec,EKUDesSetLengthInvalidType,__LINE__);
sl@0
   293
		RunTestInThread(DesPut8Thread,&kptr,&KLitKernExec,ECausedException,__LINE__);
sl@0
   294
		}
sl@0
   295
	RunTestInThread(DesInfo8Thread,&x,&KLitKernExec,EKUDesInfoInvalidType,__LINE__);
sl@0
   296
	RunTestInThread(DesInfo8Thread,&ubuf,NULL,KErrNone,__LINE__);
sl@0
   297
	RunTestInThread(DesInfo8Thread,&uptrc,NULL,KErrNone,__LINE__);
sl@0
   298
	RunTestInThread(DesInfo8Thread,&kptrc,NULL,KErrNone,__LINE__);
sl@0
   299
	RunTestInThread(DesInfo8Thread,&kptr,NULL,KErrNone,__LINE__);
sl@0
   300
	if (KernProt)
sl@0
   301
		{
sl@0
   302
		RunTestInThread(DesInfo8Thread,Kern,&KLitKernExec,ECausedException,__LINE__);
sl@0
   303
		}
sl@0
   304
sl@0
   305
	User::SetJustInTime(jit);
sl@0
   306
	}
sl@0
   307
sl@0
   308
void RequestCompleteBadPointer(TUint aBadAddress)
sl@0
   309
	{
sl@0
   310
	TRequestStatus* badStatus = (TRequestStatus*)aBadAddress;
sl@0
   311
	test.Printf(_L("Test Kern::RequestComplete to %08x\n"), aBadAddress);
sl@0
   312
	KU.RequestComplete(badStatus);
sl@0
   313
	test.Printf(_L("Test Kern::RequestComplete to %08x (in current thread)\n"), aBadAddress);
sl@0
   314
	KU.RequestCompleteLocal(badStatus);
sl@0
   315
sl@0
   316
	// Check the thread hasn't been signalled
sl@0
   317
	TRequestStatus status;
sl@0
   318
	RTimer timer;
sl@0
   319
	test_KErrNone(timer.CreateLocal());
sl@0
   320
	timer.After(status, 100000); // 100ms
sl@0
   321
	test_Equal(KRequestPending, status.Int());
sl@0
   322
	User::WaitForAnyRequest();
sl@0
   323
	test_Equal(KErrNone, status.Int());
sl@0
   324
	timer.Close();	
sl@0
   325
	
sl@0
   326
	test.Printf(_L("Test Kern::QueueRequestComplete to %08x\n"), aBadAddress);
sl@0
   327
	TInt r = KU.QueueRequestComplete(badStatus);
sl@0
   328
sl@0
   329
	// Kern::QueueRequestComplete will signal even if the pointer is bad, unless:
sl@0
   330
	//  - the pointer is null
sl@0
   331
	//  - the call to Setup returned an error
sl@0
   332
	if (badStatus != NULL && r == KErrNone)
sl@0
   333
		User::WaitForAnyRequest();
sl@0
   334
	}
sl@0
   335
sl@0
   336
void TestRequestCompleteTrapped()
sl@0
   337
	{
sl@0
   338
	TRequestStatus status;
sl@0
   339
	test.Printf(_L("Test Kern::RequestComplete to %08x\n"), &status);
sl@0
   340
	status = KRequestPending;
sl@0
   341
	KU.RequestComplete(&status);
sl@0
   342
	User::WaitForRequest(status);
sl@0
   343
	test_Equal(KErrNone, status.Int());
sl@0
   344
	
sl@0
   345
	test.Printf(_L("Test Kern::RequestComplete to %08x (in current thread)\n"), &status);
sl@0
   346
	status = KRequestPending;
sl@0
   347
	KU.RequestCompleteLocal(&status);
sl@0
   348
	User::WaitForRequest(status);
sl@0
   349
	test_Equal(KErrNone, status.Int());
sl@0
   350
sl@0
   351
	test.Printf(_L("Test Kern::QueueRequestComplete to %08x\n"), &status);
sl@0
   352
	status = KRequestPending;
sl@0
   353
	KU.QueueRequestComplete(&status);
sl@0
   354
	User::WaitForRequest(status);
sl@0
   355
	test_Equal(KErrNone, status.Int());
sl@0
   356
sl@0
   357
	RequestCompleteBadPointer(0x00000000);
sl@0
   358
	RequestCompleteBadPointer(0x00000001);
sl@0
   359
	RequestCompleteBadPointer(0x00000004);
sl@0
   360
	RequestCompleteBadPointer(0x00000008);
sl@0
   361
	if (KernProt)
sl@0
   362
		{
sl@0
   363
		RequestCompleteBadPointer(0x80000000);
sl@0
   364
		RequestCompleteBadPointer(0xfffffff0);
sl@0
   365
		RequestCompleteBadPointer((TUint)KU.KernelBufferAddress());
sl@0
   366
		}
sl@0
   367
	}
sl@0
   368
sl@0
   369
GLDEF_C TInt E32Main()
sl@0
   370
	{
sl@0
   371
	test.Title();
sl@0
   372
	test.Start(_L("Load LDD"));
sl@0
   373
	TInt r=User::LoadLogicalDevice(KLddFileName);
sl@0
   374
	test(r==KErrNone || r==KErrAlreadyExists);
sl@0
   375
	test.Next(_L("Open channel"));
sl@0
   376
	r=KU.Open();
sl@0
   377
	test(r==KErrNone);
sl@0
   378
	test.Next(_L("Create chunk"));
sl@0
   379
	RChunk c;
sl@0
   380
	r=c.CreateDisconnectedLocal(0,0,0x100000);
sl@0
   381
	test(r==KErrNone);
sl@0
   382
	BufSize=KU.Length();
sl@0
   383
	RandSize=KU.RandomLength();
sl@0
   384
	test.Printf(_L("BufSize=%x, RandSize=%x\n"),BufSize,RandSize);
sl@0
   385
	r=c.Commit(0,BufSize);
sl@0
   386
	test(r==KErrNone);
sl@0
   387
	r=c.Commit(0x10000,BufSize);
sl@0
   388
	test(r==KErrNone);
sl@0
   389
	r=c.Commit(0x20000,RandSize);
sl@0
   390
	test(r==KErrNone);
sl@0
   391
	Buf1=c.Base();
sl@0
   392
	Buf2=c.Base()+0x10000;
sl@0
   393
	Random=c.Base()+0x20000;
sl@0
   394
	test.Printf(_L("Buf1 at %08x, Buf2 at %08x, Random at %08x\n"),Buf1,Buf2,Random);
sl@0
   395
	Mem::Fill(Buf1,BufSize,0xb1);
sl@0
   396
	Mem::Fill(Buf2,BufSize,0xb2);
sl@0
   397
	Mem::Fill(Random,RandSize,0x8b);
sl@0
   398
	KU.ReadRandom(Random);
sl@0
   399
sl@0
   400
	KernProt=HaveDirectKernProt();
sl@0
   401
sl@0
   402
#ifndef QUICK
sl@0
   403
	TInt s;
sl@0
   404
	TInt d;
sl@0
   405
	TInt l;
sl@0
   406
	test.Next(_L("Put/Get 1"));
sl@0
   407
	for (l=1; l<300; l+=3)
sl@0
   408
		{
sl@0
   409
		test.Printf(_L("PG1: l=%d\n"),l);
sl@0
   410
		for (s=0; s<=BufSize-l; s+=227)
sl@0
   411
			{
sl@0
   412
			for (d=0; d<=BufSize-l; d+=229)
sl@0
   413
				{
sl@0
   414
				DoPutGetTest(s,d,l,EPut);
sl@0
   415
				DoPutGetTest(s,d,l,EGet);
sl@0
   416
				}
sl@0
   417
			}
sl@0
   418
		}
sl@0
   419
sl@0
   420
	test.Next(_L("Put/Get 2"));
sl@0
   421
	for (l=1; l<300; l+=3)
sl@0
   422
		{
sl@0
   423
		test.Printf(_L("PG2: l=%d\n"),l);
sl@0
   424
		for (s=BufSize-l; s>=0; s-=227)
sl@0
   425
			{
sl@0
   426
			for (d=BufSize-l; d>=0; d-=229)
sl@0
   427
				{
sl@0
   428
				DoPutGetTest(s,d,l,EPut);
sl@0
   429
				DoPutGetTest(s,d,l,EGet);
sl@0
   430
				}
sl@0
   431
			}
sl@0
   432
		}
sl@0
   433
sl@0
   434
	test.Next(_L("Put32/Get32 1"));
sl@0
   435
	for (l=4; l<300; l+=12)
sl@0
   436
		{
sl@0
   437
		test.Printf(_L("PG32,1: l=%d\n"),l);
sl@0
   438
		for (s=0; s<=BufSize-l; s+=4*59)
sl@0
   439
			{
sl@0
   440
			for (d=0; d<=BufSize-l; d+=4*61)
sl@0
   441
				{
sl@0
   442
				DoPutGetTest(s,d,l,EPut32);
sl@0
   443
				DoPutGetTest(s,d,l,EGet32);
sl@0
   444
				}
sl@0
   445
			}
sl@0
   446
		}
sl@0
   447
sl@0
   448
	test.Next(_L("Put32/Get32 2"));
sl@0
   449
	for (l=4; l<300; l+=12)
sl@0
   450
		{
sl@0
   451
		test.Printf(_L("PG32,2: l=%d\n"),l);
sl@0
   452
		for (s=BufSize-l; s>=0; s-=4*59)
sl@0
   453
			{
sl@0
   454
			for (d=BufSize-l; d>=0; d-=4*61)
sl@0
   455
				{
sl@0
   456
				DoPutGetTest(s,d,l,EPut32);
sl@0
   457
				DoPutGetTest(s,d,l,EGet32);
sl@0
   458
				}
sl@0
   459
			}
sl@0
   460
		}
sl@0
   461
	test.Next(_L("Set"));
sl@0
   462
	for (l=1; l<300; l+=3)
sl@0
   463
		{
sl@0
   464
		test.Printf(_L("Set: l=%d\n"),l);
sl@0
   465
		for (s=0; s<=BufSize-l; s+=83)
sl@0
   466
			{
sl@0
   467
			DoSetTest(s,l,0x1b);
sl@0
   468
			DoSetTest(s,l,0xaa);
sl@0
   469
			}
sl@0
   470
		for (s=BufSize-l; s>=0; s-=79)
sl@0
   471
			{
sl@0
   472
			DoSetTest(s,l,0x1b);
sl@0
   473
			DoSetTest(s,l,0xaa);
sl@0
   474
			}
sl@0
   475
		}
sl@0
   476
#endif
sl@0
   477
	test.Next(_L("DesGet8"));
sl@0
   478
	TestDesGet8();
sl@0
   479
	test.Next(_L("DesPut8"));
sl@0
   480
	TestDesPut8();
sl@0
   481
	test.Next(_L("DesInfo8"));
sl@0
   482
	TestDesInfo8();
sl@0
   483
	test.Next(_L("Errors"));
sl@0
   484
	TestErrors();
sl@0
   485
	test.Next(_L("Test Kern::RequestComplete functions trapped"));
sl@0
   486
	TestRequestCompleteTrapped();
sl@0
   487
sl@0
   488
	c.Close();
sl@0
   489
	KU.Close();
sl@0
   490
	test.End();
sl@0
   491
	return 0;
sl@0
   492
	}
sl@0
   493
sl@0
   494
sl@0
   495
sl@0
   496