Ejemplo n.º 1
0
int CDECL main(int aArgc, char* aArgv[])
{
	InitialisationParams* initParams = InitialisationParams::Create();

    OptionParser parser;
    OptionUint optionDuration("-d", "--duration", 30, "Number of seconds to run the test");
    parser.AddOption(&optionDuration);
    if (!parser.Parse(aArgc, aArgv)) {
        return (1);
    }

    Library* lib = new Library(initParams);
    std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
    TIpAddress subnet = (*subnetList)[0]->Subnet();
    Library::DestroySubnetList(subnetList);
    CpStack* cpStack = lib->StartCp(subnet);

    // Debug::SetLevel(Debug::kTopology);

	ReceiverManager1Logger* logger = new ReceiverManager1Logger(*cpStack);
	
    Blocker* blocker = new Blocker(lib->Env());
    blocker->Wait(optionDuration.Value());
    delete blocker;
	
	delete (logger);

	Print("Closing ... ");
	delete lib;
	Print("closed\n");
}
Ejemplo n.º 2
0
void OpenHome::TestFramework::Runner::Main(TInt /*aArgc*/, TChar* /*aArgv*/[], Net::InitialisationParams* aInitParams)
{
    Library* lib = new Library(aInitParams);
    std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
    TIpAddress subnet = (*subnetList)[0]->Subnet();
    TIpAddress addr = (*subnetList)[0]->Address();
    Endpoint endpt(0, addr);
    Endpoint::AddressBuf buf;
    endpt.AppendAddress(buf);
    Print("Connect to %s:%u then 'help' for options\n\n", buf.Ptr(), Shell::kServerPortDefault);
    Library::DestroySubnetList(subnetList);
    CpStack* cpStack = NULL;
    DvStack* dvStack = NULL;
    lib->StartCombined(subnet, cpStack, dvStack);

    Shell* shell = new Shell(cpStack->Env());
    Semaphore* blocker = new Semaphore("BLCK", 0);

    std::vector<ShellTest> shellTests;
    shellTests.push_back(ShellTest("TestBuffer", RunTestBuffer));
    shellTests.push_back(ShellTest("TestThread", RunTestThread));
    shellTests.push_back(ShellTest("TestFifo", RunTestFifo));
    shellTests.push_back(ShellTest("TestQueue", RunTestQueue));
    shellTests.push_back(ShellTest("TestTextUtils", RunTestTextUtils));
    shellTests.push_back(ShellTest("TestNetwork", RunTestNetwork, true));
    shellTests.push_back(ShellTest("TestTimer", RunTestTimer));
    shellTests.push_back(ShellTest("TestSsdpMListen", RunTestSsdpMListen, true));
    shellTests.push_back(ShellTest("TestSsdpUListen", RunTestSsdpUListen, true));
    shellTests.push_back(ShellTest("TestDeviceList", RunTestDeviceList, true));
    shellTests.push_back(ShellTest("TestInvocation", RunTestInvocation));
    shellTests.push_back(ShellTest("TestSubscription", RunTestSubscription));
    shellTests.push_back(ShellTest("TestCpDeviceDv", RunTestCpDeviceDv));
    shellTests.push_back(ShellTest("TestDviDiscovery", RunTestDviDiscovery));
    shellTests.push_back(ShellTest("TestDviDeviceList", RunTestDviDeviceList));
    shellTests.push_back(ShellTest("TestDvInvocation", RunTestDvInvocation));
    shellTests.push_back(ShellTest("TestDvSubscription", RunTestDvSubscription));
    shellTests.push_back(ShellTest("TestDvLpec", RunTestDvLpec));
    shellTests.push_back(ShellTest("TestException", RunTestException));
    shellTests.push_back(ShellTest("TestFunctorGeneric", RunTestFunctorGeneric));
    shellTests.push_back(ShellTest("TestXmlParser", RunTestXmlParser));

    ShellCommandRun* cmdRun = new ShellCommandRun(*cpStack, *dvStack, *shell, shellTests);
    ShellCommandDebug* cmdDebug = new ShellCommandDebug(*shell);
    ShellCommandQuit* cmdQuit = new ShellCommandQuit(*shell, *blocker);
    ShellCommandWatchDog* cmdWatchDog = new ShellCommandWatchDog(*shell, 60); // default to 60s watchdog. This can be changed at runtime by client.
    blocker->Wait();
    // control never reaches here
    delete blocker;
    delete cmdWatchDog;
    delete cmdQuit;
    delete cmdDebug;
    delete cmdRun;
    delete shell;
    delete lib;
}
Ejemplo n.º 3
0
void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], Net::InitialisationParams* aInitParams)
{
    OptionParser parser;
    OptionBool loopback("-l", "--loopback", "Use the loopback adapter only");
    parser.AddOption(&loopback);
    if (!parser.Parse(aArgc, aArgv) || parser.HelpDisplayed()) {
        return;
    }
    if (loopback.Value()) {
        aInitParams->SetUseLoopbackNetworkAdapter();
    }
    aInitParams->SetDvUpnpServerPort(0);
    Library* lib = new Library(aInitParams);
    std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
    TIpAddress subnet = (*subnetList)[0]->Subnet();
    Library::DestroySubnetList(subnetList);
    CpStack* cpStack = NULL;
    DvStack* dvStack = NULL;
    lib->StartCombined(subnet, cpStack, dvStack);

    TestDvSubscription(*cpStack, *dvStack);

    delete lib;
}