# HG changeset patch # User Tom Sutcliffe # Date 1286970797 -3600 # Node ID 84fefe1cd57fec2175724f5e598449586cd71c3c # Parent 2a78c4ff2eab0f9fcba03c435a6d47601fd9a121# Parent 91da8db1df45df539265fb0b282187d4ee67f42c merge diff -r 91da8db1df45 -r 84fefe1cd57f build/sf/3tshell/platform.mmh --- a/build/sf/3tshell/platform.mmh Thu Oct 07 16:23:29 2010 +0100 +++ b/build/sf/3tshell/platform.mmh Wed Oct 13 12:53:17 2010 +0100 @@ -33,4 +33,6 @@ #define FSHELL_NO_SPCRE_SUPPORT #define FSHELL_NO_CRYPTO_SUPPORT +#define EXCLUDE_SERIALKEYBOARD // Needed on beagleboard to stop serial keyboard getting in the way on the uart + #endif diff -r 91da8db1df45 -r 84fefe1cd57f commands/cat/cat.cif --- a/commands/cat/cat.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/cat/cat.cif Wed Oct 13 12:53:17 2010 +0100 @@ -30,7 +30,7 @@ ==option bool b binary -Legacy option, kept for compatability. Equivalent to C<--encoding binary>. +Similar to C<--encoding binary>, but in addition sets the console mode to binary (so, for eg, line endings are not translated) ==option enum e encoding diff -r 91da8db1df45 -r 84fefe1cd57f commands/cat/cat.cpp --- a/commands/cat/cat.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/cat/cat.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -132,6 +132,7 @@ else { iEncoding = EBinary; + LeaveIfErr(Stdout().SetMode(RIoReadWriteHandle::EBinary), _L("Unable to set stdout to binary mode")); // To tell iosrv to not mess about with line endings. } } diff -r 91da8db1df45 -r 84fefe1cd57f commands/clipboard/clipboard.cif --- a/commands/clipboard/clipboard.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/clipboard/clipboard.cif Wed Oct 13 12:53:17 2010 +0100 @@ -24,7 +24,16 @@ Read the text from C instead of from the command line. +==smoke-test + +clipboard "Test data" +clipboard | export -s RESULT +var RESULT == "Test data" || $Error + +echo "$RESULT" | clipboard --stdin +clipboard | export -s RES2 +var RES2 == "Test data^r^n" || $Error + ==copyright Copyright (c) 2008-2010 Accenture. All rights reserved. - diff -r 91da8db1df45 -r 84fefe1cd57f commands/drvinfo/drvinfo.cif --- a/commands/drvinfo/drvinfo.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/drvinfo/drvinfo.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,7 +28,32 @@ Display sizes in human readable form. +==option bool l long + +Display information one drive per line, similar to ls's --long option. The attributes have the following format: + +=over 5 + +=item r + +read only + +=item e + +removable + +=item m + +RAM disk + +=back + +For example, C indicates a removable disk that is read-only. The attributes are followed by the drive letter, the free space on disk, the total disk size, and the volume name if there is one. + ==copyright Copyright (c) 2007-2010 Accenture. All rights reserved. +==smoke-test + +drvinfo --long $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/drvinfo/drvinfo.cpp --- a/commands/drvinfo/drvinfo.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/drvinfo/drvinfo.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -34,6 +34,7 @@ HBufC* iDriveLetter; TBool iVerbose; TBool iHuman; + TBool iLong; }; @@ -56,7 +57,7 @@ void CCmdDrvinfo::ArgumentErrorL() { - Stderr().Write(_L("Invalid drive specification - use \':\', e.g. \'drvinfo c:\'\r\n")); + Stderr().Write(_L("Invalid drive specification - use ':', e.g. 'drvinfo c:'\r\n")); User::Leave(KErrArgument); } @@ -161,13 +162,36 @@ void CCmdDrvinfo::PrintDriveInfoL(TInt aDriveNum) { - IoUtils::CTextBuffer* buf = IoUtils::CTextBuffer::NewLC(0x100); - TDriveInfo driveInfo; User::LeaveIfError(FsL().Drive(driveInfo, aDriveNum)); TVolumeInfo volInfo; TInt volErr = Fs().Volume(volInfo, aDriveNum); + + if (iLong) + { + TText readonly = '-'; + TText removable = '-'; + TText ram = '-'; + if (driveInfo.iMediaAtt & KMediaAttWriteProtected) readonly = 'r'; + if (driveInfo.iDriveAtt & KDriveAttRemovable) removable = 'e'; + if (driveInfo.iType == EMediaRam) ram = 'm'; + + Printf(_L("%c%c%c %c: "), readonly, removable, ram, 'a' + aDriveNum); + TInt64 free = 0; + TInt64 size = 0; + if (volErr == KErrNone) + { + free = volInfo.iFree; + size = volInfo.iSize; + } + Printf(_L("%Ld %Ld %S"), free, size, &volInfo.iName); + return; + } + + User::LeaveIfError(volErr); // Long listing handles volErr itself so didn't want to leave + + IoUtils::CTextBuffer* buf = IoUtils::CTextBuffer::NewLC(0x100); if (iVerbose || (iDriveLetter == NULL)) { @@ -230,7 +254,10 @@ ArgumentErrorL(); } } - + if (iLong && (iVerbose || iHuman)) + { + LeaveIfErr(KErrArgument, _L("--long cannot be specified at same time as either --human or --verbose")); + } TDriveList driveList; User::LeaveIfError(FsL().DriveList(driveList)); @@ -271,9 +298,11 @@ { _LIT(KOptVerbose, "verbose"); _LIT(KOptHuman, "human"); + _LIT(KOptLong, "long"); aOptions.AppendBoolL(iVerbose, KOptVerbose); aOptions.AppendBoolL(iHuman, KOptHuman); + aOptions.AppendBoolL(iLong, KOptLong); } diff -r 91da8db1df45 -r 84fefe1cd57f commands/focus/focus.cif --- a/commands/focus/focus.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/focus/focus.cif Wed Oct 13 12:53:17 2010 +0100 @@ -44,3 +44,6 @@ Copyright (c) 2008-2010 Accenture. All rights reserved. +==smoke-test + +focus $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/fzip/fzip.cpp --- a/commands/fzip/fzip.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/fzip/fzip.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -15,6 +15,7 @@ #include "fzip.h" _LIT(KGzExtension, ".gz"); +_LIT(KZipExtension, ".zip"); CCommandBase* CCmdZip::NewLC() { @@ -26,8 +27,7 @@ CCmdZip::~CCmdZip() { - if (iFileToZip.Count() > 0) - iFileToZip.Close(); + iFileToZip.Close(); } CCmdZip::CCmdZip() : CCommandBase(CCommandBase::EManualComplete) @@ -55,11 +55,11 @@ // command-line sanity checks if (iFileToZip.Count() > 0) { - PrintWarning(_L("Ignoring \'-f\' file option.")); + PrintWarning(_L("--file option is not relevant when unzipping.")); } if (iRecurse) { - PrintWarning(_L("Ignoring \'-r\' recurse option.")); + PrintWarning(_L("--recurse option is not relevant when unzipping.")); } } ExpandArchiveL(); @@ -71,21 +71,14 @@ // command-line sanity checks if (iUnzipPath.Length() > 0) { - PrintWarning(_L("Ignoring '-d' directory option.")); + PrintWarning(_L("--directory option is not relevant when zipping.")); } } if (iFileToZip.Count() == 0) { - PrintError(KErrArgument, _L("Use '-f' to specify source files.")); - User::Leave(KErrArgument); + LeaveIfErr(KErrArgument, _L("Specify some files to zip up using --file option.")); } - TRAPD(err, CreateArchiveL()); - if (err != KErrNone) - { - PrintError(err, _L("Couldn't create archive")); - Fs().Delete(iArchive); // ignore error - User::Leave(err); - } + TRAPL(CreateArchiveL(), _L("Couldn't create %S"), &iArchive); } if (iVerbose) { @@ -96,7 +89,7 @@ void CCmdZip::ArgumentsL(RCommandArgumentList& aArguments) { - _LIT(KArg1, "archive"); + _LIT(KArg1, "zipfile"); aArguments.AppendFileNameL(iArchive, KArg1); } @@ -119,6 +112,9 @@ _LIT(KOptCompressionType, "compression-type"); aOptions.AppendEnumL((TInt&)iCompressionType, KOptCompressionType); + + _LIT(KOptOverwrite, "overwrite"); + aOptions.AppendBoolL(iOverwrite, KOptOverwrite); } @@ -132,6 +128,24 @@ // void CCmdZip::CreateArchiveL() { + if (iArchive.Length() == 0) + { + iArchive = iFileToZip[0]; + iArchive.Append(iCompressionType == EGZip ? KGzExtension() : KZipExtension()); + } + + if (iArchive.Exists(FsL())) + { + if (iOverwrite) + { + FsL().Delete(iArchive); + } + else + { + LeaveIfErr(KErrAlreadyExists, _L("File %S already exists on disk. Use --overwrite or specify a different file"), &iArchive); + } + } + if (iCompressionType == EGZip) { CreateGzArchiveL(); @@ -158,23 +172,17 @@ LeaveIfErr(KErrArgument, _L("GNU Zip format can only handle a single file")); } - if (iArchive.Length() == 0) - { - iArchive = iFileToZip[0]; - iArchive.Append(KGzExtension); - } - - RFile input; if (iVerbose) { Printf(_L("Creating '%S'\r\n"), &iArchive); } // open the input file - User::LeaveIfError(input.Open(Fs(), iFileToZip[0], EFileStream | EFileRead | EFileShareAny)); + RFile input; + User::LeaveIfError(input.Open(FsL(), iFileToZip[0], EFileStream | EFileRead | EFileShareAny)); CleanupClosePushL(input); - CEZFileToGZip* zip = CEZFileToGZip::NewLC(Fs(), iArchive, input); + CEZFileToGZip* zip = CEZFileToGZip::NewLC(FsL(), iArchive, input); while (zip->DeflateL()) { // do nothing @@ -297,7 +305,15 @@ { LeaveIfErr(err, _L("Couldn't create path '%S'"), &dest); } - User::LeaveIfError(newFile.Replace(Fs(), dest, EFileStream | EFileRead | EFileShareAny)); + if (iOverwrite) + { + err = newFile.Replace(FsL(), dest, EFileStream | EFileRead | EFileWrite | EFileShareAny); + } + else + { + err = newFile.Create(FsL(), dest, EFileStream | EFileRead | EFileWrite | EFileShareAny); + } + LeaveIfErr(err, _L("Couldn't create file %S"), &dest); CleanupClosePushL(newFile); // inflate the compressed file @@ -362,7 +378,15 @@ aZip.GetInputStreamL(&aMember, readStream); CleanupStack::PushL(readStream); - LeaveIfErr(newFile.Replace(Fs(), dest, EFileShareExclusive), _L("Couldn't create file %S"), &dest); + if (iOverwrite) + { + err = newFile.Replace(Fs(), dest, EFileShareExclusive); + } + else + { + err = newFile.Create(Fs(), dest, EFileShareExclusive); + } + LeaveIfErr(err, _L("Couldn't create file %S"), &dest); CleanupClosePushL(newFile); if (iVerbose) { diff -r 91da8db1df45 -r 84fefe1cd57f commands/fzip/fzip.h --- a/commands/fzip/fzip.h Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/fzip/fzip.h Wed Oct 13 12:53:17 2010 +0100 @@ -56,6 +56,7 @@ TFileName2 iArchive; TFileName2 iUnzipPath; RArray iFileToZip; + TBool iOverwrite; }; diff -r 91da8db1df45 -r 84fefe1cd57f commands/grabscreen/grabscreen.cif --- a/commands/grabscreen/grabscreen.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/grabscreen/grabscreen.cif Wed Oct 13 12:53:17 2010 +0100 @@ -58,3 +58,6 @@ Copyright (c) 2008-2010 Accenture. All rights reserved. +==smoke-test + +grabscreen > /dev/null diff -r 91da8db1df45 -r 84fefe1cd57f commands/group/fshell_commands.iby --- a/commands/group/fshell_commands.iby Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/group/fshell_commands.iby Wed Oct 13 12:53:17 2010 +0100 @@ -374,4 +374,7 @@ FSHELL_COMMAND_INFO_FILE(fshell,testexecute.cif) #endif +FSHELL_EXECUTABLE_FILE(snake.exe) +FSHELL_COMMAND_INFO_FILE(fshell,snake.cif) + #endif // __FSHELL_COMMANDS_IBY__ diff -r 91da8db1df45 -r 84fefe1cd57f commands/hal/hal.cif --- a/commands/hal/hal.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/hal/hal.cif Wed Oct 13 12:53:17 2010 +0100 @@ -60,3 +60,6 @@ Copyright (c) 2009-2010 Accenture. All rights reserved. +==smoke-test + +hal $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/iap/iap.cif --- a/commands/iap/iap.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/iap/iap.cif Wed Oct 13 12:53:17 2010 +0100 @@ -20,8 +20,10 @@ Add a dummy IAP for use with WinSockPrt (an ESock protocol module that replaces Symbian's TCP/IP stack with a shim over Microsoft's WinSock API). - ==copyright Copyright (c) 2008-2010 Accenture. All rights reserved. +==smoke-test + +iap $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/kerninfo/kerninfo.cif --- a/commands/kerninfo/kerninfo.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/kerninfo/kerninfo.cif Wed Oct 13 12:53:17 2010 +0100 @@ -86,3 +86,17 @@ Copyright (c) 2008-2010 Accenture. All rights reserved. +==smoke-test + +kerninfo process $Quiet +kerninfo thread $Quiet +kerninfo chunk $Quiet +kerninfo server $Quiet +kerninfo codeseg $Quiet +kerninfo hal $Quiet +# Don't test windowgroup, mimetype - we may be on tshell +kerninfo openfile $Quiet +kerninfo msgq $Quiet +kerninfo mutex $Quiet +kerninfo semaphore $Quiet +kerninfo timer $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/listapps/listapps.cif --- a/commands/listapps/listapps.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/listapps/listapps.cif Wed Oct 13 12:53:17 2010 +0100 @@ -36,9 +36,10 @@ Display the details of the application with the specified window group identifier. If not specified, details of all currently running applications are displayed. - - ==copyright Copyright (c) 2007-2010 Accenture. All rights reserved. +==smoke-test + +listapps $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/localdrive/localdrive.cif --- a/commands/localdrive/localdrive.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/localdrive/localdrive.cif Wed Oct 13 12:53:17 2010 +0100 @@ -50,3 +50,6 @@ Copyright (c) 2010 Accenture. All rights reserved. +==smoke-test + +localdrive $Silent # Localdrive can print errors for drives that are ejected, etc diff -r 91da8db1df45 -r 84fefe1cd57f commands/localdrive/localdrive.cpp --- a/commands/localdrive/localdrive.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/localdrive/localdrive.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -226,7 +226,12 @@ if (err == KErrNone) { TPckg capsBuf(iCaps); - LeaveIfErr(iDrive.Caps(capsBuf), _L("Opened drive %d but couldn't read caps"), aDrive); + err = iDrive.Caps(capsBuf); + if (err) + { + iDrive.Close(); + if (aLeaveOnConnectErr) LeaveIfErr(err, _L("Opened drive %d but couldn't read caps"), aDrive); + } } else if (aLeaveOnConnectErr) { diff -r 91da8db1df45 -r 84fefe1cd57f commands/mrouter/mrouter.cif --- a/commands/mrouter/mrouter.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/mrouter/mrouter.cif Wed Oct 13 12:53:17 2010 +0100 @@ -20,3 +20,7 @@ Copyright (c) 2007-2010 Accenture. All rights reserved. +==smoke-test + +# Do any platforms still support this command? +mrouter diff -r 91da8db1df45 -r 84fefe1cd57f commands/rcomm/rcomm.cif --- a/commands/rcomm/rcomm.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/rcomm/rcomm.cif Wed Oct 13 12:53:17 2010 +0100 @@ -74,3 +74,6 @@ Copyright (c) 2007-2010 Accenture. All rights reserved. +==smoke-test + +rcomm $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/rconn/rconn.cif --- a/commands/rconn/rconn.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/rconn/rconn.cif Wed Oct 13 12:53:17 2010 +0100 @@ -48,3 +48,6 @@ Copyright (c) 2009-2010 Accenture. All rights reserved. +==smoke-test + +rconn list $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/screenmode/screenmode.cif --- a/commands/screenmode/screenmode.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/screenmode/screenmode.cif Wed Oct 13 12:53:17 2010 +0100 @@ -48,3 +48,6 @@ Copyright (c) 2009-2010 Accenture. All rights reserved. +==smoke-test + +screenmode list $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f commands/snake/snake.cif --- a/commands/snake/snake.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/snake/snake.cif Wed Oct 13 12:53:17 2010 +0100 @@ -26,6 +26,10 @@ Speed of the game, in microseconds. This is the interval between each step forward the snake makes. Values in the range of 200000 (very easy) to 10000 (very hard) are reasonable. +==option bool u unicode + +Draw the game using the unicode box drawing characters. Not guaranteed to display correctly on all consoles. + ==copyright Copyright (c) 2009-2010 Accenture. All rights reserved. diff -r 91da8db1df45 -r 84fefe1cd57f commands/snake/snake.cpp --- a/commands/snake/snake.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/commands/snake/snake.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -16,7 +16,9 @@ using namespace IoUtils; _LIT(KSnakeSeg, "*"); +_LIT(KUnicodeSnakeSeg, "\u2588"); // Full block _LIT(KBait, "$"); +_LIT(KUnicodeBait, "\u2665"); // heart class CKeyWatcher; @@ -45,6 +47,7 @@ void SetBoard(TInt aX, TInt aY, TBool aSet); TBool GetBoard(TInt aX, TInt aY); void DrawBoardL(); + TUint16 BoardCharacter(TInt aX, TInt aY); void InitSnakeL(TInt aLen, TPoint aPos); void DrawSnakeL(); void DrawScore(); @@ -64,6 +67,7 @@ TPoint iBait; TInt iScore; TInt iSpeed; + TBool iUnicode; CKeyWatcher* iKeys; CPeriodic* iTimer; @@ -163,6 +167,8 @@ { _LIT(KOptSpeed, "speed"); aOptions.AppendIntL(iSpeed, KOptSpeed); + _LIT(KOptUnicode, "unicode"); + aOptions.AppendBoolL(iUnicode, KOptUnicode); } void CCmdSnake::ConstructL() @@ -230,7 +236,8 @@ { for (TInt x=0; x can be used to navigate between drives (eg C), but the DOS approach of switching between drives with commands like C and C is also supported. + +The current working directory is stored in the environment variable C, but you should use the cd command rather than updating this variable directly. + ==argument filename directory The directory to change to. +==see-also + +L + ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. - diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/chunkinfo.cif --- a/core/builtins/chunkinfo.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/chunkinfo.cif Wed Oct 13 12:53:17 2010 +0100 @@ -48,3 +48,9 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# This should fail with KErrNotFound, but shouldn't crash +chunkinfo 1 $Silent &| var ? == "-1" || $Error + +chunkinfo $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/ciftest.cif --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/builtins/ciftest.cif Wed Oct 13 12:53:17 2010 +0100 @@ -0,0 +1,98 @@ +# ciftest.cif +# +# Copyright (c) 2010 Accenture. All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Accenture - Initial contribution +# + +==name ciftest + +==short-description + +Run fshell command smoke tests. + +==long-description + +This command runs smoke-tests for any or all commands that define a C<==smoke-test> section in their CIF file. A C<==smoke-test> section defines a short snippet of fshell script which tests the basic functionality offered by the command. It can be as simple as running the command with no arguments to make sure nothing catastrophic is wrong, or it can be a more in-depth test of all the command's functionality, or anything in between. + +Example CIF file that supports ciftest: + + ==name mycmd + + [...] + + ==smoke-test + + mycmd | export -s RESULT + var RESULT == "Expected results of running mycmd" || $Error + +The following environment variables are defined for convenience when ciftest runs a smoke-test section: + +=over 5 + +=item * Error + +Expands to a string that will cause a test to fail. Additionally it prints the current environment, hence is useful to use when C commands fail, as in the above example. Equivalent to something like C. + +=item * SCRIPT_NAME + +The script name is appended with ":smoke-test", eg "cifname.cif:smoke-test". + +=item * SCRIPT_PATH, 0 + +Set as in any other script. + +=item * SCRIPT_LINE + +Set as in any other script. Line numbers are relative to the start of the CIF file, not the first line of the smoke-test section. + +=item * Quiet + +Used to supress stdout from a command, for when you don't want it to appear in the smoketest results. Usage: + + mynoisycommand $Quiet + +Equivalent to putting C/dev/null> on the end of the command. + +=item * Silent + +Supresses both stdout and stderr. Useful when an operation is expected to fail. Usage: + + mycommand expectfailure $Silent && $Error + +Note how $Silent is combined with C<&& $Error> such that if the command actually succeeded where it was expected to fail, the $Error case would cause the script to abort. + +=item * Verbose + +Defined if the C<--verbose> option was given to ciftest. Example usage: + + var Verbose defined && echo "About to test something-or-other" + +=back + +The environment used for running the smoke-test snippets is not shared between commands, so do not set things in one smoketest script and expect to be able to see them in another. (Ie the snippets are run as if with "fshell" not "source"). + +==argument string command optional + +If specified, run the tests associated with the specified command. If not specified, run tests for all commands. + +==option bool v verbose + +Print information about every test even when they succeed. By default only failures are printed. Also causes a summary to be printed at the end. Scripts can also print extra information themselves if this flag is set, by checking for the C environment variable. + +==option bool k keep-going + +Rather than stop on the first failure, attempt to run all tests even if some of them fail. Only relevant if no command argument is given. + +==copyright + +Copyright (c) 2010 Accenture. All rights reserved. + +==smoke-test + +# Ciftest itself doesn't have a smoketest! diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/ciftest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/builtins/ciftest.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -0,0 +1,192 @@ +// ciftest.cpp +// +// Copyright (c) 2010 Accenture. All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Accenture - Initial contribution +// + +#include "ciftest.h" +#include "fshell.h" +#include "command_factory.h" + +CCommandBase* CCmdCifTest::NewLC() + { + CCmdCifTest* self = new(ELeave) CCmdCifTest(); + CleanupStack::PushL(self); + self->BaseConstructL(); + return self; + } + +CCmdCifTest::~CCmdCifTest() + { + delete iCmd; + delete iParser; + delete iEnvForScript; + delete iCurrentCif; + iCifFiles.ResetAndDestroy(); + } + +CCmdCifTest::CCmdCifTest() + : CCommandBase(EManualComplete | EReportAllErrors) + { + } + +const TDesC& CCmdCifTest::Name() const + { + _LIT(KName, "ciftest"); + return KName; + } + +void CCmdCifTest::ArgumentsL(RCommandArgumentList& aArguments) + { + aArguments.AppendStringL(iCmd, _L("command")); + } + +void CCmdCifTest::OptionsL(RCommandOptionList& aOptions) + { + aOptions.AppendBoolL(iVerbose, _L("verbose")); + aOptions.AppendBoolL(iKeepGoing, _L("keep-going")); + } + +void CCmdCifTest::DoRunL() + { + if (iCmd) + { + CCommandInfoFile* cif = CCommandInfoFile::NewL(FsL(), Env(), *iCmd); + TestCifL(cif); // Takes ownership + } + else + { + _LIT(KCifDir, "y:\\resource\\cif\\fshell\\"); + TFindFile find(FsL()); + CDir* dir = NULL; + TInt found = find.FindWildByDir(_L("*.cif"), KCifDir, dir); + while (found == KErrNone) + { + for (TInt i = 0; i < dir->Count(); i++) + { + iFileName.Copy(TParsePtrC(find.File()).DriveAndPath()); // The docs for TFindFile state you shouldn't need the extra TParsePtrC::DriveAndPath(). Sigh. + iFileName.Append((*dir)[i].iName); + iCifFiles.AppendL(iFileName.AllocLC()); + CleanupStack::Pop(); + } + delete dir; + dir = NULL; + found = find.FindWild(dir); + } + NextCif(); + } + } + +void CCmdCifTest::NextCif() + { + if (iNextCif == iCifFiles.Count()) + { + if (iVerbose) + { + Printf(_L("%d tests run, %d passes %d failures."), iPasses + iFailures, iPasses, iFailures); + if (iCifFiles.Count()) Printf(_L(" %d commands have no tests defined."), iCifFiles.Count() - iPasses - iFailures); + Printf(_L("\r\n")); + } + Complete(KErrNone); + } + else + { + CCommandInfoFile* cif = NULL; + TRAPD(err, cif = CCommandInfoFile::NewL(FsL(), *iCifFiles[iNextCif])); + if (!err) + { + TRAP(err, TestCifL(cif)); + if (err) PrintError(err, _L("Error setting up test for CIF %S"), iCifFiles[iNextCif]); + } + iNextCif++; + + if (err) + { + iFailures++; + TestCompleted(err); + } + } + } + +void CCmdCifTest::TestCifL(CCommandInfoFile* aCif) + { + iCurrentCif = aCif; + if (iVerbose) Printf(_L("Checking %S\r\n"), &aCif->CifFileName()); + + const TDesC& scriptData = aCif->SmokeTest(); + if (scriptData.Length() == 0) + { + if (iVerbose) Printf(_L("Cif has no smoketest section\r\n")); + TestCompleted(KErrNone); + return; + } + + iEnvForScript = CEnvironment::NewL(Env()); + iEnvForScript->SetL(_L("Error"), _L("fshell -e 'echo \"Test failed, env is:\" && env && error'")); + iEnvForScript->SetL(_L("Quiet"), _L(">/dev/null")); + iEnvForScript->SetL(_L("Silent"), _L("2>&1 >/dev/null")); + iEnvForScript->Remove(_L("Verbose")); // In case it's ended up in our parent env + if (iVerbose) iEnvForScript->SetL(_L("Verbose"), 1); + iFileName.Copy(aCif->CifFileName()); + iFileName.Append(_L(":smoke-test")); + TParsePtrC parse(iFileName); + iEnvForScript->SetL(KScriptName, parse.NameAndExt()); + iEnvForScript->SetL(KScriptPath, parse.DriveAndPath()); + iEnvForScript->SetL(_L("0"), iFileName); + + iParser = CParser::NewL(CParser::EExportLineNumbers, scriptData, IoSession(), Stdin(), Stdout(), Stderr(), *iEnvForScript, gShell->CommandFactory(), this, aCif->GetSmokeTestStartingLineNumber()); + iParser->Start(); + } + +void CCmdCifTest::HandleParserComplete(CParser& /*aParser*/, const TError& aError) + { + TInt err = aError.Error(); + if (err) + { + iFailures++; + PrintError(err, _L("%S failed at line %d"), &aError.ScriptFileName(), aError.ScriptLineNumber()); + } + else + { + if (iVerbose) + { + Printf(_L("Smoketest for %S completed ok.\r\n"), &iCurrentCif->Name()); + } + iPasses++; + } + TestCompleted(err); + } + +void CCmdCifTest::TestCompleted(TInt aError) + { + // Delete interim data + delete iEnvForScript; + iEnvForScript = NULL; + delete iParser; + iParser = NULL; + delete iCurrentCif; + iCurrentCif = NULL; + + if (aError == KErrNone || iKeepGoing) + { + // Async call NextCif() + TRequestStatus* stat = &iStatus; + User::RequestComplete(stat, KErrNone); + SetActive(); + } + else + { + Complete(aError); + } + } + +void CCmdCifTest::RunL() + { + NextCif(); + } diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/ciftest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/builtins/ciftest.h Wed Oct 13 12:53:17 2010 +0100 @@ -0,0 +1,56 @@ +// ciftest.h +// +// Copyright (c) 2010 Accenture. All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Accenture - Initial contribution +// + +#ifndef CIFTEST_H +#define CIFTEST_H + +#include +#include "parser.h" + +using namespace IoUtils; + +class CCmdCifTest : public CCommandBase, public MParserObserver + { +public: + static CCommandBase* NewLC(); + ~CCmdCifTest(); +private: + CCmdCifTest(); + void TestCifL(CCommandInfoFile* aCif); + void NextCif(); + void TestCompleted(TInt aError); +private: // From CCommandBase. + void RunL(); + virtual const TDesC& Name() const; + virtual void DoRunL(); + virtual void ArgumentsL(RCommandArgumentList& aArguments); + virtual void OptionsL(RCommandOptionList& aOptions); +private: // From MParserObserver. + virtual void HandleParserComplete(CParser& aParser, const TError& aError); + +private: + HBufC* iCmd; + TBool iVerbose; + TBool iKeepGoing; + + TFileName iFileName; + CCommandInfoFile* iCurrentCif; + CParser* iParser; + CEnvironment* iEnvForScript; + RPointerArray iCifFiles; + + TInt iPasses; + TInt iFailures; + TInt iNextCif; + }; + +#endif diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/clear.cif --- a/core/builtins/clear.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/clear.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,3 +28,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +cls --formfeed $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/compare.cif --- a/core/builtins/compare.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/compare.cif Wed Oct 13 12:53:17 2010 +0100 @@ -36,3 +36,15 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +date --timestamp | export -s TIMESTAMP +export Temp compare-test-$TIMESTAMP- +echo "Stuff" > $Temp1 +echo "Stuff" > $Temp2 +echo "Stuff thats different" > $Temp3 + +compare $Temp1 $Temp2 || $Error # Should be same +compare $Temp1 $Temp3 && $Error # Should be different + +rm $Temp1 $Temp2 $Temp3 diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/console.cif --- a/core/builtins/console.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/console.cif Wed Oct 13 12:53:17 2010 +0100 @@ -40,3 +40,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +console $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/date.cif --- a/core/builtins/date.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/date.cif Wed Oct 13 12:53:17 2010 +0100 @@ -63,7 +63,7 @@ ==option bool r raw -Displays the time and date as the number of microseconds since 2000AD (Symbian OS's native time format). +Displays the time and date as the number of microseconds since 0AD nominal Gregorian (Symbian OS's native time format). ==option bool j just-display @@ -71,17 +71,22 @@ ==option int64 R raw-set -Sets the time and date from a number corresponding to the number of microseconds since 2000AD (Symbian OS's native time format). +Sets the time and date from a number corresponding to the number of microseconds since 0AD nominal Gregorian (Symbian OS's native time format). ==option bool t timestamp Display the date in timestamp format C suitable for use in a file name. -==option bool k kern +==option bool Y y2k -Only applicable with C<--raw> and/or C<--raw-set>. Instead of using 2000AD as the epoc, use 0AD nominal Gregorian, the kernel's internal native time format. +Only applicable with C<--raw> and/or C<--raw-set>. Instead of using 0AD as the epoc, assume 2000AD. Some APIs use 2000 instead of 0AD as the epoc so this option is occasionally useful for converting between the two. ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +date $Quiet +date --raw $Quiet +date --timestamp $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/dialog.cif --- a/core/builtins/dialog.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/dialog.cif Wed Oct 13 12:53:17 2010 +0100 @@ -60,3 +60,9 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Don't actually post a dialog, the tests need to be unobtrusive (and non-blocking) +export DIALOG_IMPL null +dialog "Some question which isn't important" +var ? == 0 || $Error diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/driver.cif --- a/core/builtins/driver.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/driver.cif Wed Oct 13 12:53:17 2010 +0100 @@ -48,3 +48,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +driver list logical $Quiet \ No newline at end of file diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/dump.cif --- a/core/builtins/dump.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/dump.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,3 +28,7 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +echo "123" | dump | export -s RESULT +var RESULT == "00000000: 31 00 32 00 33 00 0D 00 0A 00 1.2.3.....^r^n" || $Error diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/echo.cif --- a/core/builtins/echo.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/echo.cif Wed Oct 13 12:53:17 2010 +0100 @@ -102,3 +102,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-basic-test.script, this section is just so ciftest doesn't report it as a command without any tests diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/exists.cif --- a/core/builtins/exists.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/exists.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,3 +28,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-basic-test.script, this section is just so ciftest doesn't report it as a command without any tests diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/exit.cif --- a/core/builtins/exit.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/exit.cif Wed Oct 13 12:53:17 2010 +0100 @@ -20,8 +20,11 @@ Note, this causes fshell's command history to be persisted to a file. - ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# This used to cause fshell problems +fshell -e exit diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/ls.cif --- a/core/builtins/ls.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/ls.cif Wed Oct 13 12:53:17 2010 +0100 @@ -20,8 +20,6 @@ By default ls will columnize the output list. On very large directory listings this may cause the ls command to run out of memory. If this happens, try using the C<-1>/C<--one> option, which will not attempt to format the output. -Note, C can be used to navigate between drives, but the DOS approach of switching between drives with commands like C and C is also supported. - ==argument filename dir_name optional The directory to list (defaults to the current working directory). @@ -64,6 +62,10 @@ Display file sizes in human readable form. +==option bool N no-localise + +Do not display localised time and date formats; instead use microseconds from 0AD nominal Gregorian. + ==option bool 1 one Outputs one entry per line rather than trying to columnise the output. Is implied if C is redirected or if C<--long> is specified. @@ -72,6 +74,10 @@ Recursively list any directories that are encountered. Currently only supported for C<--long> listings. +==see-also + +L + ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/match.cif --- a/core/builtins/match.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/match.cif Wed Oct 13 12:53:17 2010 +0100 @@ -43,3 +43,13 @@ ==see-also L + +==smoke-test + +echo "Test line of some sort^r^nIsn't fshell great?^r^nSome other line" | export -s TESTDATA +echo "$TESTDATA" | match *fshell* | export -s RESULT +var RESULT == "Isn't fshell great?^r^n" || $Error + +# Test anchored search +echo "$TESTDATA" | match Some* | export -s RESULT +var RESULT == "Some other line^r^n" || $Error diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/ps.cif --- a/core/builtins/ps.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/ps.cif Wed Oct 13 12:53:17 2010 +0100 @@ -104,3 +104,6 @@ Copyright (c) 2005-2010 Accenture. All rights reserved. +==smoke-test + +ps $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/repeat.cif --- a/core/builtins/repeat.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/repeat.cif Wed Oct 13 12:53:17 2010 +0100 @@ -40,3 +40,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-last-test.script, this section is just so ciftest doesn't report it as a command without any tests \ No newline at end of file diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/rm.cif --- a/core/builtins/rm.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/rm.cif Wed Oct 13 12:53:17 2010 +0100 @@ -36,3 +36,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-basic-test.script, this section is just so ciftest doesn't report it as a command without any tests diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/rom.cif --- a/core/builtins/rom.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/rom.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,3 +28,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +variant target && rom --verbose $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/sort.cif --- a/core/builtins/sort.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/sort.cif Wed Oct 13 12:53:17 2010 +0100 @@ -24,9 +24,11 @@ Reverse the sort order. - - ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +echo "wonderful^r^nfshell^r^njust^r^nis" | sort | export -s RESULT +var RESULT == "fshell^r^nis^r^njust^r^nwonderful^r^n" || $Error diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/source.cif --- a/core/builtins/source.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/source.cif Wed Oct 13 12:53:17 2010 +0100 @@ -56,3 +56,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-basic-test.script, this section is just so ciftest doesn't report it as a command without any tests diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/svrinfo.cif --- a/core/builtins/svrinfo.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/svrinfo.cif Wed Oct 13 12:53:17 2010 +0100 @@ -28,3 +28,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +svrinfo $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/touch.cif --- a/core/builtins/touch.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/touch.cif Wed Oct 13 12:53:17 2010 +0100 @@ -24,9 +24,15 @@ The file to touch. - - ==copyright Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +date --timestamp | export -s TIMESTAMP +export TEMPFILE temp$TIMESTAMP +exists $TEMPFILE && $Error +touch $TEMPFILE +exists $TEMPFILE || $Error +rm $TEMPFILE diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/var.cif --- a/core/builtins/var.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/var.cif Wed Oct 13 12:53:17 2010 +0100 @@ -76,3 +76,6 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +# Tested by fshell-basic-test.script, this section is just so ciftest doesn't report it as a command without any tests \ No newline at end of file diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/version.cif --- a/core/builtins/version.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/version.cif Wed Oct 13 12:53:17 2010 +0100 @@ -24,3 +24,6 @@ Copyright (c) 2008-2010 Accenture. All rights reserved. +==smoke-test + +version $Quiet diff -r 91da8db1df45 -r 84fefe1cd57f core/builtins/which.cif --- a/core/builtins/which.cif Thu Oct 07 16:23:29 2010 +0100 +++ b/core/builtins/which.cif Wed Oct 13 12:53:17 2010 +0100 @@ -24,3 +24,7 @@ Copyright (c) 2006-2010 Accenture. All rights reserved. +==smoke-test + +which which | export -s RESULT +var RESULT == "which: built-in command 'which'^r^n" || $Error diff -r 91da8db1df45 -r 84fefe1cd57f core/group/bld.inf --- a/core/group/bld.inf Thu Oct 07 16:23:29 2010 +0100 +++ b/core/group/bld.inf Wed Oct 13 12:53:17 2010 +0100 @@ -81,6 +81,7 @@ ..\builtins\ymodem.cif z:\resource\cif\fshell\ymodem.cif ..\builtins\version.cif z:\resource\cif\fshell\version.cif ..\builtins\undertaker.cif z:\resource\cif\fshell\undertaker.cif +..\builtins\ciftest.cif z:\resource\cif\fshell\ciftest.cif #ifdef FSHELL_CORE_SUPPORT_CHUNKINFO ..\builtins\chunkinfo.cif z:\resource\cif\fshell\chunkinfo.cif diff -r 91da8db1df45 -r 84fefe1cd57f core/group/fshell_core.iby --- a/core/group/fshell_core.iby Thu Oct 07 16:23:29 2010 +0100 +++ b/core/group/fshell_core.iby Wed Oct 13 12:53:17 2010 +0100 @@ -168,6 +168,7 @@ #ifdef FSHELL_CORE_SUPPORT_BUILTIN_REBOOT FSHELL_COMMAND_INFO_FILE(fshell,reboot.cif) #endif +FSHELL_COMMAND_INFO_FILE(fshell,ciftest.cif) #ifdef FSHELL_REPLACE_ECONS FSHELL_EXECUTABLE_AS_DATA(iocons.dll,iocons.dll) @@ -208,7 +209,6 @@ FSHELL_EXECUTABLE_FILE(tlast.exe) FSHELL_EXECUTABLE_FILE(tconsole.exe) -FSHELL_EXECUTABLE_FILE(tinteger.exe) FSHELL_EXECUTABLE_FILE(tfshellarguments.exe) FSHELL_EXECUTABLE_FILE(tenvarguments.exe) FSHELL_EXECUTABLE_FILE(tnoncifenvarguments.exe) diff -r 91da8db1df45 -r 84fefe1cd57f core/src/command_factory.cpp --- a/core/src/command_factory.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/command_factory.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -24,7 +24,7 @@ #include "xmodem.h" #include "ymodem.h" #include "version.h" - +#include "ciftest.h" // // Constants. @@ -301,7 +301,7 @@ AddThreadCommandL(CCmdStart::NewLC); AddThreadCommandL(CCmdCompare::NewLC); AddThreadCommandL(CCmdTime::NewLC); - AddThreadCommandL(CCmdRepeat::NewLC); + AddThreadCommandL(CCmdRepeat::NewLC); // TODO: Should this have EUpdateEnvironment? It seems weird that source and foreach do but repeat doesn't. -TomS AddThreadCommandL(CCmdDebug::NewLC); AddThreadCommandL(CCmdReadMem::NewLC); AddThreadCommandL(CCmdE32Header::NewLC); @@ -323,6 +323,7 @@ #ifdef FSHELL_CORE_SUPPORT_BUILTIN_REBOOT AddThreadCommandL(CCmdReboot::NewLC); #endif + AddThreadCommandL(CCmdCifTest::NewLC); // Add some DOS-style namings of common commands. AddThreadCommandL(_L("del"), CCmdRm::NewLC, CCommandConstructorBase::EAttAlias); diff -r 91da8db1df45 -r 84fefe1cd57f core/src/commands.cpp --- a/core/src/commands.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/commands.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -228,7 +228,14 @@ { iFormatter->AppendFormatL(_L("%+ 10d "), aEntry.iSize); } - aEntry.iModified.FormatL(iTempBuf, _L("%1%/1%2%/2%3 %H%:1%T%:2%S ")); + if (iOptNoLocalise) + { + iTempBuf.Format(_L("%+ 19Ld "), aEntry.iModified.Int64()); // 19 so the output is the same width whether or not iOptNoLocalise is specified (assuming roughly European date settings) + } + else + { + aEntry.iModified.FormatL(iTempBuf, _L("%1%/1%2%/2%3 %H%:1%T%:2%S ")); + } TPtrC pathRelativeToBaseDir = iFileName.Mid(iBaseDir.Length()); iFormatter->AppendFormatL(_L("%S%S%S\r\n"), &iTempBuf, &pathRelativeToBaseDir, &aEntry.iName); } @@ -289,13 +296,15 @@ _LIT(KCmdLsOptLong, "long"); _LIT(KCmdLsOptHuman, "human"); _LIT(KCmdLsOptOnePerLine, "one"); - _LIT(KCmdLsOpRecurse, "recurse"); + _LIT(KCmdLsOptRecurse, "recurse"); + _LIT(KCmdLsOptNoLocalise, "no-localise"); aOptions.AppendBoolL(iOptAll, KCmdLsOptAll); aOptions.AppendBoolL(iOptLong, KCmdLsOptLong); aOptions.AppendBoolL(iOptHuman, KCmdLsOptHuman); aOptions.AppendBoolL(iOptOnePerLine, KCmdLsOptOnePerLine); - aOptions.AppendBoolL(iOptRecurse, KCmdLsOpRecurse); + aOptions.AppendBoolL(iOptRecurse, KCmdLsOptRecurse); + aOptions.AppendBoolL(iOptNoLocalise, KCmdLsOptNoLocalise); } void CCmdLs::ArgumentsL(RCommandArgumentList& aArguments) @@ -734,23 +743,18 @@ { TFileName2& fileName = iFileNames[i]; LeaveIfFileNotFound(fileName); - if (iRecurse) + if (fileName.IsDirL(FsL())) { - if (fileName.IsDirL(FsL())) + if (iRecurse) { fileName.SetTypeL(TFileName2::EDirectory); } else { - PrintError(KErrArgument, _L("Invalid use of \"-r\" option - \"%S\" is not a directory."), &fileName); + PrintError(KErrArgument, _L("Couldn't remove \"%S\" because it is a directory - use \"rm -r\" or \"rmdir\" instead."), &fileName); User::Leave(KErrArgument); } } - else if (fileName.IsDirL(FsL())) - { - PrintError(KErrArgument, _L("Couldn't remove \"%S\" because it is a directory - use \"rm -r\" or \"rmdir\" instead."), &fileName); - User::Leave(KErrArgument); - } TInt err = DoDelete(fileName); if (err == KErrAccessDenied && iForce) @@ -776,7 +780,7 @@ TInt CCmdRm::DoDelete(const TDesC& aFileName) { TInt err; - if (iRecurse) + if (iRecurse && aFileName[aFileName.Length()-1] == '\\') { err = iFileMan->RmDir(aFileName); } @@ -2384,7 +2388,7 @@ if (iRaw) { TInt64 time = aTime.Int64(); - if (iUseKernelFormat) time += KY2kInMicroSeconds; + if (iUseY2k) time -= KY2kInMicroSeconds; Printf(_L("%Ld\r\n"), time); } else if (iUseTimestampFormat) @@ -2441,7 +2445,7 @@ else { _LIT(KSettingError, "Cannot set the time"); - if (iUseKernelFormat) iRawTimeToSet -= KY2kInMicroSeconds; + if (iUseY2k) iRawTimeToSet += KY2kInMicroSeconds; TTime time(iRawTimeToSet); if (iDateToSet) { @@ -2500,7 +2504,7 @@ _LIT(KCmdDateOptJustDisplay, "just-display"); _LIT(KCmdDateOptSetRaw, "raw-set"); _LIT(KCmdDateOptTimestamp, "timestamp"); - _LIT(KCmdDateOptKern, "kern"); + _LIT(KCmdDateOptY2k, "y2k"); aOptions.AppendBoolL(iUniversalTime, KCmdDateOptUniversal); aOptions.AppendStringL(iDateToSet, KCmdDateOptSet); @@ -2512,7 +2516,7 @@ aOptions.AppendBoolL(iJustDisplay, KCmdDateOptJustDisplay); aOptions.AppendIntL(iRawTimeToSet, KCmdDateOptSetRaw); aOptions.AppendBoolL(iUseTimestampFormat, KCmdDateOptTimestamp); - aOptions.AppendBoolL(iUseKernelFormat, KCmdDateOptKern); + aOptions.AppendBoolL(iUseY2k, KCmdDateOptY2k); } diff -r 91da8db1df45 -r 84fefe1cd57f core/src/commands.h --- a/core/src/commands.h Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/commands.h Wed Oct 13 12:53:17 2010 +0100 @@ -91,6 +91,7 @@ TBool iOptHuman; TBool iOptOnePerLine; TBool iOptRecurse; + TBool iOptNoLocalise; }; @@ -556,7 +557,7 @@ TBool iJustDisplay; TInt64 iRawTimeToSet; TBool iUseTimestampFormat; - TBool iUseKernelFormat; + TBool iUseY2k; }; diff -r 91da8db1df45 -r 84fefe1cd57f core/src/fshell.cpp --- a/core/src/fshell.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/fshell.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -572,9 +572,9 @@ aArguments.AppendStringL(iScriptArgs, KArgArgs); } -void CShell::StdinChange(TUint) +void CShell::StdinChange(TUint aChange) { - if (iLineEditor && !iIgnoreNextStdinChange) + if (iLineEditor && !iIgnoreNextStdinChange && (aChange & RIoReadHandle::EGainedForeground)) // We don't care if the console has just resized { iLineEditor->Redraw(); } diff -r 91da8db1df45 -r 84fefe1cd57f core/src/fshell.mmp --- a/core/src/fshell.mmp Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/fshell.mmp Wed Oct 13 12:53:17 2010 +0100 @@ -76,6 +76,7 @@ source xmodem.cpp source ymodem.cpp source version.cpp +source ciftest.cpp // There doesn't seem to be a nice way of turning the platform into a string, like you have $(PLATFORM) in extension makefiles, sigh. #if defined(WINSCW) diff -r 91da8db1df45 -r 84fefe1cd57f core/src/parser.cpp --- a/core/src/parser.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/parser.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -52,9 +52,9 @@ { } -CParser* CParser::NewL(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver) +CParser* CParser::NewL(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver, TInt aStartingLineNumber) { - CParser* self = new(ELeave) CParser(aMode, aDes, aIoSession, aStdin, aStdout, aStderr, aEnv, aFactory, aObserver); + CParser* self = new(ELeave) CParser(aMode, aDes, aIoSession, aStdin, aStdout, aStderr, aEnv, aFactory, aObserver, aStartingLineNumber); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(); @@ -78,8 +78,8 @@ } } -CParser::CParser(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver) - : iMode(aMode), iData(aDes), iIoSession(aIoSession), iStdin(aStdin), iStdout(aStdout), iStderr(aStderr), iEnv(aEnv), iFactory(aFactory), iObserver(aObserver), iCompletionError(aStderr, aEnv), iNextLineNumber(1) +CParser::CParser(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver, TInt aStartingLineNumber) + : iMode(aMode), iData(aDes), iIoSession(aIoSession), iStdin(aStdin), iStdout(aStdout), iStderr(aStderr), iEnv(aEnv), iFactory(aFactory), iObserver(aObserver), iCompletionError(aStderr, aEnv), iNextLineNumber(aStartingLineNumber) { } diff -r 91da8db1df45 -r 84fefe1cd57f core/src/parser.h --- a/core/src/parser.h Thu Oct 07 16:23:29 2010 +0100 +++ b/core/src/parser.h Wed Oct 13 12:53:17 2010 +0100 @@ -41,7 +41,7 @@ EExportLineNumbers = 0x00000004 }; public: - static CParser* NewL(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver); + static CParser* NewL(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver, TInt aStartingLineNumber = 1); ~CParser(); void Start(); void Start(TBool& aIsForeground); @@ -62,7 +62,7 @@ EAndOr }; private: - CParser(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver); + CParser(TUint aMode, const TDesC& aDes, RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, IoUtils::CEnvironment& aEnv, CCommandFactory& aFactory, MParserObserver* aObserver, TInt aStartingLineNumber=1); void ConstructL(); void CreateNextPipeLine(TBool* aIsForeground); void CreateNextPipeLineL(TBool* aIsForeground); diff -r 91da8db1df45 -r 84fefe1cd57f core/tsrc/fshell-basic-test.script --- a/core/tsrc/fshell-basic-test.script Thu Oct 07 16:23:29 2010 +0100 +++ b/core/tsrc/fshell-basic-test.script Wed Oct 13 12:53:17 2010 +0100 @@ -107,7 +107,9 @@ export FILE c:\fshell-basic-test.txt rm $FILE 2>/dev/null &| echo -n "" # I don't like using "&| echo" syntax to indicate don't care if it fails. Probably rm -f should be quiet like unix version +exists $FILE && $Error echo -n "Testing file redirection" > c:\fshell-basic-test.txt +exists $FILE || $Error # The redirect stdin operation doesn't get used much export -s FILECONTENTS < $FILE diff -r 91da8db1df45 -r 84fefe1cd57f core/tsrc/smoketest.script --- a/core/tsrc/smoketest.script Thu Oct 07 16:23:29 2010 +0100 +++ b/core/tsrc/smoketest.script Wed Oct 13 12:53:17 2010 +0100 @@ -18,3 +18,4 @@ fshell -k $SCRIPT_PATH\fshell-ccommandbase-test.script fshell -k $SCRIPT_PATH\fshell-unicode-test.script fshell -k $SCRIPT_PATH\fshell-scriptcif-test.script +ciftest -k diff -r 91da8db1df45 -r 84fefe1cd57f documentation/change_history.pod --- a/documentation/change_history.pod Thu Oct 07 16:23:29 2010 +0100 +++ b/documentation/change_history.pod Wed Oct 13 12:53:17 2010 +0100 @@ -20,12 +20,20 @@ =item * +Commands can now define a C<==smoke-test> section in their CIF files, which defines a snippet of fshell script that will be run as part of C or by invoking L directly. See the ciftest documentation for more details. + +=item * + Fixed crash in fed's handling of UTF-8 sequences split over a block boundary. =item * Added support for automatically starting a USB personality to vt100usbcons via a new C key-value pair. See the L documentation for more information. +=item * + +Added support for beagleboard to sf\3tshell platform. + =back =head2 Release 001 diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/bwins/iocliu.def --- a/libraries/iosrv/bwins/iocliu.def Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/bwins/iocliu.def Wed Oct 13 12:53:17 2010 +0100 @@ -550,4 +550,7 @@ ?KeyPressed@MCommandExtensionsV2@IoUtils@@UAEXII@Z @ 549 NONAME ; void IoUtils::MCommandExtensionsV2::KeyPressed(unsigned int, unsigned int) ?ReadKey@CCommandBase@IoUtils@@QAEIXZ @ 550 NONAME ; unsigned int IoUtils::CCommandBase::ReadKey(void) ?Normalize@TFileName2@IoUtils@@QAEXAAVRFs@@@Z @ 551 NONAME ; void IoUtils::TFileName2::Normalize(class RFs &) + ?SmokeTest@CCommandInfoFile@IoUtils@@QBEABVTDesC16@@XZ @ 552 NONAME ; class TDesC16 const & IoUtils::CCommandInfoFile::SmokeTest(void) const + ?CifFileName@CCommandInfoFile@IoUtils@@QBEABVTDesC16@@XZ @ 553 NONAME ; class TDesC16 const & IoUtils::CCommandInfoFile::CifFileName(void) const + ?GetSmokeTestStartingLineNumber@CCommandInfoFile@IoUtils@@QBEHXZ @ 554 NONAME ; int IoUtils::CCommandInfoFile::GetSmokeTestStartingLineNumber(void) const diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/client/command_base.cpp --- a/libraries/iosrv/client/command_base.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/client/command_base.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -416,6 +416,7 @@ { *(TInt*)iValue = value; } + delete aString; // Because the command class knows nothing about how enums are converted from HBufCs in this case, it cannot be responsible for deleting the HBufC like it would be for a normal string argument. So we delete it here. iIsSet = ETrue; } else // string @@ -2392,8 +2393,8 @@ case KValueTypeEnum: { HBufC* string = ReadStringLC(aLex, EDisallowLeadingHyphen); - aValue.SetValueL(string); - CleanupStack::PopAndDestroy(string); + aValue.SetValueL(string); + CleanupStack::Pop(string); // SetValueL takes ownership break; } default: diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/client/command_info_file.cpp --- a/libraries/iosrv/client/command_info_file.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/client/command_info_file.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -27,6 +27,7 @@ _LIT(KCmndLongDescription, "long-description"); _LIT(KCmndSeeAlso, "see-also"); _LIT(KCmndCopyright, "copyright"); +_LIT(KCmndSmokeTest, "smoke-test"); _LIT(KCmndArgument, "argument"); _LIT(KCmndOption, "option"); _LIT(KCmndInclude, "include"); @@ -315,6 +316,23 @@ { iCopyright.Set(TextToNextCommand(aLex)); } + else if (command == KCmndSmokeTest) + { + // Hmm no easy way to get the line number we're currently on + iSmokeTestLineNumber = 1; + TLex lex(aLex); + lex.Inc(-aLex.Offset()); // Only way to put a TLex back to the beginning! + TPtrC preceding = lex.Remainder().Left(aLex.Offset()); + const TUint16* ptr = preceding.Ptr(); + const TUint16* end = ptr + preceding.Length(); + while (ptr != end) + { + if (*ptr++ == '\n') iSmokeTestLineNumber++; + } + // At this point iSmokeTestLineNumber points to the "==smoketest" line - add 2 to skip this line and the blank line below it + iSmokeTestLineNumber += 2; + iSmokeTest.Set(TextToNextCommand(aLex)); + } else if (command == KCmndArgument) { ReadArgumentL(aLex, aFileName); @@ -813,6 +831,16 @@ return iCopyright; } +EXPORT_C const TDesC& CCommandInfoFile::SmokeTest() const + { + return iSmokeTest; + } + +EXPORT_C TInt CCommandInfoFile::GetSmokeTestStartingLineNumber() const + { + return iSmokeTestLineNumber; + } + EXPORT_C const RCommandArgumentList& CCommandInfoFile::Arguments() { return iArguments; @@ -891,3 +919,8 @@ : iFileName(aParent.iFileName), iParent(&aParent) { } + +EXPORT_C const TDesC& CCommandInfoFile::CifFileName() const + { + return iFileName; + } diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/eabi/iocliu.def --- a/libraries/iosrv/eabi/iocliu.def Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/eabi/iocliu.def Wed Oct 13 12:53:17 2010 +0100 @@ -626,4 +626,7 @@ _ZTIN7IoUtils20MCommandExtensionsV2E @ 625 NONAME _ZTVN7IoUtils20MCommandExtensionsV2E @ 626 NONAME _ZN7IoUtils10TFileName29NormalizeER3RFs @ 627 NONAME + _ZNK7IoUtils16CCommandInfoFile9SmokeTestEv @ 628 NONAME + _ZNK7IoUtils16CCommandInfoFile11CifFileNameEv @ 629 NONAME + _ZNK7IoUtils16CCommandInfoFile30GetSmokeTestStartingLineNumberEv @ 630 NONAME diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/inc/ioutils.h --- a/libraries/iosrv/inc/ioutils.h Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/inc/ioutils.h Wed Oct 13 12:53:17 2010 +0100 @@ -579,11 +579,14 @@ IMPORT_C static CCommandInfoFile* NewL(RFs& aFs, const TDesC& aFileName); IMPORT_C static CCommandInfoFile* NewL(RFs& aFs, const CEnvironment& aEnvironment, const TDesC& aCommandName); IMPORT_C ~CCommandInfoFile(); + IMPORT_C const TDesC& CifFileName() const; IMPORT_C const TDesC& Name() const; IMPORT_C const TDesC& ShortDescription() const; IMPORT_C const TDesC& LongDescription() const; IMPORT_C const TDesC& SeeAlso() const; IMPORT_C const TDesC& Copyright() const; + IMPORT_C const TDesC& SmokeTest() const; + IMPORT_C TInt GetSmokeTestStartingLineNumber() const; IMPORT_C const RCommandArgumentList& Arguments(); IMPORT_C const RCommandOptionList& Options() const; IMPORT_C void AssignL(RCommandArgumentList& aArguments, RCommandOptionList& aOptions) const; @@ -609,6 +612,8 @@ TPtrC iLongDescription; TPtrC iSeeAlso; TPtrC iCopyright; + TPtrC iSmokeTest; + TInt iSmokeTestLineNumber; RCommandArgumentList iArguments; RCommandOptionList iOptions; RArray iBufs; diff -r 91da8db1df45 -r 84fefe1cd57f libraries/iosrv/server/console.cpp --- a/libraries/iosrv/server/console.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/libraries/iosrv/server/console.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -581,7 +581,7 @@ //______________________________________________________________________________ // TConsoleSetTitleRequest CIoConsole::TConsoleSetTitleRequest::TConsoleSetTitleRequest(MIoWriter& aWriter) - : TConsoleWriterRequest(aWriter) + : TConsoleWriterRequest(aWriter), iTitle(NULL) { } diff -r 91da8db1df45 -r 84fefe1cd57f plugins/consoles/docs/consoles.pod --- a/plugins/consoles/docs/consoles.pod Thu Oct 07 16:23:29 2010 +0100 +++ b/plugins/consoles/docs/consoles.pod Wed Oct 13 12:53:17 2010 +0100 @@ -222,6 +222,8 @@ Cons: +=over 5 + =item * Requires Carbide and the Carbide Terminal Keyboard plugin to be installed. diff -r 91da8db1df45 -r 84fefe1cd57f plugins/consoles/win32cons/src/console.cpp --- a/plugins/consoles/win32cons/src/console.cpp Thu Oct 07 16:23:29 2010 +0100 +++ b/plugins/consoles/win32cons/src/console.cpp Wed Oct 13 12:53:17 2010 +0100 @@ -25,6 +25,7 @@ CWin32Console::~CWin32Console() { + CleanupUnderlyingConsole(); iWin32.FreeConsole(); // when call FreeConsole(), it should cause the reader thread to exit as the // console read handle will become invalid, and windows will complete the @@ -61,7 +62,8 @@ err = iReaderThread.Create(KReadThreadName, ReaderThread, 0x800, KMinHeapSize, KMinHeapSize*4, &iThreadParams); if (err!=KErrNone) return err; iReaderThread.Resume(); - + CleanupUnderlyingConsole(); + return KErrNone; } diff -r 91da8db1df45 -r 84fefe1cd57f tools/baserom --- a/tools/baserom Thu Oct 07 16:23:29 2010 +0100 +++ b/tools/baserom Wed Oct 13 12:53:17 2010 +0100 @@ -152,6 +152,11 @@ open TSHELL_NEW, ">$newObyName" or die "Can't write to $newObyName: $!\n"; print "Creating tshell_$obyName.oby\n"; + + if ($extraInclude) { + print TSHELL_NEW "#include \"$obyName/$extraInclude\"\n"; + } + while (my $line = ) { print TSHELL_NEW "$line"; @@ -221,7 +226,6 @@ open IBYCPP, "$cmd |" or die "Can't run '$cmd': $!\n"; while (my $line = ) { chomp $line; - #print "TOMSCI: $line\n"; if ($line =~ m/^BASEROMHASHINCLUDE\s+[<"](.*)[>"]/ ) { my $iby = $1; if (!$ibysProcessed{lc($iby)}) {