예제 #1
0
def start(rootDir, args, master, endpoints, initial_delay):
  delay = initial_delay
  for ep in endpoints:
    name = ep['name']
    all_endpoints[name] = ep

    if args.user not in ep['users']:
      log_error("User '%s' not found in config file '%s' for endpoint '%s'" %
          (args.user, args.config, name))
      sys.exit(1)

    user_config = ep['users'][args.user]
    startXrunWithDelay(rootDir, master, delay, ep['name'], user_config['xrun_adapter_id'], args)

    delay += 2.0

  # Connect up the analyzers to then endpoints
  for ep in endpoints:
    analyzer_name = ep['analyzer']
    if analyzer_name not in analyzers.get_all():
      log_error("Invalid analyzer '%s' for endpoint '%s'" % (analyzer_name, ep['name']))
    ep['analyzer'] = analyzers.get_all()[analyzer_name]

  # Return the delay used so that the next set of processes can be started after these ones
  # to minimize chances of interference
  return delay
예제 #2
0
def analyzer_qav_seq(test_step, src, dst, action, user):
  """ Get the expected sequence for any QAV analyzers active.
  """
  analyzer_expect = []

  for analyzer_name,analyzer in analyzers.get_all().iteritems():
    if analyzer['type'] != 'qav':
      continue

    # If the analyzer is a QAV analyzer then it will detect the stream through
    # the packets being forwarded through it
    if analyzer_name in graph.find_path(state.get_current(), src, dst):
      guid_string = endpoints.guid_in_ascii(user, endpoints.get(src))
      stream_string = endpoints.stream_from_guid(guid_string)
      if action == 'connect':
        action_string = "Adding"
        completionFn = hook_register_error
      else:
        action_string = "Removing"
        completionFn = hook_unregister_error

      analyzer_expect += [Expected(analyzer_name, "%s stream 0x%s" % (action_string, stream_string),
            timeoutTime=10,
            completionFn=completionFn,
            completionArgs=(analyzer_name, ['ERROR']))]

  return analyzer_expect
예제 #3
0
파일: test.py 프로젝트: davelxmos/sw_avb_dc
def configure_analyzers():
  """ Ensure the analyzers have started properly and then configure their channel
      frequencies as specified in the test configuration file
  """
  analyzer_startup = [Expected(a, "connected to .*: %d" % analyzers.get_port(a), 15, critical=True)
                        for a in analyzers.get_all()]
  yield master.expect(AllOf(analyzer_startup))

  for (name,analyzer) in analyzers.get_all().iteritems():
    if analyzer['type'] != 'audio':
      continue

    log_info("Configure %s" % name)

    # Disable all channels
    master.sendLine(name, "d a")
    yield master.expect(Expected(name, "Channel 0: disabled", 15))

    # Set the base channel index
    analyzer_base = analyzer['base']
    master.sendLine(name, "b %d" % analyzer_base)

    # Configure all channels
    for (chan_id,freq) in analyzer['frequencies'].iteritems():
      # Need to convert unicode to string before sending as a command
      chan = int(chan_id)
      master.sendLine(name, "c %d %d" % (chan, freq))

      # The channel ID is offset from the base in the generating message
      yield master.expect(
          Expected(name, "Generating sine table for chan %d" % (chan - analyzer_base), 15))

    master.sendLine(name, "e a")
    channel_enables = [Expected(name, "Channel %d: enabled" % (int(c) - analyzer_base), 15)
                        for c in analyzer['frequencies'].keys()]
    yield master.expect(AllOf(channel_enables))