void CUT_PBASE_T_USBDI_0479::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(aCompletionCode != KErrNone)
		{	
		TBuf<256> msg;
		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_DUP01, msg);
		}

	if(iCaseStep == EPassed)
		{	
		if(aCompletionCode == KErrNone)
			{
			return TestPassed();
			}
		// else error
	    iCaseStep = EFailed;
		}
	
	if(iCaseStep == EFailed)
		{
		return TestFailed(KErrCompletion);
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
示例#2
0
	void Run()
	{
		mTestState = 0;
		
		SendData();
		// wait 100ms for selector to wake up.
		usleep( 100000 );
	
		if ( mTestState != 2 )
			TestFailed( "Both listeners not called" );
	
		SendData();
		// wait 100ms for selector to wake up.
		usleep( 100000 );
	
		if ( mTestState != 4 )
			TestFailed( "Both listeners not called" );

		SendData();
		// wait 100ms for selector to wake up.
		usleep( 100000 );
	
		if ( mTestState != 6 )
			TestFailed( "Both listeners not called" );

		TestPassed();
	}
void CUT_PBASE_T_USBDI_0486::Ep0TransferCompleteL(TInt aCompletionCode)
	{
    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0486_EP0TRANSFERCOMPLETEL_ENTRY, this );

	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_EP0TRANSFERCOMPLETEL_DUP01, "--->Ep0TransferCompleteL, case step = %d", iCaseStep);

	switch(iCaseStep)
		{
		case EDeviceCConnected:
			{
			if(aCompletionCode != KErrNone)
				{
				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_EP0TRANSFERCOMPLETEL_DUP02, "<Error %d> aCompletionCode != KErrNone",aCompletionCode);
				return TestFailed(aCompletionCode);
				}
			// close interface 0			
			iUsbInterface0.Close();			
			iCaseStep = EWaitForDeviceCDisconnection;
			}
			break; 
			
		case EPassed:
			TestPassed();
			break;		
	
		default:
			TestFailed(KErrCompletion);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0486_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
示例#4
0
	void Run()
	{
		mTestState = 0;
		
		switch( mTestNum )
		{
			case 1:
				Func1();
				// Async Event give it 100ms to be recieved.				
				usleep( 100000 );
				if ( mTestState != 1 )
					TestFailed( "Event not recieved" );
				else if ( sEventCount != 0 )
					TestFailed( "Event count != 0 (%d)", sEventCount );					
				else
					TestPassed();
				break;
				
			case 2:
				Func2( 1, 2 );
				// Sync Event no need to sleep.
				if ( mTestState != 1 )
					TestFailed( "Event not recieved" );
				else if ( sEventCount != 0 )
					TestFailed( "Event count != 0 (%d)", sEventCount );					
				else
					TestPassed();
				break;

			case 3:
				int res = Func3( 3 );
				// Sync Event no need to sleep.
				if ( mTestState != 1 )
					TestFailed( "Event not recieved" );
				else if ( res != 1000 )
					TestFailed( "Result not valid" );					
				else if ( sEventCount != 0 )
					TestFailed( "Event count != 0 (%d)", sEventCount );					
				else
					TestPassed();
				break;
		}
	}	
示例#5
0
文件: tests.cpp 项目: iley/intelib
static bool Test(const char *name, bool result)
{
    if(result) {
        TestPassed(name);
        return true;
    } else {
        TestFailed(name, "");
        return false;
    }
}
示例#6
0
文件: tests.cpp 项目: iley/intelib
static bool Test(const char *name, long tst, long expected)
{
    if(tst == expected) {
        TestPassed(name);
        return true;
    } else {
        TestFailed(name, "result: %d, expected: %d",
                   tst, expected);
        return false;
    }
}
void CUT_PBASE_T_USBDI_0490::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(aCompletionCode != KErrNone)
		{
		if(iCaseStep == EFailed)
			{// ignore error, nad catch the TestFailed method called further down.
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***");
			}
		else
			{
			TBuf<256> msg;
			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_DUP02, msg);
			iCaseStep = EFailed;
			TTestCaseFailed request(aCompletionCode,msg);
			iControlEp0->SendRequest(request,this);
			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_EXIT, this );
			return;
			}
		}
	
	switch(iCaseStep)
		{
		// Test case passed
		case EPassed:
			TestPassed();
			break;
		
		// Test case failed	
		case EFailed:
			TestFailed(KErrCompletion);
			break;
			
		case ETransferOut:
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_DUP03, "Try to send data");
			iOutTransfer[0]->TransferOut(KPayloadPattern);
			break;
		
		case ETransferIn:
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_DUP04, "Try to receive data");
			iInTransfer[0]->TransferIn(KBulkTransferSize);
			break;
	
		default:
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_DUP05, "<Error> Unknown test step");
			TestFailed(KErrUnknown);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0490_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this );
	}
