Exemple #1
0
def action_disconnect(args, test_step, expected, params_list):
  src = choose_src(params_list, 0)
  src_stream = choose_src_stream(params_list, 1)
  dst = choose_dst(params_list, 2)
  dst_stream = choose_dst_stream(params_list, 3)

  controller_disconnect(args, test_step, expected, src, dst_stream, dst, dst_stream)

  (talker_expect, listener_expect, controller_expect) = get_expected(
      args, test_step, src, src_stream, dst, dst_stream, 'disconnect')

  # Find the path between the src and dst and check whether there are any nodes between them
  forward_disable = []
  nodes = endpoints.get_path_endpoints(graph.find_path(state.get_current(), src, dst))
  for node in get_dual_port_nodes(nodes):
    if graph.node_will_see_stream_disable(state.get_current(), src, src_stream, dst, dst_stream, node):
      forward_disable += sequences.expected_seq('stream_forward_disable')(test_step, args.user,
        endpoints.get(node), endpoints.get(src))
      forward_disable += sequences.expected_seq('port_shaper_disconnect')(test_step, endpoints.get(node),
          src, src_stream, dst, dst_stream)

  # If there are any nodes in the chain then the forward disabling is expected before the
  # audio will be seen to be lost
  if forward_disable and listener_expect:
    listener_expect = [Sequence([AllOf(forward_disable)] + listener_expect)]
  elif forward_disable:
    listener_expect = forward_disable
  elif listener_expect:
    listener_expect = listener_expect
  else:
    listener_expect = []

  # Expect not to see any disables from other nodes
  not_forward_disable = []
  temp_nodes = set(endpoints.get_all().keys()) - set(nodes)
  for node in get_dual_port_nodes(temp_nodes):
    not_forward_disable += sequences.expected_seq('stream_forward_disable')(test_step, args.user,
        endpoints.get(node), endpoints.get(src))

  if not_forward_disable:
    if test_step.checkpoint is None:
      not_forward_disable = [NoneOf(not_forward_disable)]
    else:
      not_forward_disable = []

  for node in get_dual_port_nodes(temp_nodes):
    not_forward_disable += sequences.expected_seq('port_shaper_disconnect')(test_step, endpoints.get(node),
          src, src_stream, dst, dst_stream)

  if test_step.checkpoint:
    final_port_shaper_states = sequences.get_and_clear_final_port_shaper_states()
  else:
    final_port_shaper_states = []

  if test_step.do_checks and (talker_expect or listener_expect or controller_expect or
                              not_forward_disable or final_port_shaper_states):
    expected += [AllOf(talker_expect + listener_expect + controller_expect +
                       not_forward_disable + final_port_shaper_states)]

  yield args.master.expect(None)
Exemple #2
0
def check_set_clock_masters(args, test_step, expected):
  for loop in graph.get_loops(state.get_next()):
    loop_master = loop[0]
    for ep_name in loop:
      # Look at the next state in case the node has just been set clock master
      if state.get_next().is_clock_source_master(ep_name):
        loop_master = ep_name
        break

    if not state.get_next().is_clock_source_master(loop_master):
      ep = endpoints.get(loop_master)
      print_title("Command: set_clock_source_master %s" % loop_master)
      if args.controller_type == 'python':
        args.master.sendLine(args.controller_id, "set_clock_source_master 0x%s" % (
              endpoints.guid_in_ascii(args.user, ep)))
      else:
        select_endpoint(args, ep)
        args.master.sendLine(args.controller_id, "set clock_source 0 0 1")

      state.get_next().set_clock_source_master(ep['name'])

      if test_step.do_checks:
        controller_expect = sequences.expected_seq('controller_success_set_clock_source')(args, test_step)
        ep_expect = [Expected(loop_master, "Setting clock source: LOCAL_CLOCK", 5)]
        if controller_expect or ep_expect:
          expected += [AllOf(controller_expect + ep_expect)]
Exemple #3
0
def get_expected(args, test_step, src, src_stream, dst, dst_stream, command):
  state.get_current().dump()
  talker_state = state.get_current().get_talker_state(src, src_stream, dst, dst_stream, command)
  talker_expect = sequences.expected_seq(talker_state)(test_step, args.user, src, src_stream, dst, dst_stream)

  listener_state = state.get_current().get_listener_state(src, src_stream, dst, dst_stream, command)
  analyzer_state = "analyzer_" + listener_state
  analyzer_expect = sequences.expected_seq(analyzer_state)(test_step, src, src_stream, dst, dst_stream)
  analyzer_expect += sequences.analyzer_qav_seq(test_step, src, dst, command, args.user)

  if analyzer_expect:
    analyzer_expect = [AllOf(analyzer_expect)]
  listener_expect = sequences.expected_seq(listener_state)(test_step, dst, dst_stream, analyzer_expect)

  controller_state = state.get_current().get_controller_state(args.controller_id,
      src, src_stream, dst, dst_stream, command)
  controller_expect = sequences.expected_seq(controller_state)(test_step, args.controller_id)
  return (talker_expect, listener_expect, controller_expect)
Exemple #4
0
def check_clear_clock_masters(args, test_step, expected):
  for name,ep in endpoints.get_all().iteritems():
    if state.get_current().is_clock_source_master(name) and not graph.is_in_loop(state.get_current(), ep['name']):
      print_title("Command: set_clock_source_slave %s" % name)
      if args.controller_type == 'python':
        args.master.sendLine(args.controller_id, "set_clock_source_slave 0x%s" % (
              endpoints.guid_in_ascii(args.user, ep)))
      else:
        select_endpoint(args, ep)
        args.master.sendLine(args.controller_id, "set clock_source 0 0 0")

      state.get_next().set_clock_source_slave(ep['name'])

      if test_step.do_checks:
        controller_expect = sequences.expected_seq('controller_success_set_clock_source')(args, test_step)
        ep_expect = [Expected(ep['name'], "Setting clock source: INPUT_STREAM_DERIVED", 5)]
        if controller_expect or ep_expect:
          expected += [AllOf(controller_expect + ep_expect)]