Ejemplo n.º 1
0
static int cmd_t2(int argc, char *argv[])
{
	URET ret;
	MSGLN("Test return: %s !", (ret = DoTest2()) == U_SUCC ? "succ" : "failed");

	return (ret == U_SUCC) ? 0 : -1;
}
Ejemplo n.º 2
0
void RunTestsL()
	{
	DoTest1();
	DoTest2();
	DoTest3();
	DoTest4();
	DoTest5();
	DoTest6();
	DEF102233();
	DEF130663();
	}
Ejemplo n.º 3
0
/** Tests the creation of a directory with 2 threads accessing different directories 
	(the current and one with 300 files)

	@param aSelector Configuration in case of manual execution
*/
LOCAL_C TInt TestMakeMultDif(TAny* aSelector)
	{
	TInt i = 100;
	TBuf16<50> directory;
	TBuf16<50> dirtemp;
	TInt testStep;
	
	Validate(aSelector);

	CreateDirWithNFiles(300,3);		
			
	directory = gSessionPath;
	dirtemp.Format(KDirMultipleName2, 3, 300);
	directory.Append(dirtemp);
	gDelEntryDir2 = directory;

	test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing dif dirs, RFs::MkDir\n"), gTestHarness, gTestCase);
	
	i = 100;
	testStep = 1;
	while(i <= KMaxFiles)
		{	
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
			{
			directory = gSessionPath;
			dirtemp.Format(KDirMultipleName2, 2, i);
			directory.Append(dirtemp);
			gDelEntryDir = directory;

			DoTest2(DeleteEntryAccess);

			MakeDir(i, testStep++);	

			DoTestKill();
			}
		i += 100;
		}

	gTestCase++;
	return(KErrNone);
	}
Ejemplo n.º 4
0
static void
OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    switch (id)
    {
        case IDC_TEST1:
            DoTest1(hwnd);
            PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_TEST2, 0), 0);
            break;
        case IDC_TEST2:
            DoTest2(hwnd);
            PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_TEST3, 0), 0);
            break;
        case IDC_TEST3:
            DoTest3(hwnd);
            PostMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_END, 0), 0);
            break;
        case IDC_END:
            EndDialog(hwnd, IDOK);
            break;
    }
}
Ejemplo n.º 5
0
//=====================================================================================================================
int main (void)
{
	BYTE*	pReadBuffer;
	BYTE*	pWriteBuffer;
	DWORD	Version;

	PINSEL0		=	0;
	PINSEL1		=	0;

	Init_IO();
	CLK_Init();
	CLK_SetupTimer(cCLK_TimerBlink,	500,	Main_BlinkLED);

	CMD_Init((DWORD*)&pWriteBuffer,	(DWORD*)&pReadBuffer);


	IOCLR	=	cPB_LED1	+	cPB_LED2	+	cPB_LED3;
	while(1)
	{
		IOCLR	=	cPB_LED1;
		if	(!CMD_GetVersion((WORD*)(&Version)))
		{
			continue;
		}
		if	(!(CMD_Detect()))
		{	continue;	}
		IOSET	=	cPB_LED1;


		//等待But0按下,则开始写数据
		if	(IOPIN	&	cPB_BUT0)
		{	continue;	}

		DoTest2(pReadBuffer,	pWriteBuffer);

	}

}
Ejemplo n.º 6
0
/** Time the creation of a directory inside each type of directory with multiple threads ongoing

	@param aN Number of files in the directory
	@param aStep 	Test step
*/
LOCAL_C void MakeDirM(TInt aN, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
    TBuf16<100> dir4;
	
	TInt r = 0;
	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 
	
	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;
		
		dir4.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dir4);
		dir4.Format(KDirMultipleName2, 2, aN);
		dir2.Append(dir4);	
		dir4.Format(KDirMultipleName2, 3, aN);
		dir3.Append(dir4);
		
		if(gTypes >= 1) 
			{
			gDelEntryDir = dir1;
			gDelEntryDir2 = dir1;
			
			dir1.Append(KNewDir);
			DoTest2(DeleteEntryAccess);
			
			startTime.HomeTime();
			
			r = TheFs.MkDir(dir1);
			FailIfError(r);
			
			endTime.HomeTime();
			
			DoTestKill();
			
			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			
			TheFs.RmDir(dir1);
			}
		
		if(gTypes >= 2) 
			{
			gDelEntryDir = dir2;
			gDelEntryDir2 = dir2;
			dir2.Append(KNewDir);
			
			DoTest2(DeleteEntryAccess);

			startTime.HomeTime();

			r = TheFs.MkDir(dir2);
			FailIfError(r);
			
			endTime.HomeTime();
			DoTestKill();

			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			
			TheFs.RmDir(dir2);
			}
		
		if(gTypes >= 3) 
			{
			gDelEntryDir = dir3;
			gDelEntryDir2 = dir3;
			dir3.Append(KNewDir);
			DoTest2(DeleteEntryAccess);

			startTime.HomeTime();

			r = TheFs.MkDir(dir3);
			FailIfError(r);
			
			endTime.HomeTime();
			DoTestKill();

			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			
			TheFs.RmDir(dir3);
			}
		}
	
	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);

	}
