kerneltest/e32test/hcr/t_hcrut.cpp
changeset 0 a41df078684a
child 4 56f325a607ea
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2008-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 // Hardware Configuration Respoitory Test Application
       
    15 //
       
    16 
       
    17 #define __E32TEST_EXTENSION__
       
    18 #include <e32test.h>
       
    19 #include <e32svr.h>
       
    20 #include <u32hal.h>
       
    21 #include <hal.h>
       
    22 #include <hal_data.h>
       
    23 #include "d_hcrut.h"
       
    24 
       
    25 #define __TRACE_LINE__()	test.Printf(_L("%d\n"),__LINE__)
       
    26 
       
    27 RTest test(_L("T_HCRUT"));
       
    28 
       
    29 _LIT(KTestDriver,"d_hcrut");
       
    30 	
       
    31 RHcrTest HcrTest;
       
    32 
       
    33 //---------------------------------------------
       
    34 //! @SYMTestCaseID 
       
    35 //! @SYMTestType
       
    36 //! @SYMPREQ 
       
    37 //! @SYMTestCaseDesc
       
    38 //! @SYMTestActions 
       
    39 //!
       
    40 //! @SYMTestExpectedResults 
       
    41 //!		
       
    42 //! @SYMTestPriority 
       
    43 //! @SYMTestStatus
       
    44 //---------------------------------------------
       
    45 TInt TestBasics ()
       
    46 	{
       
    47 	test.Next(_L("Switch repository test"));
       
    48 #ifdef __WINS__
       
    49 	test.Printf(_L("Skipped on the emulator"));
       
    50 #else
       
    51 	test_KErrNone( HcrTest.Test_SwitchRepository());
       
    52 #endif // __WINS__
       
    53 
       
    54 	// Wait for idle + async cleanup (waits for DKernelEventHandler to go away)
       
    55 	TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, (TAny*)5000, 0);
       
    56 	test_KErrNone(r);
       
    57 
       
    58     User::After(5000000);
       
    59     
       
    60     test.Next(_L("Free Physical Memory used for SDRs"));   
       
    61     test_KErrNone( HcrTest.Test_ReleaseSDRs());
       
    62 
       
    63     return KErrNone;
       
    64     }
       
    65 
       
    66 
       
    67 
       
    68 
       
    69 GLDEF_C TInt E32Main()
       
    70     {
       
    71 	TInt r;
       
    72 	    
       
    73     test.Title();
       
    74 	test.Start(_L("=== HCR Test Suite"));
       
    75 
       
    76 
       
    77 	test.Next(_L("=== Open test LDD"));
       
    78 	r = User::LoadLogicalDevice(KTestDriver);
       
    79 	test_Assert((r==KErrNone || r==KErrAlreadyExists),void (0));
       
    80 		
       
    81 	r = HcrTest.Open();
       
    82 	test_KErrNone(r);
       
    83     // Do test cases
       
    84     //
       
    85     TestBasics();
       
    86 
       
    87 	test.Next(_L("=== Close LDD"));
       
    88 	HcrTest.Close();
       
    89 	
       
    90 	r = User::FreeLogicalDevice(RHcrTest::Name());
       
    91     test_KErrNone(r);
       
    92 
       
    93 	test.End();
       
    94 	
       
    95 	return(KErrNone);
       
    96     }
       
    97