示例#8
0
文件: tests.cpp 项目: iley/intelib
static bool Test(const char *name, const char *tst, const char *expected)
{
    if (tst == expected ||
       (tst && expected && 0 == strcmp(tst, expected))) {
        TestPassed(name);
        return true;
    } else {
        TestFailed(name, "result: \"%s\", expected: \"%s\"",
                   tst, expected);
        return false;
    }
}
void CUT_PBASE_T_USBDI_0485::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
		
	switch(iCaseStep)
		{
		case EInProgress:
			{
			if(aCompletionCode != KErrCancel)
				{
				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP01, "<Error %d> Nakking request was not cancelled by stack",aCompletionCode);
				return TestFailed(aCompletionCode);
				}
		
			// No panic or leave so passed
			
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP02, "No leave or panic occured so open interface again and send test passed");
			
			// Open the interface
			
			TInt err(iUsbInterface0.Open(iToken0));
			if(err != KErrNone)
				{
				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP03, "<Error %d> Unable to open interface 0", err);
				return TestFailed(err);
				}
			
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP04, "Interface 0 re-opened");
			
			iCaseStep = EPassed;
			TTestCasePassed request;
			iControlEp0->SendRequest(request,this);			
			}
			break;
			
		case EPassed:
			TestPassed();
			break;
			
		case EFailed:
		default:
			TestFailed(KErrCompletion);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
void CUT_PBASE_T_USBDI_0474::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0474_EP0TRANSFERCOMPLETEL_ENTRY, this );
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0474_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(iCaseStep == EPassed)
		{
		TestPassed();
		}
		
	if(iCaseStep == EFailed)
		{
		TestFailed(KErrCompletion);
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0474_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
    void CUT_PBASE_T_USBDI_1231::Ep0TransferCompleteL(TInt aCompletionCode)
        {
        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_ENTRY, this );
        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP23, "Ep0TransferCompleteL with aCompletionCode = %d",
                aCompletionCode);
        switch (iCaseStep)
            {

            default:
            case EFailed:
                TestFailed(KErrCompletion);
                break;

            case EPassed:
                TestPassed();
                break;
            }
        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_EXIT, this );
        }
示例#12
0
	void Run()
	{	
		Regex r;
		std::string dump;
		
		JetHead::ErrCode err = r.prepare( gPrepareTests[ mTestNum ].regex );

		if ( gPrepareTests[ mTestNum ].pass && err != JetHead::kNoError )
			TestFailed( "Prepare returned error code" );
		else if ( gPrepareTests[ mTestNum ].pass == false && err == JetHead::kNoError )
			TestFailed( "Prepare did not return error code" );
			
		r.dumpTree( dump );
		if ( dump == gPrepareTests[ mTestNum ].tree )
			TestPassed();
		else
		{
			LOG_NOTICE( "dump is: %s", dump.c_str() );
			LOG_NOTICE( "expected: %s", gPrepareTests[ mTestNum ].tree );
			LOG_NOTICE( "on regex: %s", gPrepareTests[ mTestNum ].regex );
			TestFailed( "Tree dump miss-match" );
		}
	}