Ejemplo n.º 7
0
BOOL cmdTest2(const char *tail)
{
	MSGLN("Test return: %s !", DoTest2() == U_SUCC ? "succ" : "failed");

	return TRUE;
}
Ejemplo n.º 8
0
/** Find last.txt by opening the file and with two threads accessing the current 
	directory and other one 

	@param aN Number of files in the directory
	@param aStep 	Test step
*/
LOCAL_C void FindFileMD2(TInt aN, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
	TBuf16<100> dir4;
	TBuf16<100> dirtemp;

	TInt r = 0;

	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 

	RFile file;
	
	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;

		dirtemp.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dirtemp);
		gFindDir = dir1;
		
		dirtemp.Format(KDirMultipleName2, 2, aN);
		dir2.Append(dirtemp);

		dirtemp.Format(KDirMultipleName2, 3, aN);
		dir3.Append(dirtemp);
			
		dir1.Append(KCommonFile);
		gFindEntryDir = dir1;
		
		dir4 = gSessionPath;
		dirtemp.Format(KDirMultipleName, 3, 300);
		dir4.Append(dirtemp);

		
		if(gTypes >= 1) 
			{	
			gFindDir2 = dir4;
			dir4.Append(KCommonFile);
			gFindEntryDir2 = dir4;

			DoTest2(FindEntryAccess);

			User::After(200);
			
			startTime.HomeTime();
			
			r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			
			timeTaken = endTime.MicroSecondsFrom(startTime);

			file.Close();
			DoTestKill();
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		
		if(gTypes >= 2) 
			{	
			gFindDir = dir2;
			dir2.Append(KCommonFile);
			gFindEntryDir = dir2;
			DoTest2(FindEntryAccess);
			
			User::After(200);
			startTime.HomeTime();

			r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			timeTaken = endTime.MicroSecondsFrom(startTime);
			file.Close();
			DoTestKill();
			
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
			
		if(gTypes >= 3) 
			{	
			gFindDir = dir3;	
			dir3.Append(KCommonFile);
			gFindEntryDir = dir3;
			DoTest2(FindEntryAccess);

			User::After(200);
			startTime.HomeTime();

			r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			timeTaken=endTime.MicroSecondsFrom(startTime);
			DoTestKill();
			
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			file.Close();
			}
		}

	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);
	}
