systemhealthmanagement/systemhealthmgr/test/tsysmon/src/tsysmon_app_faileiofcount1fail.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17  @file
    17  @file
    18  @test
    18  @test
    19  @internalComponent - Internal Symbian test code   
    19  @internalComponent - Internal Symbian test code   
    20 */
    20 */
    21 
    21 
    22 #include <e32property.h>
       
    23 #include "sysmontesthelper.h"
    22 #include "sysmontesthelper.h"
    24 const TUint32 KRestartExeCount = 34;
    23 
    25 
    24 
    26 TInt MainL()
    25 TInt MainL()
    27 	{
    26 	{
    28 	RDebug::Print(_L("appfwk-sysmon-0034: MainL"));
    27 	RDebug::Print(_L("appfwk-sysmon-0034: MainL"));
    29 
    28 
    30 	TInt runCount = 0;
    29 	TInt runCount = 0;
    31     CCommandLineArguments* args = CCommandLineArguments::NewLC();
    30     CCommandLineArguments* args = CCommandLineArguments::NewLC();
    32     TInt err = RProperty::Define(KTestSysMon, KRestartExeCount, RProperty::EInt);
       
    33     RDebug::Printf("Defining P&S key with key %d returns with err %d", err, KRestartExeCount);
       
    34     runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
    31     runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
    35 	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    32 	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    36     CleanupStack::PopAndDestroy(args);
    33     CleanupStack::PopAndDestroy(args);
    37 
    34 
    38     
    35     
    43 			RProcess::Rendezvous(KErrNone);
    40 			RProcess::Rendezvous(KErrNone);
    44 			RSysMonSession sysmon;
    41 			RSysMonSession sysmon;
    45 			sysmon.OpenL();
    42 			sysmon.OpenL();
    46 			CleanupClosePushL(sysmon);
    43 			CleanupClosePushL(sysmon);
    47 
    44 
    48 			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_dontrendezvous.exe"), _L("34"));
    45 			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_dontrendezvous.exe"), KNullDesC);
    49 			props->SetMonitored(ETrue);
    46 			props->SetMonitored(ETrue);
    50 			props->SetStartupType(EStartProcess);
    47 			props->SetStartupType(EStartProcess);
    51 			props->SetStartMethod(EWaitForStart);
    48 			props->SetStartMethod(EWaitForStart);
    52 			props->SetNoOfRetries(1);
    49 			props->SetNoOfRetries(1);
    53 			props->SetTimeout(0);
    50 			props->SetTimeout(0);
    54 			props->SetRecoveryParams(EIgnoreOnFailure, 0);
    51 			props->SetRecoveryParams(EIgnoreOnFailure, 0);
    55 			
    52 			
    56 			RProcess slave1;
    53 			RProcess slave1;
    57 			slave1.Create(_L("tsysmon_app_dontrendezvous.exe"), _L("5000"));
    54 			slave1.Create(_L("tsysmon_app_dontrendezvous.exe"), _L("5000"));
    58 			CleanupClosePushL(slave1);
    55 			CleanupClosePushL(slave1);
    59 			TRequestStatus status;
       
    60 			slave1.Rendezvous(status);
       
    61 			slave1.Resume();
    56 			slave1.Resume();
    62 			User::WaitForRequest(status);
       
    63 
    57 
    64 			// Register with SysMon
    58 			// Register with SysMon
    65 			sysmon.MonitorL(*props, slave1);
    59 			sysmon.MonitorL(*props, slave1);
    66 			slave1.Terminate(KErrNone);
    60 			slave1.Terminate(KErrNone);
    67 			CleanupStack::PopAndDestroy(3, &sysmon);
    61 			CleanupStack::PopAndDestroy(3, &sysmon);