kerneltest/e32test/mmu/t_shbuf.cpp
changeset 109 b3a1d9898418
parent 90 947f0dc9f7a8
child 201 43365a9b78a3
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    36 
    36 
    37 const TInt KTestPoolSizeInBytes = 1 << 20; // 1MB
    37 const TInt KTestPoolSizeInBytes = 1 << 20; // 1MB
    38 const TInt BufferSize[] = {128, 853, 4096, 5051, 131072, 1, 0}; // Last element must be 0
    38 const TInt BufferSize[] = {128, 853, 4096, 5051, 131072, 1, 0}; // Last element must be 0
    39 
    39 
    40 const TInt* PtrBufSize;
    40 const TInt* PtrBufSize;
       
    41 
       
    42 static TInt ThreadCounter = 0;
    41 
    43 
    42 RShBufTestChannel Ldd;
    44 RShBufTestChannel Ldd;
    43 
    45 
    44 _LIT(KTestSlave, "SLAVE");
    46 _LIT(KTestSlave, "SLAVE");
    45 _LIT(KTestLowSpaceSemaphore, "LowSpaceSemaphore");
    47 _LIT(KTestLowSpaceSemaphore, "LowSpaceSemaphore");
  1870  * CancelLowSpaceNotification() no longer panic()s if it can't find the
  1872  * CancelLowSpaceNotification() no longer panic()s if it can't find the
  1871  * notification, so this routine not currently called.
  1873  * notification, so this routine not currently called.
  1872  */
  1874  */
  1873 void RequestLowSpacePanic(RShPool& aPool, TUint aThreshold1, TUint aThreshold2, TTestLowSpaceType aType, TInt aLine)
  1875 void RequestLowSpacePanic(RShPool& aPool, TUint aThreshold1, TUint aThreshold2, TTestLowSpaceType aType, TInt aLine)
  1874 	{
  1876 	{
  1875 	static TInt count = 0;
  1877 	TBuf<40> threadname;
  1876 	count++;
  1878 	threadname.Format(_L("ThreadLowSpacePanic%d"), ++ThreadCounter);
  1877 	test.Printf(_L("RequestLowSpacePanic@%d(%d)\n"), aLine, count);
  1879 	test.Printf(_L("RequestLowSpacePanic@%d(%S)\n"), aLine, &threadname);
  1878 	TBool jit = User::JustInTime();
  1880 	TBool jit = User::JustInTime();
  1879 	User::SetJustInTime(EFalse);
  1881 	User::SetJustInTime(EFalse);
  1880 	TInt expectedpaniccode = KErrNone;	// Initialised to silence compiler warnings
  1882 	TInt expectedpaniccode = KErrNone;	// Initialised to silence compiler warnings
  1881 	switch (aType)
  1883 	switch (aType)
  1882 		{
  1884 		{
  1895 	targs.iType = aType;
  1897 	targs.iType = aType;
  1896 	//
  1898 	//
  1897 	RThread threadpanic;
  1899 	RThread threadpanic;
  1898 	TRequestStatus threadpanicrs;
  1900 	TRequestStatus threadpanicrs;
  1899 	TInt r;
  1901 	TInt r;
  1900 	TBuf<30> threadname;
       
  1901 	threadname.Format(_L("ThreadLowSpacePanic%d"), count);
       
  1902 	r = threadpanic.Create(threadname, ThreadLowSpacePanic, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &targs);
  1902 	r = threadpanic.Create(threadname, ThreadLowSpacePanic, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &targs);
  1903 	test_KErrNone(r);
  1903 	test_KErrNone(r);
  1904 	threadpanic.Logon(threadpanicrs);
  1904 	threadpanic.Logon(threadpanicrs);
  1905 	threadpanic.Resume();
  1905 	threadpanic.Resume();
  1906 	User::WaitForRequest(threadpanicrs);
  1906 	User::WaitForRequest(threadpanicrs);
  1923 	RTimer timer;
  1923 	RTimer timer;
  1924 	r = timer.CreateLocal();
  1924 	r = timer.CreateLocal();
  1925 	test_KErrNone(r);
  1925 	test_KErrNone(r);
  1926 	RThread thread;
  1926 	RThread thread;
  1927 	TRequestStatus threadrs;
  1927 	TRequestStatus threadrs;
  1928 	r = thread.Create(_L("ThreadNotifications"), ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
  1928 	TBuf<40> threadname;
       
  1929 	threadname.Format(_L("ThreadNotifications%d"), ++ThreadCounter);
       
  1930 	test.Printf(_L("Create %S\n"), &threadname);
       
  1931 	r = thread.Create(threadname, ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
  1929 	test_KErrNone(r);
  1932 	test_KErrNone(r);
  1930 	thread.SetPriority(EPriorityMore);
  1933 	thread.SetPriority(EPriorityMore);
  1931 	thread.Logon(threadrs);
  1934 	thread.Logon(threadrs);
  1932 
  1935 
  1933 	test.Printf(_L("Low space notification\n"));
  1936 	test.Printf(_L("Low space notification\n"));
  2075 	TInt r;
  2078 	TInt r;
  2076 
  2079 
  2077 	RSemaphore sem;
  2080 	RSemaphore sem;
  2078 	r = sem.CreateGlobal(KTestLowSpaceSemaphore, 0);
  2081 	r = sem.CreateGlobal(KTestLowSpaceSemaphore, 0);
  2079 	test_KErrNone(r);
  2082 	test_KErrNone(r);
       
  2083 
       
  2084 	TBuf<40> threadname;
       
  2085 	threadname.Format(_L("ThreadCancelNotifications%d"), ++ThreadCounter);
       
  2086 	test.Printf(_L("Create %S\n"), &threadname);
  2080 	RThread thread;
  2087 	RThread thread;
  2081 	TRequestStatus threadrs;
  2088 	TRequestStatus threadrs;
  2082 	r = thread.Create(_L("ThreadCancelNotifications"), ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
  2089 	r = thread.Create(threadname, ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
  2083 	test_KErrNone(r);
  2090 	test_KErrNone(r);
  2084 	thread.SetPriority(EPriorityLess);
  2091 	thread.SetPriority(EPriorityLess);
  2085 	thread.Logon(threadrs);
  2092 	thread.Logon(threadrs);
  2086 
  2093 
  2087 	test.Printf(_L("Cancel low space notifications\n"));
  2094 	test.Printf(_L("Cancel low space notifications\n"));