示例#13
0
	void Run()
	{	
		Regex r;
		std::string dump;
		
		JetHead::ErrCode err = r.prepare( gParseTests[ mTestNum ].regex );

		if ( err != JetHead::kNoError )
			TestFailed( "Prepare returned error code" );

		bool res = r.parse( gParseTests[ mTestNum ].tree );
		
		if ( gParseTests[ mTestNum ].pass != res )
		{
			LOG_NOTICE( "Parse %s", res ? "succeeded" : "failed" );
			LOG_NOTICE( "string: %s", gParseTests[ mTestNum ].tree );
			LOG_NOTICE( "regex: %s", gParseTests[ mTestNum ].regex );
			TestFailed( "Parse failed to match expected result" );
		}			

		for ( int i = 0; i < 5; i++ )
		{
			if ( gParseTests[ mTestNum ].groups[ i ] != NULL )
			{
				std::string s = r.getData( i );
				if ( s != gParseTests[ mTestNum ].groups[ i ] )
				{
					LOG_NOTICE( "Got %s for group %d", s.c_str(), i );
					LOG_NOTICE( "Expected %s", gParseTests[ mTestNum ].groups[ i ] );
					TestFailed( "Group does not match" );
				}
			}
		}
		
		TestPassed();
	}
void CUT_PBASE_T_USBDI_0475::ExecuteHostTestCaseL()	
	{	
	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_EXECUTEHOSTTESTCASEL_ENTRY, this );
	TInt err(KErrNone);
	
	TUsbGenericDescriptor* parsed = NULL;
	TUsbDeviceDescriptor* devDesc = 0;
	TUsbConfigurationDescriptor* configDesc = 0;
	
	// Parse Device Descriptor
	err	= UsbDescriptorParser::Parse(KDeviceDescriptorData, parsed);
	CHECK(err == KErrNone) // KErrNone
	devDesc = TUsbDeviceDescriptor::Cast(parsed);
	CHECK(devDesc != 0)	
	CHECK(err == KErrNone) // KErrNone
	
	// Parse Configuration Descriptor ---------- Case 1
	err	= UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase1, parsed);
	configDesc = TUsbConfigurationDescriptor::Cast(parsed);

	CHECK(configDesc == 0)
	CHECK(err == KErrCorrupt) // no tree generated
		
	// Parse Configuration Descriptor ---------- Case 2
	err	= UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase2, parsed);
	configDesc = TUsbConfigurationDescriptor::Cast(parsed);

	CHECK(configDesc == 0) // tree is freed if there are errors, refer to source code
	CHECK(err == KErrCorrupt) // KErrCorrupt
	
	// Parse Configuration Descriptor ---------- Case 3
	CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorUnexpectedLengthTestCase3, 3) == KErrNone);

	TestPassed();	
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_EXECUTEHOSTTESTCASEL_EXIT, this );
	}   
