os/kernelhwsrv/kerneltest/e32test/nkern/t_crazyints.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/nkern/t_crazyints.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,83 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// navienginebsp\ne1_tb\test\interrupts\t_ints.cpp
    1.18 +//
    1.19 +// Overview:
    1.20 +// user-side test for Crazy-Interrupts functionality
    1.21 +//
    1.22 +//
    1.23 +#include <e32test.h>
    1.24 +#include <e32cmn.h>
    1.25 +#include "d_crazyints.h"
    1.26 +
    1.27 +_LIT(testName,"t_crazyints");
    1.28 +_LIT(KLddFileName, "d_crazyints.ldd");
    1.29 +_LIT(KLddFileNameRoot, "d_crazyints");
    1.30 +
    1.31 +// global data..
    1.32 +GLDEF_D RTest IntsTest(testName);
    1.33 +GLDEF_D RBusIntTestClient IntsTestLdd; // Channel to kernel-side proxy
    1.34 +
    1.35 +EXPORT_C TInt E32Main()
    1.36 +	{
    1.37 +	IntsTest.Title();
    1.38 +	IntsTest.Start(_L("Test crazy interrupts"));
    1.39 +
    1.40 +	// Load the Test Driver
    1.41 +	TInt r = User::LoadLogicalDevice(KLddFileName);
    1.42 +	if(r != KErrNone && r != KErrAlreadyExists)
    1.43 +		{
    1.44 +		// fail..
    1.45 +		IntsTest.Printf(_L("\nFailed to load the device  driver, r=%d"), r);
    1.46 +		IntsTest(EFalse);
    1.47 +		}
    1.48 +
    1.49 +	// Open the driver
    1.50 +	TBufC<11> proxyName(KLddFileNameRoot);
    1.51 +	r = IntsTestLdd.Open(proxyName);
    1.52 +	if(r == KErrNone)
    1.53 +		{
    1.54 +		// run the test..
    1.55 +		r = IntsTestLdd.TestCrazyInts();
    1.56 +
    1.57 +		if(r == KErrNotSupported)
    1.58 +			IntsTest.Printf(_L("CrazyInterrupts are not enabled\n\r"));
    1.59 +		}
    1.60 +	else
    1.61 +		{
    1.62 +		IntsTest.Printf(_L("Failed to open the driver (r=%d)"), r);
    1.63 +		if(r == KErrNotSupported)
    1.64 +			{
    1.65 +			IntsTest.Printf(_L(": Not SMP platform..\n"), r);
    1.66 +			}
    1.67 +		else
    1.68 +			{
    1.69 +			IntsTest(r); // fail..
    1.70 +			}
    1.71 +		}
    1.72 +
    1.73 +	// Close the driver
    1.74 +	IntsTestLdd.Close();
    1.75 +
    1.76 +	// unload the driver
    1.77 +	User::FreeLogicalDevice(KLddFileName);
    1.78 +
    1.79 +	// check results..
    1.80 +	IntsTest((r == KErrNone) || (r == KErrNotSupported));
    1.81 +
    1.82 +	IntsTest.End();
    1.83 +
    1.84 +	return KErrNone;
    1.85 +	}
    1.86 +