示例#1
0
def action_discover(args, test_step, expected, params_list):
  if args.controller_type == 'c':
    # Can take up to 20 seconds to timeout entities which have disappeared
    yield base.sleep(20)

    print_title("Command: list")
    args.master.sendLine(args.controller_id, "list")

    yield base.sleep(2)

  else:
    args.master.clearExpectHistory(args.controller_id)
    print_title("Command: discover")
    args.master.sendLine(args.controller_id, "discover")

    yield args.master.expect(Expected(args.controller_id, "Found \d+ entities", 15))

  # Actually check that the right number of entities have been seen
  visible_endpoints = graph.get_endpoints_connected_to(state.get_current(), args.controller_id)
  controller = getActiveProcesses()[args.controller_id]
  if len(controller.entities) != len(visible_endpoints):
    base.testError("Found %d entities, expecting %d" % (len(controller.entities), len(visible_endpoints)), critical=True)
  else:
    log_info("Found %d entities" % len(controller.entities))

  yield args.master.expect(None)
示例#2
0
def runTest(args):
  """ The test program - needs to yield on each expect and be decorated
    with @inlineCallbacks
  """

  startup = AllOf([Expected(e, "PTP Role: Master", 30) for e in endpoints])

  ptpslave = OneOf([
      Sequence([Expected(e, "PTP Role: Slave", 5),
            Expected(e, "PTP sync locked", 1)])
      for e in endpoints
    ])

  talker_connections = [
      Sequence([Expected(e, "MAAP reserved Talker stream #0 address: 91:E0:F0:0", 30),
            Expected(e, "CONNECTING Talker stream #0", 10),
            Expected(e, "Talker stream #0 ready", 10),
            Expected(e, "Talker stream #0 on", 10)])
      for e in endpoints
    ]

  listener_connections = [
      Sequence([Expected(e, "CONNECTING Listener sink #0", 30),
            AllOf([Expected(e, "%d -> %d" % (n, n), 10) for n in range(4)]),
            AllOf([Expected(e, "Media output %d locked" % n, 10) for n in range(4)]),
            NoneOf([Expected(e, "lost lock", 10)])])
      for e in endpoints
    ]

  yield master.expect(startup)
  for name,process in base.getActiveProcesses().iteritems():
    process.registerErrorPattern("PTP Role: Master")
  yield master.expect(AllOf([ptpslave] + talker_connections + listener_connections))

  base.testComplete(reactor)
示例#3
0
def runTest(args):
  """ The test program - needs to yield on each expect and be decorated
    with @inlineCallbacks
  """
  for y in configure_generators():
    yield y

  for y in configure_analyzers():
    yield y

  for y in check_endpoint_startup():
    yield y

  expected = []
  for y in action_discover(args, generator.Command("discover"), expected, []):
    yield y
  for e in expected:
    yield args.master.expect(e)
  expected = []

  if not getEntities():
    base.testError("no entities found", critical=True)

  test_num = 1
  check_num = 1
  for test_step in test_steps:
    state.move_next_to_current()

    command = test_step.command
    print_title("Command %d: %s" % (test_num, command))
    test_num += 1

    action = command.split(' ')
    action_function = eval('action_%s' % action[0])
    for y in action_function(args, test_step, expected, action[1:]):
      yield y

    if test_step.checkpoint or test_step.checkpoint is None:
      print_title("Check: %d" % check_num)
      check_num += 1
      if expected:
        yield args.master.expect(AllOf(expected))
        expected = []

        # Ensure that any remaining output of a previous test step is flushed
        for process in getActiveProcesses():
          master.clearExpectHistory(process)

  # Allow everything time to settle (in case an error is being generated)
  yield base.sleep(5)
  base.testComplete(reactor)
示例#4
0
def runTest(args):
  """ The test program - needs to yield on each expect and be decorated
    with @inlineCallbacks
  """
  for y in configure_generators():
    yield y

  for y in configure_analyzers():
    yield y

  for y in check_endpoint_startup():
    yield y

  expected = []
  for y in action_discover(args, generator.Command("discover"), expected, []):
    yield y

  check_num = 1
  for test_step in test_steps:
    print_comment(test_step)
    state.move_next_to_current()

    command = test_step.get_command()
    if command is None:
      continue

    action = command.split(' ')
    action_function = eval('action_%s' % action[0])
    expected = []
    for y in action_function(args, test_step, expected, action[1:]):
      yield y
    if expected:
      args.master.addExpected(AllOf(expected))

    if (test_step.checkpoint or test_step.checkpoint is None) and args.master.nextExpected:
      print_title("Check: %d" % check_num)
      check_num += 1

      args.master.startNext()
      yield args.master.expect()

      # Ensure that any remaining output of a previous test step is flushed
      for process in getActiveProcesses():
        master.clearExpectHistory(process)

  # Allow everything time to settle (in case an error is being generated)
  yield base.sleep(5)
  base.testComplete(reactor)
示例#5
0
def analyzer_listener_disconnect_seq(test_step, src, src_stream, dst, dst_stream):
  listener_ep = endpoints.get(dst)
  analyzer = listener_ep['analyzer']
  analyzer_name = analyzer['name']
  analyzer_offset = listener_ep['analyzer_offset'] + analyzer['base']

  # Expect both of the stereo channels to lose signal
  signal_lost = [
    Expected(analyzer_name, "Channel %d: Lost signal" % (i + analyzer_offset),
        timeoutTime=5,
        completionFn=hook_unregister_error,
        completionArgs=(analyzer_name, [
          "Channel %d: %s" % (i + analyzer_offset, GLITCH_DETECTED_PATTERN)]))
      for i in range(0, 2)
  ]

  # Unregister the lost signal error pattern now
  process = getActiveProcesses()[analyzer_name]
  for i in range(0, 2):
    process.unregisterErrorPattern("Channel %d: %s" % (i + analyzer_offset, LOST_SIGNAL_PATTERN))

  return signal_lost
示例#6
0
def hook_unregister_error(expected):
  (process_name, patterns) = expected.completionArgs
  process = getActiveProcesses()[process_name]
  for pattern in patterns:
    process.unregisterErrorPattern(pattern)