示例#15
0
// handle event completion
void CTestCase0469::RunStepL()
{
    if(gVerboseOutput)
    {
        OstTraceFunctionEntry0(CTESTCASE0469_RUNSTEPL);
    }
    // Obtain the completion code for this CActive obj.
    TInt completionCode(iStatus.Int());
    TBuf<MAX_DSTRLEN> aDescription;
    //	15 seconds, should be plenty of time for 3 cycles of plug pulling
    const TInt KTestCase0469Timeout = 15000;

    switch(iCaseStep)
    {
    case EPreconditions:
        LOG_STEPNAME(_L("EPreconditions"))
        iCaseStep = ELoadLdd;
        // prompt to insert connectors
        test.Printf(KInsertBCablePrompt);
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP01, KInsertBCablePrompt);
        test.Printf(KRemoveAFromPC);
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP02, KRemoveAFromPC);
        test.Printf(KPressAnyKeyToContinue);
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP03, KPressAnyKeyToContinue);
        RequestCharacter();
        break;

    case ELoadLdd:
        LOG_STEPNAME(_L("ELoadLdd"))
        if (!StepLoadClient(0xF678/*use default settings for SRP/HNP support*/))
        {
            return TestFailed(KErrAbort, _L("Client Load Failure"));
        }

        if (!StepLoadLDD())
        {
            return TestFailed(KErrAbort, _L("OTG Load Failure"));
        }

        // subscribe to OTG states,events and messages now that it has loaded OK
        TRAPD(result, iCollector.CreateObserversL(*this));
        if (KErrNone != result)
        {
            return(TestFailed(KErrNoMemory, _L("Unable to create observers")));
        }
        iCollector.ClearAllEvents();

        iCaseStep = ELoopControl;

        iCollector.AddStepTimeout(KTestCase0469Timeout);

        SelfComplete();
        break;

    case ELoopControl:
        LOG_STEPNAME(_L("ELoopControl"))

        // Check for timeout
        if (KTestCaseWatchdogTO == iStatus.Int())
        {
            iCollector.DestroyObservers();
            return TestFailed(KErrAbort, _L("Timeout"));
        }

        if (iRepeats--)
        {
            OstTrace1(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP04, "ELoopControl around again %d", iRepeats);
            iCaseStep = ETestVbusRise;
        }
        else
        {
            OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP05, "ELoopControl we're done");
            iCaseStep = EUnloadLdd;
        }
        SelfComplete();
        break;

    case ETestVbusRise:
        LOG_STEPNAME(_L("ETestVbusRise"))
        // Check for timeout
        if (KTestCaseWatchdogTO == iStatus.Int())
        {
            iCollector.DestroyObservers();
            return TestFailed(KErrAbort, _L("Timeout"));
        }

        iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventVbusRaised);
        iCaseStep = ETestVbusFall;
        test.Printf(KInsertAIntoPC);
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP06, KInsertAIntoPC);
        SetActive();
        break;

    case ETestVbusFall:
        LOG_STEPNAME(_L("ETestVbusFall"))
        // Check for timeout
        if (KTestCaseWatchdogTO == iStatus.Int())
        {
            iCollector.DestroyObservers();
            return TestFailed(KErrAbort, _L("Timeout"));
        }

        iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventVbusDropped);
        iCaseStep = ELoopControl;
        test.Printf(KRemoveAFromPC);
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP07, KRemoveAFromPC);
        SetActive();
        break;

    case EUnloadLdd:
        LOG_STEPNAME(_L("EUnloadLdd"))
        iCollector.DestroyObservers();
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP08, "Destroyed observers");
        if (EFalse == StepUnloadLDD())
            return TestFailed(KErrAbort,_L("unload Ldd failure"));
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP09, "unloaded ldd");
        if (!StepUnloadClient())
            return TestFailed(KErrAbort,_L("Client Unload Failure"));
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP10, "unloaded client");

        iCaseStep = ELastStep;
        SelfComplete();
        break;

    case ELastStep:
        LOG_STEPNAME(_L("ELastStep"))
        TestPassed();
        break;

    default:
        test.Printf(_L("<Error> unknown test step"));
        OstTrace0(TRACE_NORMAL, CTESTCASE0469_RUNSTEPL_DUP11, "<Error> unknown test step");
        Cancel();
        return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
    }
}
void CUT_PBASE_T_USBDI_0480::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(aCompletionCode != KErrNone)
		{
		if(iCaseStep == EFailed)
			{
			}
		else
			{
			TBuf<256> msg;
			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL_DUP01, msg);
			iCaseStep = EFailed;
			TTestCaseFailed request(aCompletionCode,msg);
			iControlEp0->SendRequest(request,this);
			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL_EXIT, this );
			return;
			}
		}
	
	switch(iCaseStep)
		{
		// Test case passed	
		case EPassed:
			TestPassed();
			break; 
		
		// Test case failed		
		case EFailed:
			TestFailed(KErrCompletion);
			break;
			
		// Send an empty interface directed request		
		case EEmptyDeviceXfer:
			{
			iCaseStep = EEmptyInterfaceXfer;
			TEmptyInterfaceRequest request(1); // Direct at interface 1
			iControlEp0->SendRequest(request,this);
			}
			break;	
		
		// Send a test payload request to device directed 		
		case EEmptyInterfaceXfer:
			{
			iCaseStep = EDataPutDeviceXfer;
			TDevicePutPayloadRequest request(KDataPayload);
			iControlEp0->SendRequest(request,this);
			}
			break;
			
		// Send a test payload request to interface directed		
		case EDataPutDeviceXfer:
			{
			iCaseStep = EDataPutInterfaceXfer;
			TInterfacePutPayloadRequest request(1,KDataPayload); // Direct at interface 1
			iControlEp0->SendRequest(request,this);
			}
			break;
			
		// Test case passed		
		case EDataPutInterfaceXfer:
			{
			iCaseStep = EPassed;
			User::After(1000000);
			TTestCasePassed request;
			iControlEp0->SendRequest(request,this);			
			}
			break;
			
		default:
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL_DUP02, "<Error> Unknown test step");
			TestFailed(KErrUnknown);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this );
	}
