commands/testexecute/testexecute.cpp
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Thu, 26 Aug 2010 00:49:35 +0100
changeset 45 534b01198c2d
parent 5 9c58252c6740
permissions -rw-r--r--
Added ENotifyKeypresses and ECaptureCtrlC flags to CCommandBase. Commands can now get keypresses and handle ctrl-C via callbacks instead of having to implement custom active objects. As part of this extended the CCommandBase extension interface to MCommandExtensionsV2 for the new virtual functions KeyPressed(TUint aKeyCode, TUint aModifiers) and CtrlCPressed(). sudo now cleans up correctly by using ECaptureCtrlC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     1
// testexecute.cpp
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     2
// 
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     3
// Copyright (c) 2010 Accenture. All rights reserved.
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     4
// This component and the accompanying materials are made available
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     5
// under the terms of the "Eclipse Public License v1.0"
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     6
// which accompanies this distribution, and is available
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     8
// 
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     9
// Initial Contributors:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    10
// Accenture - Initial contribution
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    11
//
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    12
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    13
#include <fshell/memoryaccesscmd.h>
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    14
#include <fshell/descriptorutils.h>
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    15
#include "proxyserver.h"
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    16
#include <test/testexecutelogger.h>
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    17
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    18
using namespace IoUtils;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    19
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    20
class CCmdTestExecute : public CMemoryAccessCommandBase, public MMessageHandler
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    21
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    22
public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    23
	static CCommandBase* NewLC();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    24
	~CCmdTestExecute();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    25
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    26
	CCmdTestExecute();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    27
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    28
private: // From MMessageHandler
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    29
	virtual TBool HandleMessageL(CProxySession* aSession, const RMessage2& aMessage);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    30
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    31
private: // From CCommandBase.
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    32
	virtual const TDesC& Name() const;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    33
	virtual void DoRunL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    34
	virtual void ArgumentsL(RCommandArgumentList& aArguments);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    35
	virtual void OptionsL(RCommandOptionList& aOptions);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    36
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    37
private: // From CActive
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    38
	void RunL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    39
	void DoCancel();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    40
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    41
	class CLogonCompleter : public CActive
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    42
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    43
	public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    44
		CLogonCompleter(CCmdTestExecute* aCommand) : CActive(CActive::EPriorityStandard), iCommand(aCommand)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    45
			{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    46
			CActiveScheduler::Add(this);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    47
			iCommand->iTefProc.Logon(iStatus);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    48
			SetActive();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    49
			}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    50
		void RunL() { iCommand->Complete(iStatus.Int()); }
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    51
		void DoCancel() { iCommand->iTefProc.LogonCancel(iStatus); }
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    52
		~CLogonCompleter() { Cancel(); }
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    53
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    54
	private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    55
		CCmdTestExecute* iCommand;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    56
		};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    57
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    58
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    59
	CProxyServer* iProxy;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    60
	RTestExecuteLogServ iLogger;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    61
	RBuf8 iTempBuf;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    62
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    63
	TFileName2 iScriptFile;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    64
	TBool iIgnoredT, iIgnoredC;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    65
	HBufC* iIncludes;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    66
	HBufC* iExcludes;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    67
	TBool iDebug;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    68
	CLogonCompleter* iLogonCompleter;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    69
	RProcess iTefProc;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    70
	};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    71
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    72
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    73
EXE_BOILER_PLATE(CCmdTestExecute)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    74
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    75
CCommandBase* CCmdTestExecute::NewLC()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    76
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    77
	CCmdTestExecute* self = new(ELeave) CCmdTestExecute();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    78
	CleanupStack::PushL(self);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    79
	self->BaseConstructL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    80
	return self;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    81
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    82
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    83
CCmdTestExecute::~CCmdTestExecute()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    84
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    85
	Cancel();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    86
	if (iProxy)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    87
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    88
		iProxy->Destroy();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    89
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    90
	iLogger.Close();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    91
	iTempBuf.Close();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    92
	delete iIncludes;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    93
	delete iExcludes;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    94
	delete iLogonCompleter;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    95
	iTefProc.Close();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    96
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    97
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    98
CCmdTestExecute::CCmdTestExecute()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    99
	: CMemoryAccessCommandBase(EManualComplete | ESharableIoSession)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   100
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   101
	iTefProc.SetHandle(0); // Don't default to the current process
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   102
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   103
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   104
const TDesC& CCmdTestExecute::Name() const
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   105
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   106
	_LIT(KName, "testexecute");	
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   107
	return KName;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   108
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   109
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   110
void CCmdTestExecute::ArgumentsL(RCommandArgumentList& aArguments)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   111
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   112
	aArguments.AppendFileNameL(iScriptFile, _L("script-file"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   113
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   114
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   115
void CCmdTestExecute::OptionsL(RCommandOptionList& aOptions)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   116
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   117
	aOptions.AppendBoolL(iDebug, _L("debug"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   118
	aOptions.AppendBoolL(iIgnoredT, _L("ignore"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   119
	aOptions.AppendBoolL(iIgnoredC, _L("ignore2"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   120
	aOptions.AppendStringL(iIncludes, _L("include"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   121
	aOptions.AppendStringL(iExcludes, _L("exclude"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   122
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   123
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   124
#define CTRL(x) ((x)-'a'+1)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   125
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   126
void CCmdTestExecute::DoRunL()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   127
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   128
	LoadMemoryAccessL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   129
	iTempBuf.CreateL(1024);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   130
	User::LeaveIfError(Stdin().CaptureKey(CTRL('c'), 0, 0)); // So we can do cleanup
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   131
	Stdin().WaitForKey(iStatus);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   132
	SetActive();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   133
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   134
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   135
	User::LeaveIfError(iLogger.Connect()); // Keep it open
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   136
	iLogger.CreateLog(_L("\\logs\\testexecute\\fshelllovesyou"), RTestExecuteLogServ::ELogModeOverWrite); // The server won't actually stay open unless you call CreateLog!
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   137
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   138
	// Set up our proxy
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   139
	iProxy = CProxyServer::NewInSeparateThreadL(_L("TestExecuteLogEngine"), this);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   140
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   141
	if (iScriptFile.Length())
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   142
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   143
		LtkUtils::RLtkBuf cmdLine;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   144
		CleanupClosePushL(cmdLine);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   145
		cmdLine.AppendL(iScriptFile);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   146
		if (iDebug) cmdLine.AppendL(_L(" -d"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   147
		if (iIncludes) cmdLine.AppendFormatL(_L(" -tci %S"), iIncludes);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   148
		if (iExcludes) cmdLine.AppendFormatL(_L(" -tcx %S"), iExcludes);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   149
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   150
		LeaveIfErr(iTefProc.Create(_L("testexecute.exe"), cmdLine), _L("Couldn't create testexecute.exe %S"), &cmdLine);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   151
		iLogonCompleter = new(ELeave) CLogonCompleter(this);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   152
		iTefProc.Resume();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   153
		CleanupStack::PopAndDestroy(&cmdLine);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   154
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   155
	else
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   156
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   157
		// Just do some tests
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   158
		RTestExecuteLogServ newlogger;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   159
		LeaveIfErr(newlogger.Connect(), _L("Couldn't connect to proxied RTestExecuteLogServ"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   160
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   161
		newlogger.CreateLog(_L("\\logs\\testexecute\\scriptyscripty"), RTestExecuteLogServ::ELogModeOverWrite);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   162
		newlogger.Write(_L("I AM A LOG"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   163
		newlogger.Close();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   164
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   165
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   166
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   167
TBool CCmdTestExecute::HandleMessageL(CProxySession* /*aSession*/, const RMessage2& aMessage)
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   168
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   169
	switch (aMessage.Function())
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   170
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   171
	case RTestExecuteLogServ::EWriteLog:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   172
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   173
		aMessage.ReadL(0, iTempBuf);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   174
		Write(iTempBuf.Expand());
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   175
		break;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   176
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   177
	default:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   178
		break;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   179
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   180
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   181
	return EFalse; // We allow everything to go through to the real TEF as well
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   182
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   183
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   184
void CCmdTestExecute::RunL()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   185
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   186
	if (Stdin().KeyCode() == CTRL('c'))
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   187
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   188
		Printf(_L("CTRL-C detected, cleaning up proxy server...\r\n"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   189
		iProxy->Destroy();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   190
		iProxy = NULL;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   191
		Printf(_L("Exiting...\r\n"));
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   192
		SetErrorReported(ETrue); // Supress complaints about the cancel
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   193
		Complete(KErrCancel);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   194
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   195
	else
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   196
		{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   197
		Stdin().WaitForKey(iStatus);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   198
		SetActive();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   199
		}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   200
	}
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   201
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   202
void CCmdTestExecute::DoCancel()
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   203
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   204
	Stdin().WaitForKeyCancel();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   205
	}