kerneltest/e32test/power/t_powermisctest.cpp
changeset 245 647ab20fee2e
equal deleted inserted replaced
244:a77889bee936 245:647ab20fee2e
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\power\t_powermisctest.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32test.h>
       
    19 #include <e32hal.h>
       
    20 #include "d_powermisctest.h"
       
    21 #include <e32power.h>
       
    22 #include <e32svr.h>
       
    23 #include <hal.h>
       
    24 #include <u32hal.h>
       
    25 
       
    26 _LIT(KLddFileName, "D_POWERMISCTEST.LDD");
       
    27 
       
    28 RLddTest1 ldd;
       
    29 GLDEF_D RTest test(_L("T_POWERMISCTEST"));
       
    30 
       
    31 void DoTests()
       
    32 	{
       
    33 	TInt r = KErrNone;
       
    34 
       
    35 	test.Printf(_L("Loading logical device \n"));
       
    36 	r=User::LoadLogicalDevice(KLddFileName);
       
    37 	test(r == KErrNone);
       
    38 
       
    39 	test.Printf(_L("Opening of logical device\n"));
       
    40 	r = ldd.Open();
       
    41 	test(r == KErrNone);
       
    42 
       
    43 	test.Printf(_L("Start tests\n"));
       
    44 	r = ldd.Test();
       
    45 	test(r == KErrNone);
       
    46 
       
    47 	test.Printf(_L("Closing the channel\n"));
       
    48 	ldd.Close();
       
    49 
       
    50 	test.Printf(_L("Freeing logical device\n"));
       
    51 	r = User::FreeLogicalDevice(KLddFileName);;
       
    52 	test(r==KErrNone);
       
    53 
       
    54 	}
       
    55 
       
    56 GLDEF_C TInt E32Main()
       
    57 	{
       
    58 	test.Start(_L("Power misc tests"));
       
    59 	const TInt numCpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
       
    60 	if(numCpus > 1)
       
    61 		{
       
    62 		DoTests();
       
    63 		}
       
    64 	else
       
    65 		{
       
    66 		test.Printf(_L("Not supported in unicore.\n"));
       
    67 		}
       
    68 	test.End();
       
    69 	test.Close();	
       
    70 
       
    71 	return(KErrNone);
       
    72 	}