示例#17
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int main (int argc, char*  argv[])
{
  // Instantiate the QCoreApplication that we need to get the current path and load plugins.
  QCoreApplication app(argc, argv);
  QCoreApplication::setOrganizationName("BlueQuartz Software");
  QCoreApplication::setOrganizationDomain("bluequartz.net");
  QCoreApplication::setApplicationName("PipelineRunnerTest");


  // We need to change our working directory into the "DREAM3D_Data" directory because all the pipelines use relative paths
  QDir dataDir = QDir(getDream3dDataDir());
#ifdef _MSC_VER
  _chdir(dataDir.absolutePath().toLatin1().constData());
#else
  chdir(dataDir.absolutePath().toLatin1().constData());
#endif


  // Register all the filters including trying to load those from Plugins
  FilterManager* fm = FilterManager::Instance();
  SIMPLibPluginLoader::LoadPluginFilters(fm);

  // Send progress messages from PipelineBuilder to this object for display
  QMetaObjectUtilities::RegisterMetaTypes();


  int err = 0;
  // Read in the contents of the PipelineList file which contains all the Pipelines that we want
  // to execute
  QString contents;
  {
    // Read the Source File
    QFileInfo fi(getPipelineListFile());
    QFile source(getPipelineListFile());
    source.open(QFile::ReadOnly);
    contents = source.readAll();
    source.close();
  }
  // Split the file into tokens using the newline character
  QStringList list = contents.split(QRegExp("\\n"));
  QStringListIterator sourceLines(list);

  // Iterate over all the entries in the file and process each pipeline. Note that the order of the
  // pipelines will probably matter
  int testNum = 0;
  while (sourceLines.hasNext())
  {
    QString pipelineFile = sourceLines.next();
    pipelineFile = pipelineFile.trimmed();
    if(pipelineFile.isEmpty()) { continue; }
    try
    {
      QFileInfo fi(pipelineFile);

      pipelineFile = AdjustOutputDirectory(pipelineFile);

      DREAM3D::unittest::CurrentMethod = fi.fileName().toStdString();
      DREAM3D::unittest::numTests++;

      std::cout << "\"" << testNum++ << "\": {" << std::endl;

      ExecutePipeline(pipelineFile);

      TestPassed(fi.fileName().toStdString());
      std::cout << "}," << std::endl;
      DREAM3D::unittest::CurrentMethod = "";
    }
    catch (TestException& e)
    {
      TestFailed(DREAM3D::unittest::CurrentMethod);
      std::cout << e.what() << std::endl;
      err = EXIT_FAILURE;
    }
  }

  QDir tempDir(getTestTempDirectory());
  tempDir.removeRecursively();

  return err;
}
void CUT_PBASE_T_USBDI_0498::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(aCompletionCode != KErrNone)
		{
		if(iCaseStep == EFailed)
			{// ignore error, nad catch the TestFailed method called further down.
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***");
			}
		else
			{
			TBuf<256> msg;
			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP02, msg);
			iCaseStep = EFailed;
			TTestCaseFailed request(aCompletionCode,msg);
			iControlEp0->SendRequest(request,this);
			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_EXIT, this );
			return;
			}
		}
	
	switch(iCaseStep)
		{
		// Test case passed
		case EPassed:
			TestPassed();
			break;
		
		// Test case failed	
		case EFailed:
			TestFailed(KErrCompletion);
			break;
		
		case ERequestDeviceIFC1Read:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP03, "Asking client for 'Read' on interface 2");
			iCaseStep = ERequestDeviceIFC2Read;	
			TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
			iControlEp0->SendRequest(request,this);
			}
			break;
			
		case ERequestDeviceIFC2Read:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP04, "Asking client to 'Write' on interface 1");
			iCaseStep = ERequestDeviceIFC1Write;	
			TEndpointPatternWriteRequest request(1,1,KLiteralFrench4(),KDeviceNumWriteBytes);
			iControlEp0->SendRequest(request,this);
			}
			break;
			
		case ERequestDeviceIFC1Write:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP05, "Asking client to 'Write' on interface 2");
			iCaseStep = ERequestDeviceIFC2Write;	
			TEndpointPatternWriteRequest request(2,1,KLiteralEnglish2(),KDeviceNumWriteBytes);
			iControlEp0->SendRequest(request,this);
			}
			break;
			
		case ERequestDeviceIFC2Write:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP06, "Try to perform ALL transfers on BOTH interfaces");
	
			iCaseStep = ETransfer;	
	
			iStartTime[0].HomeTime();
			iStartTime[1].HomeTime();
			iStartTime[2].HomeTime();
			iStartTime[3].HomeTime();
	
			iIfc1OutTransfer[0]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, EFalse);
			iIfc1OutTransfer[1]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
			iIfc2OutTransfer[0]->TransferOut(KLiteralEnglish2(), KHostNumWriteBytes1, EFalse);
			iIfc2OutTransfer[1]->TransferOut(KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
	
			iIfc1InTransfer[0]->TransferIn(KHostNumReadBytes1);
			iIfc1InTransfer[1]->TransferIn(KHostNumReadBytes2);
			iIfc2InTransfer[0]->TransferIn(KHostNumReadBytes1);
			iIfc2InTransfer[1]->TransferIn(KHostNumReadBytes2);
			}
			break;
			
		case ERequestDeviceValidateIFC1:
			{
			iCaseStep = ERequestDeviceValidationResultIFC1;
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP07, "Interface 1: Request Client Validation Result");
			iRequestDeviceValidationResultPtr.Set(iInBuffer->Des());
			iRequestDeviceValidationResultPtr.Zero(); //reset
			iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength);
			TInterfaceGetPayloadRequest request(1,iRequestDeviceValidationResultPtr);
			iControlEp0->SendRequest(request,this);
			}
			break;
		
		case ERequestDeviceValidationResultIFC1:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP08, "Interface 1: Client Validation Result string ...");
            OstTraceData(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP58, "", iInBuffer->Ptr(), iInBuffer->Length());
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP09, "\n");
			TPtr8 ptr(iInBuffer->Des());
			if(ptr.Compare(KClientPassString) == 0)
				{
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP10, "Client Validation Interface 1 Result is a PASS");
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP11, "Now performing Client Validation for Interface 2");
				iCaseStep = ERequestDeviceValidateIFC2;
				TEndpointStringValidationRequest request(2,1,KLiteralEnglish2(),KDeviceNumReadBytes);
				iControlEp0->SendRequest(request,this);
				}
			else
				{
				TBuf<256> msg;
				msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful"));
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP12, msg);
				iCaseStep = EFailed;
				TTestCaseFailed request(KErrCorrupt,msg);
				iControlEp0->SendRequest(request,this);
				}
			}
			break;
			
		case ERequestDeviceValidateIFC2:
			{
			iCaseStep = ERequestDeviceValidationResultIFC2;
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP13, "Interface 2: Request Client Validation Result");
			iRequestDeviceValidationResultPtr.Set(iInBuffer->Des());
			iRequestDeviceValidationResultPtr.Zero(); //reset
			iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength);
			TInterfaceGetPayloadRequest request(2,iRequestDeviceValidationResultPtr);
			iControlEp0->SendRequest(request,this);
			}
			break;
		
		case ERequestDeviceValidationResultIFC2:
			{
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP14, "Interface 1: Client Validation Result string ...");
            OstTraceData(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP54, "", iInBuffer->Ptr(), iInBuffer->Length());
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP15, "\n");
			TPtr8 ptr(iInBuffer->Des());
			if(ptr.Compare(KClientPassString) == 0)
				{
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP16, "Client Validation Interface 2 Result is a PASS");
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP17, "This is the FINAL check - the whole test has a PASSED");
				iCaseStep = EPassed;
				TTestCasePassed request;
				iControlEp0->SendRequest(request,this);
				}
			else
				{
				TBuf<256> msg;
				msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful"));
				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP18, msg);
				iCaseStep = EFailed;
				TTestCaseFailed request(KErrCorrupt,msg);
				iControlEp0->SendRequest(request,this);
				}
			}
			break;
	
		default:
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP19, "<Error> Unknown test step");
			TestFailed(KErrUnknown);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this );
	}
