/** @SYMTestCaseID SYSLIB-BAFL-CT-0440 @SYMTestCaseDesc Resource reader test @SYMTestPriority High @SYMTestActions Executes all the tests related to resource read @SYMTestExpectedResults Tests must not fail @SYMREQ REQ0000 */ void RunTests() { test.Start(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0440 Resource reader ")); TheFs.Connect(); TheResourceFile.OpenL(TheFs,KRomResourceFile); TRsReadTester lt; TRAPD(errCode, lt.TestButtonL()); test(errCode==KErrNone); TRAP(errCode, lt.TestArrayL()); test(errCode==KErrNone); TRAP(errCode, lt.TestFlPtEdL()); test(errCode==KErrNone); TRAP(errCode, lt.TestMenuBarL()); test(errCode==KErrNone); TRAP(errCode, lt.TestAlignment1L()); test(errCode==KErrNone); TRAP(errCode, lt.TestAlignment2L()); test(errCode==KErrNone); TRAP(errCode, lt.TimingTestsL()); test(errCode==KErrNone); TheResourceFile.Close(); //Test that raises panics test(KErrNone==lt.PanicTests()); TheFs.Close(); test.End(); test.Close(); }
TInt E32Main() { __UHEAP_MARK; test.Start(_L("@SYMTESTCaseID:PIM-TCAL-DELETE-0001 Calendar Interim API Delete test suite")); test.Title(); CTrapCleanup* trapCleanup = CTrapCleanup::New(); if (!trapCleanup) { return KErrNoMemory; } CActiveScheduler* scheduler = new CActiveScheduler(); if (!scheduler) { delete trapCleanup; return KErrNoMemory; } CActiveScheduler::Install(scheduler); TRAPD(ret, DoTestL()); test(ret == KErrNone); delete scheduler; delete trapCleanup; test.End(); test.Close(); __UHEAP_MARKEND; return (KErrNone); }
void TAddressParms::SelfTest() { test.Start(_L("SelfTest of TAddressParms")); const TAddressParms pA(0, 32, 8); test(pA == pA); test(pA.Overlaps(pA)); const TAddrRange rA(4, 8); const TAddrRange rB(16, 8); const TAddrRange rC(28, 8); const TAddrRange rD(4, 32); test(pA.Overlaps(rA)); test(!pA.Overlaps(rB)); test(pA.Overlaps(rC)); test(pA.Overlaps(rD)); const TAddressParms pB(8, 16, 8); test(!(pA == pB)); test(!(pB == pA)); test(!pA.Overlaps(pB)); test(!pB.Overlaps(pA)); const TAddressParms pC(8, 28, 8); test(pC.Overlaps(pA)); test(pC.Overlaps(pB)); const TAddressParms pD(0, 128, 64); test(pD.Overlaps(pA)); test(pD.Overlaps(pB)); test(pD.Overlaps(pC)); test.End(); }
TInt E32Main() { __UHEAP_MARK; CTrapCleanup* tc = CTrapCleanup::New(); TEST(tc != NULL); TEST2(TheFileSess.Connect(), KErrNone); TheTest.Title(); TRAPD(err, ::MainL()); TEST2(err, KErrNone); TheTest.End(); TheTest.Close(); TheFileSess.Close(); delete tc; __UHEAP_MARKEND; User::Heap().Check(); return KErrNone; }
GLDEF_C TInt E32Main() // // Test Help file loading // { __UHEAP_MARK; TheTest.Title(); TheTest.Start(_L("@SYMTestCaseID PIM-TLOADER-0001")); TheTest(TheFs.Connect() == KErrNone); TheTrapCleanup = CTrapCleanup::New(); if (!TheTrapCleanup) return KErrNoMemory; TRAPD(r, TestL()); TheTest(r == KErrNone); delete TheTrapCleanup; TheFs.Close(); TheTest.End(); TheTest.Close(); __UHEAP_MARKEND; return KErrNone; }
TInt E32Main() { __UHEAP_MARK; ::KillEComServerL(); CTrapCleanup* tc = CTrapCleanup::New(); TEST(tc != NULL); TEST2(TheFs.Connect(), KErrNone); CActiveScheduler* activeSched = new CActiveScheduler; TEST(activeSched != NULL); CActiveScheduler::Install(activeSched); TheTest.Title(); TRAPD(err, ::DoTestL()); TEST2(err, KErrNone); ResetSsa(TheTest, TheFs); TheTest.End(); TheTest.Close(); delete activeSched; TheFs.Close(); delete tc; __UHEAP_MARKEND; User::Heap().Check(); return KErrNone; }
LOCAL_C void ScanDirL(RFs& aFs, const TDesC& aDir) { User::After(1000000); TParse parse; parse.Set(_L("t_*.exe"), &aDir, NULL); TPtrC spec(parse.FullName()); test.Start(parse.DriveAndPath()); TFindFile find(aFs); CDir* dir; if (!find.FindWildByPath(parse.FullName(), NULL, dir)) { CleanupStack::PushL(dir); for(int i = 0; i < dir->Count(); i++) { parse.Set((*dir)[i].iName, &spec, NULL); if (i == 0) test.Start(parse.FullName()); else test.Next(parse.FullName()); LaunchAndWaitL(parse.FullName()); } CleanupStack::PopAndDestroy(); // dir } test.End(); }
static void TestAddUsage() /** Test adding usages with the session. See in-function comments for specific test cases. */ { test.Start(_L("TestAddUsage")); // IMPORT_C TInt AddUsage(TKeyHandle aHandle, TInt aOperation, const TSecurityPolicy& aSecPol); TInt r; // success case _LIT_SECURITY_POLICY_S0(KSecPolSidTestProc, 0xE04E4147); r = kms.AddUsage(StoreHandle0, KOperationX, KSecPolSidTestProc); test(r == KErrNone); // failure case - key not found r = kms.AddUsage(GenHandle0, KOperationX, KSecPolSidTestProc); test(r == KErrNotFound); // failure case - bad sec pol handle TestPanic(TestAddUsageInvalidSecPolPointer, EBadClientDescriptor); test.End(); }
static void TestDeleteUsage() /** Test deleting usages with the session. See in-functino comments for specific test cases. */ { test.Start(_L("TestDeleteUsage")); // IMPORT_C TInt DeleteUsage(TKeyHandle aHandle, TInt aOperation); TInt r; // success case r = kms.DeleteUsage(StoreHandle0, KOperationX); test(r == KErrNone); // failure case - key not found r = kms.DeleteUsage(GenHandle0, KOperationX); test(r == KErrNotFound); // failure case - usage not found r = kms.DeleteUsage(StoreHandle0, KOperationX); test(r == KErrNotFound); test.End(); }
static void TestGenerateKey() /** Test generating keys with the session. See in-function comments for specific test cases. */ { test.Start(_L("TestGenerateKey")); // IMPORT_C TInt GenerateKey(TInt aLength, TKeyHandle& aHandle); TInt r; // success case - key should be created r = kms.GenerateKey(3, GenHandle0); test(r == KErrNone); // faiure case bad length, reported by LDD TKeyHandle kh; r = kms.GenerateKey(-3, kh); test(r == KErrArgument); // failure case - bad handle pointer sent to server TestPanic(TestGenerateKeyInvalidHandlePointer, EBadClientDescriptor); // OOM not really required because server does not allocate any memory // to generate a key. RunOomTest(TestGenKeyInOom, CleanUpKeyGenInOom); test.End(); }
static void TestStoreKey() /** Test storing keys with the session. See in-function comments for specific test cases. */ { test.Start(_L("TestStoreKey")); // IMPORT_C TInt StoreKey(const TDesC8& aData, TKeyHandle& aHandle); TInt r; // success case - key is stored r = kms.StoreKey(KStoreKeyData, StoreHandle0); test(r == KErrNone); // failure case - bad length reported by LDD TKeyHandle kh; r = kms.StoreKey(KNullDesC8, kh); test(r == KErrArgument); // failure case - bad descriptor sent to server TestPanic(TestStoreKeyInvalidDataDescriptor, EBadClientDescriptor); // failure case - bad handle pointer TestPanic(TestStoreKeyInvalidHandlePointer, EBadClientDescriptor); // OOM RunOomTest(TestStoreKeyInOom, CleanUpStoreGenInOom); test.End(); }
static void TestOpenClose() /** Open and close a connection to the key management server, but do not do anything with it. */ { test.Start(_L("TestOpenClose")); RKeyMgmtSession s; TInt r = s.Connect(); test(r == KErrNone); s.Close(); // open with a lower-than-supported version TVersion v = KeyMgmtSvrImpl::Version(); --v.iMajor; r = s.Connect(v); test(r == KErrNone); s.Close(); // open with the supported version ++v.iMajor; r = s.Connect(v); test(r == KErrNone); s.Close(); // open with greater-than-supported version ++v.iMajor; r = s.Connect(v); test(r == KErrNotSupported); test.End(); }
TInt E32Main() { TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); __UHEAP_MARK; CreateTestDir(); DeleteTestFiles(); TRAPD(err, DoTestsL()); DeleteTestFiles(); TEST2(err, KErrNone); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete tc; User::Heap().Check(); return KErrNone; }
TInt E32Main() { test.Title(); test.Start(_L("Testing ldd importing")); test.Next(_L("Load the exporting ldd")); TInt r=User::LoadLogicalDevice(KExportTestLddName); test_Equal(KErrNone, r); // Don't allow KErrAlreadyExists as don't want ldd to be XIP. RExportLdd exportLdd; test_KErrNone(exportLdd.Open()); // The exported function multiplies the 2 arguments. test_Equal(12, exportLdd.RunExport(3, 4)); test.Next(_L("Load the importing ldd")); r=User::LoadLogicalDevice(KImportTestLddName); test_Equal(KErrNone, r); // Don't allow KErrAlreadyExists as don't want ldd to be XIP. RImportLdd importLdd; test_KErrNone(importLdd.Open()); // The imported function multiplies the 2 arguments. test_Equal(12, importLdd.RunImport(3, 4)); exportLdd.Close(); importLdd.Close(); test_KErrNone(User::FreeLogicalDevice(KExportTestLddName)); test_KErrNone(User::FreeLogicalDevice(KImportTestLddName)); test.End(); return KErrNone; }
//--------------------------------------------- //! @SYMTestCaseID PBASE-T_NOTIFY-2457 //! @SYMTestType PT/UT //! @SYMREQ PREQ1847 //! @SYMTestCaseDesc Performance Test – Multiple File Server Sessions, this is only a part of the test case. //! It is executed as a functional test here. This test case is also run as performance test in t_notify_perf //! @SYMTestActions Perform a series of file operations, create multiple notification threads to collect the notifications. //! @SYMTestExpectedResults No notifications are missed //! @SYMTestPriority High //! @SYMTestStatus Implemented //--------------------------------------------- LOCAL_C void MultipleFileSessionTestL() { test.Start(_L("T_NOTIFY_MFS - Test Preparation")); gPerfMeasure = EFalse; SetTestPaths(); DeleteLogFilesL(); // Does not write log file but need create the log folder for test stopper to use const TInt KNumFiles = 10; const TInt KNumClients = 4; test.Next(_L("Single Notification on all clients")); ClearTestPathL(); TTestSetting setting (KNumFiles, KNumClients, (EEnhanced|EBigBuffer), KDefaultOpList); CTestExecutor testcase (setting); testcase.RunTestCaseL(); test.Next(_L("Multi notifications Mode 1, enhanced notification")); ClearTestPathL(); setting.iOption = (EEnhanced|EBigBuffer|EMultiNoti1); testcase.SetTestSetting(setting); testcase.RunTestCaseL(); test.Next(_L("Multi notifications Mode 2, enhanced notification")); ClearTestPathL(); setting.iOption = (EEnhanced|EBigBuffer|EMultiNoti2); testcase.SetTestSetting(setting); testcase.RunTestCaseL(); test.Next(_L("Test finishing - clearing test path")); ClearTestPathL(); test.End(); }
TInt E32Main() { TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); TheTest(tc != NULL); __UHEAP_MARK; GetCmdLineParamsAndSqlConfigString(TheTest, _L("t_sqlperformance4"), TheCmdLineParams, TheSqlConfigString); PrepareDbName(KCDriveDatabase, TheCmdLineParams.iDriveName, TheDbFileName); TheTest.Printf(_L("==Databases: %S\r\n"), &TheDbFileName); TestEnvInit(); DoTests(); TestEnvDestroy(); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete tc; User::Heap().Check(); return KErrNone; }
TInt E32Main() { TheSqliteDb = NULL; TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); __UHEAP_MARK; CreateTestEnv(); TInt err = sqlite3SymbianLibInit(); TEST2(err, KErrNone); DoTests(); sqlite3SymbianLibFinalize(); DestroyTestEnv(); CloseSTDLIB(); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete tc; User::Heap().Check(); return KErrNone; }
LOCAL_C void FuncBasicTestsL() { TheTest.Start(_L("Open/Close repository")); OpenRepositoryL(); TheTest.Next(_L("Get/Set")); GetSetL(); TheTest.Next(_L("Find")); FindL(); TheTest.Next(_L("Notify")); NotifyL(); TheTest.Next(_L("Create/Delete")); CreateDeleteL(); TheTest.Next(_L("Multiple clients")); MultiClientL(); TheTest.Next(_L("Restore factory settings")); ResetL(); TheTest.End(); }
TInt E32Main() { TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); TheTest(tc != NULL); __UHEAP_MARK; TestEnvInit(); DeleteTestFiles(); TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1650 OS porting layer tests")); DoTests(); TestEnvDestroy(); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete tc; User::Heap().Check(); return KErrNone; }
LOCAL_C void FuncTransactionTestsL() { TheTest.Start(_L("Open/Close repository")); OpenRepositoryL(); TheTest.Next(_L("Create/Set Int Transaction")); CreateSetIntTransactionL(); TheTest.Next(_L("Create/Set Real Transaction")); CreateSetRealTransactionL(); TheTest.Next(_L("Create/Set Descriptor Transaction")); // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. ::ResetModifiedRepsL(); CreateSetDesTransactionL(); TheTest.Next(_L("Restore factory settings")); ResetTransactionL(); TheTest.End(); }
TInt E32Main() { test.Title(); test.Start(_L("Test does not run on UREL builds.")); test.End(); return 0; }
/** @SYMTestCaseID SYSLIB-CENREP-CT-0032 @SYMTestCaseDesc BasicPlatsecTestsL() function calls test for the Secure Cenrep (setting). Methods of CRepository class are called for various combination of different settings and the results are asserted. @SYMTestPriority High @SYMTestActions BasicPlatsecTestsL() method calls test. @SYMTestExpectedResults The test must not fail. @SYMPREQ PREQ277 PREQ280 */ LOCAL_C void BasicPlatsecTestsL() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENREP-CT-0032 Basic functional tests for PlatSec ")); OomTesting = EFalse; // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. RepsToReset.AppendL(KUidPlatsecTestRepository); RepsToReset.AppendL(KUidTransactionTestRepository); RepsToReset.AppendL(KUidResetTestRepository); ::ResetModifiedRepsL(); FuncBasicTestsL(); TheTest.Next(_L("Basic Out-of-memory tests")); // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. ::ResetModifiedRepsL(); OomTesting = ETrue; TheTest.Next(_L("OOM Open/Close repository")); OomTest(OpenRepositoryL); GetSetL(); TheTest.Next(_L("OOM Find")); OomTest(FindL); TheTest.End(); }
//--------------------------------------------------------------------------------- void MainL(void) { test.Start(_L("Kern Perf Logger tests")); Initialise(); RBTrace trace; TInt error = trace.Open(); test(error == KErrNone); trace.Empty(); trace.SetFilter(BTrace::EThreadIdentification,0); //-- actually, for hardware platforms, the testing category and trace enabling //-- may be set up in appropriate "header.iby" file trace.SetMode(RBTrace::EEnable); trace.SetFilter(BTrace::EKernPerfLog, ETrue); //-- unit-test for PERF_LOG macros TestMacros(trace); //-- functionality test TestPerfLogger(trace); trace.Close(); Finalise(); test.End(); }
TInt E32Main() { test.Title(); // Turn off evil lazy dll unloading RLoader l; test(l.Connect()==KErrNone); test(l.CancelLazyDllUnload()==KErrNone); l.Close(); test.Start(_L("Preload t_oedll1.dll")); RLibrary library; test(library.Load(_L("t_oedll1.dll")) == KErrNone); test.Next(_L("Run T_OEEXPORT.EXE...")); RProcess p; TInt r=p.Create(_L("T_OEEXPORT.EXE"), _L("2")); test(r==KErrNone); TRequestStatus s; p.Logon(s); p.Resume(); User::WaitForRequest(s); TExitCategoryName aExitCategory = p.ExitCategory(); test.Printf(_L("Second test exits with: %d,%d,%S\n"),p.ExitType(),p.ExitReason(),&aExitCategory); test(p.ExitType()==EExitKill); test(p.ExitReason()==0); p.Close(); library.Close(); test.End(); return KErrNone; }
TInt E32Main() { __UHEAP_MARK; CTrapCleanup* tc = CTrapCleanup::New(); TEST(tc != NULL); TInt err = TheDbs.Connect(); TEST2(err, KErrNone); TBuf<32> format; TheTest.Printf(_L("Open database\n")); format.Copy(KSecure); format.Append(KSecureDbUid.Name()); err = TheDb.Open(TheDbs, KDbName, format); TEST2(err, KErrNone); TRAP(err, DoTestL()); TEST2(err, KErrNone); TheView.Close(); TheTbl.Close(); TheDb.Close(); TheDbs.Close(); TheTest.End(); TheTest.Close(); delete tc; __UHEAP_MARKEND; User::Heap().Check(); return KErrNone; }
void TTestMsBlock::tFileAccess() { test.Start(_L("tFileAccess\n")); test.Next(_L("DriveInfo")); PrintDrvInfo(fsSession, msDrive->DriveNumber()); TVolumeInfo volInfo; TInt err = fsSession.Volume(volInfo); test(err == KErrNone); test.Printf(_L("Memory 'in use' = %lx\n"), (volInfo.iSize - volInfo.iFree)); test.Printf(_L("volInfo.iSize = %lx\n"), volInfo.iSize); test.Printf(_L("volInfo.iFree = %lx\n"), volInfo.iFree); //-- 1. create a file _LIT(KFile, "\\test_file.file"); const TUint KFileSz = 54321; test.Next(_L("Write file\n")); err = CreateCheckableStuffedFile(fsSession, KFile, KFileSz); test_KErrNone(err); //-- 2. verify the file, just in case. test.Next(_L("Verify file\n")); err = VerifyCheckableFile(fsSession, KFile); test_KErrNone(err); //-- 3. delete the file test.Next(_L("Delete file\n")); fsSession.Delete(KFile); test.End(); }
TInt E32Main() /** Executable entrypoint calls test functions within heap check. */ { test.Title(); test.Start(_L("Testing RLoader::Delete")); __UHEAP_MARK; const TUint32 KTcbMask = 1UL << ECapabilityTCB; const TUint32 KAllFilesMask = 1UL << ECapabilityAllFiles; //Check whether RLoader::Delete handles the case of a bad descriptor being passed //as the filename( KBadDescriptor is not itself the malformed desciptor but //it trigers the check) TestWithCaps(KTcbMask | KAllFilesMask , KErrBadDescriptor, KBadDescriptor); // TCB | AllFiles sufficient without any other caps TestWithCaps(KTcbMask | KAllFilesMask, KErrNone); // TCB necessary TestWithCaps(~KTcbMask, KErrPermissionDenied); // AllFiles necessary TestWithCaps(~KAllFilesMask, KErrPermissionDenied); // neither TCB nor AllFiles TestWithCaps(~(KTcbMask | KAllFilesMask), KErrPermissionDenied); TestWithCaps(0, KErrPermissionDenied); __UHEAP_MARKEND; test.End(); return KErrNone; }
TInt E32Main() { CTrapCleanup* tc = CTrapCleanup::New(); if(!tc) { User::Panic(KPanicCategory, KErrNoMemory) ; } __UHEAP_MARK; TheTest.Title(); TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-LEGACY-T_SQLITEWSD2-0001 ")); CreateTestEnv(); DoInserts(KWsdProc2Id, KWsdProc2RecId1, KWsdProc2RecId2); DestroyTestEnv(); TheTest.End(); TheTest.Close(); __UHEAP_MARKEND; delete tc; User::Heap().Check(); return KErrNone; }
void RArrayCopyTestL() { test.Start(_L("Selftest of RArray CopyL")); RArray<TInt> orig; TInt i; // VC++ for(i=0; i<10; i++) { orig.AppendL(i); } RArray<TInt> newArray; CopyL(orig, newArray); test_Equal(10, newArray.Count()); for(i=0; i<10; i++) { test_Equal(orig[i], newArray[i]) } orig.Close(); newArray.Close(); test.End(); }
TInt E32Main() { TheTest.Title(); __UHEAP_MARK; CTrapCleanup* trapCleanup = CTrapCleanup::New(); TEST(trapCleanup != NULL); DeleteLargeDataFiles(); TInt err = TheFs.Connect(); TEST2(err, KErrNone); SetupTestDirectory(); TRAP(err, RunTestsL()); TheDb.Close(); TheDbSession.Close(); TheFs.Close(); TEST2(err, KErrNone); DeleteDataFiles();//delete the data files used by this test TheTest.End(); TheTest.Close(); delete trapCleanup; __UHEAP_MARKEND; return 0; }