Ejemplo n.º 9
0
/** Find last.txt with TFindFile and with two threads accessing the 2 directories

	@param aN Number of files in the directory
	@param aStep 	Test step
*/
LOCAL_C void FindFileMD1(TInt aN, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
    TBuf16<100> dir4;
    TBuf16<100> dirtemp;
	
	TInt r = 0;
	TFindFile find(TheFs);
	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 

	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;

		dirtemp.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dirtemp);

		dirtemp.Format(KDirMultipleName, 2, aN);
		dir2.Append(dirtemp);

		dirtemp.Format(KDirMultipleName, 3, aN);
		dir3.Append(dirtemp);
		
		dir4 = gSessionPath;
		dirtemp.Format(KDirMultipleName, 3, 300);
		
		dir4.Append(dirtemp);
		
		gFindDir = dir1;
		gFindDir2 = dir4;
		
		dir1.Append(KCommonFile);
		dir2.Append(KCommonFile);
		dir3.Append(KCommonFile);
		dir4.Append(KCommonFile);
		
		gFindEntryDir = dir1;
		gFindEntryDir2 = dir4;
		

		TheFs.SetSessionPath(gSessionPath);
		
		dir4.Format(KDirMultipleName, 1, aN);
		
		if(gTypes >= 1) 
			{	
			DoTest2(FindEntryAccess);

			startTime.HomeTime();
	 		r = find.FindByPath(dir1, &dir4);
			FailIfError(r);
			endTime.HomeTime();
			
			DoTestKill();
			
			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}

		if(gTypes >= 2) 
			{	
			dir4 = gSessionPath; 
			dirtemp.Format(KDirMultipleName, 2, aN);
			dir4.Append(dirtemp);
			gFindDir = dir4;
			gFindEntryDir=dir2;

			DoTest2(FindEntryAccess);
			dir4.Format(KDirMultipleName, 2, aN);
	
			startTime.HomeTime();

			r = find.FindByPath(dir2,&dir4);
			test(r==KErrNone);
			endTime.HomeTime();
			timeTaken=endTime.MicroSecondsFrom(startTime);
			DoTestKill();
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		
		if(gTypes>=3) 
			{	
			dir4 = gSessionPath; 
			dirtemp.Format(KDirMultipleName, 3, aN);
			dir4.Append(dirtemp);

			gFindDir = dir4;
			gFindEntryDir=dir2;
			
			DoTest2(FindEntryAccess);
			dir4.Format(KDirMultipleName, 3, aN);
		
			startTime.HomeTime();

			r=find.FindByPath(dir3,&dir4);
			test(r==KErrNone);
			
			endTime.HomeTime();
			DoTestKill();
			
			timeTaken=endTime.MicroSecondsFrom(startTime);
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		}
	
	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);
	}
Ejemplo n.º 10
0
/** Find last.txt with TFindFile and with two threads accessing the 2 directories

	@param aN 		Number of files in the directory
	@param aWild 	Wildcard string to be used in the search
	@param aStep 	Test step
*/
LOCAL_C void FindFileWild3(TInt aN, const TDesC& aWild, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
    TBuf16<100> dir4;
    TBuf16<100> temp;
    TBuf16<100> temp2;
	
	TInt r = 0;
	TFindFile find(TheFs);
	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 

	CDir* dir;

	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;
		
		dir4.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dir4);
			
		temp=gSessionPath;
		dir4.Format(KDirMultipleName, 3, 300);
		
		temp.Append(dir4);
		gFindDir = dir1;
		gFindDir2 = temp;
		
		temp2 = gFindDir;
		temp2.Append(KCommonFile);
		gFindEntryDir = temp2;
		temp2 = gFindDir2;
		temp2.Append(KCommonFile);
		gFindEntryDir2 = temp2;

		if(gTypes >= 1) 
			{	
			DoTest2(FindEntryAccess);
			
			dir4.Format(KDirMultipleName, 1, aN);
			startTime.HomeTime();
			
			r = find.FindWildByPath(aWild, &dir1, dir);
			FailIfError(r);
			
			endTime.HomeTime();
			DoTestKill();
			delete dir;
			
			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		
		if(gTypes >= 2) 
			{	
			dir4.Format(KDirMultipleName2, 2, aN);
			dir2.Append(dir4);

			temp = dir2;
			temp.Append(KCommonFile);
			gFindDir = dir2;
			gFindEntryDir = temp;

			DoTest2(FindEntryAccess);

			startTime.HomeTime();

			r = find.FindWildByPath(aWild, &dir2, dir);
			FailIfError(r);
			
			endTime.HomeTime();
			DoTestKill();
			delete dir;
	
			timeTaken = endTime.MicroSecondsFrom(startTime);	
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
			
		if(gTypes >= 3) 
			{	
			dir4.Format(KDirMultipleName2, 3, aN);
			dir3.Append(dir4);

			temp = dir3;
			temp.Append(KCommonFile);
			gFindDir = dir3;
			gFindEntryDir = temp;
			
			DoTest2(FindEntryAccess);

			startTime.HomeTime();

			r = find.FindWildByPath(aWild, &dir3, dir);
			FailIfError(r);
			
			endTime.HomeTime();
			DoTestKill();
			delete dir;
			
			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		}
	
	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);
	}