loggingservices/eventlogger/test/src/t_logenvcreate.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 // 
    16 // 
    17 //
    17 //
    18 
    18 
    19 #include <e32test.h>
    19 #include <e32test.h>
    20 #include <bautils.h>
    20 #include <bautils.h>
       
    21 #include "t_logutil.h"
    21 
    22 
    22 RTest TheTest(_L("t_logenvcreate - copying EventLogger test files to C:"));
    23 RTest TheTest(_L("t_logenvcreate - copying EventLogger test files to C:"));
    23 
    24 
    24 _LIT(KContactsServerName, "!CNTSRV");
    25 _LIT(KContactsServerName, "!CNTSRV");
    25 
    26 
    28 _LIT(KZFileName1, "z:\\private\\101f401d\\CntModel.ini");
    29 _LIT(KZFileName1, "z:\\private\\101f401d\\CntModel.ini");
    29 _LIT(KZFileName2, "z:\\private\\101f401d\\SQLite__Contacts.cdb");
    30 _LIT(KZFileName2, "z:\\private\\101f401d\\SQLite__Contacts.cdb");
    30 
    31 
    31 _LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini");
    32 _LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini");
    32 _LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb");
    33 _LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb");
    33 
       
    34 ///////////////////////////////////////////////////////////////////////////////////////
       
    35 ///////////////////////////////////////////////////////////////////////////////////////
       
    36 //Test macros and functions
       
    37 static void Check(TInt aValue, TInt aExpected, TInt aLine)
       
    38 	{
       
    39 	if(aValue != aExpected)
       
    40 		{
       
    41 		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
       
    42 		TheTest(EFalse, aLine);
       
    43 		}
       
    44 	}
       
    45 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
       
    46 
       
    47 ///////////////////////////////////////////////////////////////////////////////////////
       
    48 
       
    49 static void KillProcess(const TDesC& aProcessName)
       
    50     {
       
    51     TFullName name;
       
    52     TheTest.Printf(_L(":: Find and kill \"%S\" process.\n"), &aProcessName);
       
    53     TBuf<64> pattern(aProcessName);
       
    54     TInt length = pattern.Length();
       
    55     pattern += _L("*");
       
    56     TFindProcess procFinder(pattern);
       
    57 
       
    58     while (procFinder.Next(name) == KErrNone)
       
    59         {
       
    60         if (name.Length() > length)
       
    61             {//If found name is a string containing aProcessName string.
       
    62             TChar c(name[length]);
       
    63             if (c.IsAlphaDigit() || c == TChar('_') || c == TChar('-'))
       
    64                 {
       
    65                 // If the found name is other valid application name
       
    66                 // starting with aProcessName string.
       
    67                 TheTest.Printf(_L(":: Process name: \"%S\".\n"), &name);
       
    68                 continue;
       
    69                 }
       
    70             }
       
    71         RProcess proc;
       
    72         if (proc.Open(name) == KErrNone)
       
    73             {
       
    74             proc.Kill(0);
       
    75             TheTest.Printf(_L(":: \"%S\" process killed.\n"), &name);
       
    76             }
       
    77         proc.Close();
       
    78         }
       
    79     }
       
    80 
    34 
    81 void DoRun()
    35 void DoRun()
    82 	{
    36 	{
    83     RFs fs;
    37     RFs fs;
    84 	TInt err = fs.Connect();
    38 	TInt err = fs.Connect();