sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32test\fsstress\t_sess.cpp sl@0: // sl@0: // sl@0: sl@0: #include "t_sess.h" sl@0: sl@0: #include "t_server.h" sl@0: #include "t_chlffs.h" sl@0: sl@0: GLDEF_D RTest test(_L("T_SESS")); sl@0: GLDEF_D TFileName gTestSessionPath; sl@0: sl@0: // These objects are too large to be placed on the stack - ~15 sessions is enough sl@0: // to cause a stack overflow on ARM4. sl@0: const TInt KMaxNumberSessions=25; sl@0: RFs gSession[KMaxNumberSessions]; sl@0: TSessionTest gTestObject[KMaxNumberSessions]; sl@0: sl@0: sl@0: LOCAL_C void SetSessionPath(RFs aFs,TChar aDriveLetter) sl@0: // sl@0: // Set the session path for a RFs connection to aDrive sl@0: // sl@0: { sl@0: gTestSessionPath=(_L("?:\\SESSION_TEST\\")); sl@0: gTestSessionPath[0]=(TText)aDriveLetter; sl@0: TInt r=aFs.SetSessionPath(gTestSessionPath); sl@0: test(r==KErrNone); sl@0: r=aFs.MkDirAll(gTestSessionPath); sl@0: test(r==KErrNone || r==KErrAlreadyExists); sl@0: } sl@0: sl@0: sl@0: GLDEF_C void CallTestsL() sl@0: // sl@0: // This test makes a number of fileserver connections (sessions) sl@0: // The fileserver is stressed by running these sessions concurrently, swapping sl@0: // between them whilst testing various fileserver API functions sl@0: // Further testing of the fileserver is performed by closing connections one by sl@0: // one whilst ensuring their closure does not affect the other connected sessions sl@0: // sl@0: { sl@0: test.Title(); sl@0: sl@0: TChar driveLetter; sl@0: if (IsSessionDriveLFFS(TheFs,driveLetter)) sl@0: { sl@0: test.Printf(_L("CallTestsL: Skipped: test does not run on LFFS.\n")); sl@0: return; sl@0: } sl@0: sl@0: test.Start(_L("Starting T_SESSION tests...")); sl@0: sl@0: // Create an array of fileserver sessions sl@0: // Create an array of TSessionTest objects sl@0: sl@0: TInt i=0; sl@0: sl@0: TInt r; sl@0: for (; i