示例#19
0
int main() {

	GDT::init();
    Console::init();
    IDT::init();
    ExceptionHandler::init_dispatcher();
    IRQ::init();
    InterruptHandler::init_dispatcher();


    /* -- EXAMPLE OF AN EXCEPTION HANDLER -- */

    class DBZ_Handler : public ExceptionHandler {
      public:
      virtual void handle_exception(REGS * _regs) {
        Console::puts("DIVISION BY ZERO!\n");
        for(;;);
      }
    } dbz_handler;

    ExceptionHandler::register_handler(0, &dbz_handler);
	
    /* -- INITIALIZE FRAME POOLS -- */

    FramePool kernel_mem_pool(KERNEL_POOL_START_FRAME,
                              KERNEL_POOL_SIZE,
                              0);
	
    unsigned long process_mem_pool_info_frame = kernel_mem_pool.get_frame();

    FramePool process_mem_pool(PROCESS_POOL_START_FRAME,
                               PROCESS_POOL_SIZE,
                               process_mem_pool_info_frame);
	
    process_mem_pool.mark_inaccessible(MEM_HOLE_START_FRAME, MEM_HOLE_SIZE);

    /* -- INITIALIZE MEMORY (PAGING) -- */
	/* ---- INSTALL PAGE FAULT HANDLER -- */

    class PageFault_Handler : public ExceptionHandler {
      public:
      virtual void handle_exception(REGS * _regs) {
        PageTable::handle_fault(_regs);
      }
    } pagefault_handler;

    ExceptionHandler::register_handler(14, &pagefault_handler);

    PageTable::init_paging(&kernel_mem_pool,
                           &process_mem_pool,
                           4 MB);

    PageTable pt1;

    pt1.load();

    PageTable::enable_paging();

    /* -- INITIALIZE THE TWO VIRTUAL MEMORY PAGE POOLS -- */

    VMPool code_pool(512 MB, 256 MB, &process_mem_pool, &pt1);
    VMPool heap_pool(1 GB, 256 MB, &process_mem_pool, &pt1);
    
    /* -- INITIALIZE THE TIMER (we use a very simple timer).-- */
    
    SimpleTimer timer(100); /* timer ticks every 10ms. */
    InterruptHandler::register_handler(0, &timer);

    /* NOTE: The timer chip starts periodically firing as
             soon as we enable interrupts.
             It is important to install a timer handler, as we
             would get a lot of uncaptured interrupts otherwise. */

    /* -- ENABLE INTERRUPTS -- */

    Machine::enable_interrupts();

    /* -- MOST OF WHAT WE NEED IS SETUP. THE KERNEL CAN START. */

    Console::puts("Hello World!\n");

    /* -- GENERATE MEMORY REFERENCES */

    Console::puts("I am starting with an extensive test of the memory allocator.\n");
    Console::puts("Please be patient...\n");
    Console::puts("Testing the memory allocation on code_pool...\n");
    GenerateMemoryReferences(&code_pool, 50, 100);
    Console::puts("Testing the memory allocation on heap_pool...\n");
    GenerateMemoryReferences(&heap_pool, 50, 100);

   TestPassed();
}
示例#20
0
// handle event completion	
void CTestCase0676::RunStepL()
	{
	if(gVerboseOutput)
	    {
	    OstTraceFunctionEntry0(CTESTCASE0676_RUNSTEPL);
	    }
	// Obtain the completion code for this CActive obj.
	TInt completionCode(iStatus.Int()); 
	TBuf<MAX_DSTRLEN> aDescription;
	TInt err(0);


	switch(iCaseStep)
		{
		case EPreconditions:
			iCaseStep = ELoadLdd;
			if (iAutomated)
				{
				iCaseStep = ELoadLdd;
				SelfComplete();
				break;
				}
			// prompt to insert connector
			test.Printf(KInsertAConnectorPrompt);
			OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP01, KInsertAConnectorPrompt);
			test.Printf(KPressAnyKeyToContinue);
			OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP02, KPressAnyKeyToContinue);
			RequestCharacter();			
			break;
			
		case ELoadLdd:
			// 1. load the LDD and init.
			if (!StepLoadLDD())
				{
				break;
				}
			iCaseStep = EDetectAPlug;
			SelfComplete();
			break;
			
			// 2. detect 'A' plug now
		case EDetectAPlug:
			if (KTestCaseWatchdogTO == iStatus.Int())
				{
				return TestFailed(KErrAbort, _L("User response too slow - FAILED!"));
				}

			// if doing this test in /AUTO mode, we would fail this now
			// however if we can control ID_PIN through an API in future, we turn in on now.
			if (!otgIdPinPresent())
				{
				test.Printf(KInsertAConnectorPrompt);
				OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP03, KInsertAConnectorPrompt);
				test.Printf(KPressAnyKeyToContinue);
				OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP04, KPressAnyKeyToContinue);
				RequestCharacter();

				iCaseStep = EDetectAPlug;
				}
			else
				{
				iCaseStep = ELoopDriveVBus;
				SelfComplete();
				}
			break;
			
			// 3. Control/branch step in the loop
		case ELoopControl:
			if (--iRepeats)
				{
				iCaseStep = ELoopDriveVBus;
				}
			else
				{
				iCaseStep = EUnloadLdd;
				}
			SelfComplete();
			break;
			
		case ELoopDriveVBus:
			// 4. DRIVE VBUS
			iWDTimer->Cancel();
			test.Printf(_L("Drive VBus, iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
			OstTraceExt2(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP05, "Drive VBus, iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
			// test for VBus rise next
			test.Printf(_L("Waiting for VBus Event\n"));
			OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP06, "Waiting for VBus Event\n");
			iStatus = KRequestPending;
			otgQueueOtgVbusNotification( iOTGVBus, iStatus );

			// turn on VBus, since the call is not a Queing a-sync call we do this after the async call
			err = otgBusRequest();	// ok to turn on VBus now
			if (KErrNone != err)
				{
				return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!"));
				}
			iCaseStep = ELoopVerifyVBus;
			iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify);
			SetActive();
			break;
			
		case ELoopVerifyVBus:
			// 5. get VBus rise event
			if (KTestCaseWatchdogTO == iStatus.Int())
				{
				return TestFailed(KErrAbort, _L("Vbus rise not signalled in time - FAILED!"));
				}
			iWDTimer->Cancel();

			otgQueueOtgVbusNotification( iOTGVBus, iStatus );
			otgCancelOtgVbusNotification();
			User::WaitForRequest(iStatus);


			if (iOTGVBus != RUsbOtgDriver::EVbusHigh)
				{
		
				return TestFailed(KErrAbort, _L("Vbus rise NOT 'seen' - FAILED!"));
				}

			// Double-check using the API in a syncronous way too
			// NOTE: once again this is to explore timing issues
			if (!otgVbusPresent())
				{
				return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!"));
				}
			iCaseStep = ELoopWait;
			SelfComplete();
			break;
			
		case ELoopWait:	// 6. wait 50ms after applying Vbus before we are allowed to 
			ContinueAfter(KDelayBeforeBusDropUs, ELoopDropVBus);
			break;
			
		case ELoopDropVBus:
			// 7. drop Bus
			otgQueueOtgVbusNotification(iOTGVBus, iStatus );
			// drop Vbus now, since the call is not a Queing a-sync call we do this after the async call
			otgBusDrop();
			SetActive();
			iCaseStep = ELoopVerifyDrop;
			iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify);
			break;
			
		case ELoopVerifyDrop:
			// 8. get Vbus low event
			if (KTestCaseWatchdogTO == iStatus.Int())
				{
				return TestFailed(KErrAbort, _L("Vbus drop not signalled in time - FAILED!"));
				}
			iWDTimer->Cancel();

			// fetch the value			
			otgQueueOtgVbusNotification( iOTGVBus, iStatus );
			otgCancelOtgVbusNotification();
			User::WaitForRequest(iStatus);

			if (iOTGVBus != RUsbOtgDriver::EVbusLow)
				{
				return TestFailed(KErrAbort, _L("Vbus drop NOT 'seen' - FAILED!"));
				}
				
			// test again using the 'syncronous' variation
			if (otgVbusPresent())
				{
				return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!"));
				}
				
			// wait 50ms and then go back to beginning
			ContinueAfter(KDelayBeforeBusDropUs, ELoopControl);
			break;
			
		case EUnloadLdd:
			// 9. unload
			if (EFalse == StepUnloadLDD())
				return TestFailed(KErrAbort,_L("unload Ldd failure"));	
			
			iCaseStep = ELastStep;
			SelfComplete();
			break;
			
		case ELastStep:
			TestPassed();
			break;
			
		default:
			test.Printf(_L("<Error> unknown test step"));
			OstTrace0(TRACE_NORMAL, CTESTCASE0676_RUNSTEPL_DUP07, "<Error> unknown test step");
			Cancel();
			return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
		}
	}