Exemplo n.º 1
0
def test(packets, delay, device, ip, remote_processes, connections, interface,
         protocol, library):
    setup = '{}_{}_{}_{}_{}'.format(remote_processes, connections, protocol,
                                    device, interface)
    binary = 'xtcp_bombard_{}/bin/{}/xtcp_bombard_{}_{}.xe'.format(
        library.lower(), setup, library.lower(), setup)

    tester = xmostest.CombinedTester(
        2,
        xTCPTester(remote_processes * connections, packets, protocol,
                   'lib_xtcp',
                   device.lower() + '_configuration_tests',
                   '{}_{}'.format(setup, library), {}))

    resources = xmostest.request_resource('xtcp_resources', tester)

    run_job = xmostest.run_on_xcore(resources[device.lower()],
                                    binary,
                                    tester=tester[0],
                                    enable_xscope=True,
                                    timeout=30)

    START_PORT = 15533

    server_job = xmostest.run_on_pc(resources['host'], [
        'python', 'xtcp_ping_pong.py', '--ip', '{}'.format(ip), '--start-port',
        '{}'.format(START_PORT), '--remote-processes',
        '{}'.format(remote_processes), '--remote-ports',
        '{}'.format(connections), '--protocol', '{}'.format(protocol),
        '--packets', '{}'.format(packets), '--delay-between-packets',
        '{}'.format(delay)
    ],
                                    timeout=60 * 2,
                                    tester=tester[1],
                                    initial_delay=20)
Exemplo n.º 2
0
def test(device, ip, expected_response):
    binary = '../examples/app_simple_webserver/bin/app_simple_webserver.xe'

    tester = xmostest.CombinedTester(
        2,
        webTester(expected_response, ip, 'lib_xtcp',
                  device + '_configuration_tests', 'webserver', {}))

    resources = xmostest.request_resource('xtcp_resources', tester)

    if not resources[device]:
        # Abort the test
        print 'Resource \'{}\' not avaliable'.format(device)
        return

    if not resources['host']:
        # Abort the test
        print 'Resource \'host\' not avaliable'
        return

    run_job = xmostest.run_on_xcore(resources[device],
                                    binary,
                                    tester=tester[0],
                                    enable_xscope=True,
                                    timeout=30)

    server_job = xmostest.run_on_pc(resources['host'], [
        'python', 'xtcp_ping_pong.py', '--ip', '{}'.format(ip), '--start-port',
        '80', '--test', 'webserver'
    ],
                                    timeout=30,
                                    tester=tester[1],
                                    initial_delay=15)
Exemplo n.º 3
0
def runtest():

    # Check if the test is running in an environment with hardware resources
    # i.e. if not running from usb audio view it will quit. lib_device_control
    # is in the usb audio view so it will build
    args = xmostest.getargs()
    if not args.remote_resourcer:
        # Abort the test
        print 'remote resourcer not avaliable'
        return

    device_app_name = 'usb_end_to_end_hardware/bin/usb_end_to_end_hardware.xe'.format(
    )
    #This path is relative from xmostest in the view used. goes up and back down to lib_device_control
    host_app_name = '../../../../lib_device_control/tests/usb_end_to_end_hardware_host/bin/usb_end_to_end_hardware_host.bin'

    # Setup the tester which will determine and record the result
    tester = xmostest.CombinedTester(
        2, device_control_endtoend_tester("usb", host_app_name,
                                          device_app_name))

    testlevel = 'smoke'
    tester.set_min_testlevel(testlevel)

    board = 'testrig_os_x_12'

    # Get the hardware resources to run the test on
    resources = None
    try:
        resources = xmostest.request_resource(board,
                                              tester,
                                              remote_resource_lease_time=30)
    except xmostest.XmosTestError:
        print "Unable to find required board %s required to run test" % board
        tester.shutdown()
        return

    env = ""

    # Start the xCORE DUT
    device_job = xmostest.run_on_xcore(resources['uac2_xcore200_mc_dut'],
                                       device_app_name,
                                       do_xe_prebuild=True,
                                       tester=tester[0],
                                       enable_xscope=True,
                                       xscope_handler=None,
                                       timeout=30,
                                       build_env=env)

    # Start the control app
    host_job = xmostest.run_on_pc(
        resources['host'], [host_app_name],
        tester=tester[1],
        timeout=30,
        initial_delay=10
    )  #Enough time for xtag to load firmware and host to enumerate device

    xmostest.complete_all_jobs()