testing/chromoting/chromoting_test_driver_launcher.py
def LaunchCTDCommand(args, command):
  """Launches the specified chromoting test driver command.

  Args:
    args: Command line args, used for test-case startup tasks.
    command: Chromoting Test Driver command line.
  Returns:
    command, host_log_file_names: Tuple of:
    "command" if there was a test-environment failure, or any failing test, and
    list of host-log file-names.
  """
  host_log_file_names = []

  host_log_file_names.append(TestCaseSetup(args))
  # Parse the me2me host log to obtain the JID that the host registered.
  host_jid = GetJidFromHostLog(host_log_file_names[-1])

  if not host_jid:
    # Host-JID not found in log. Let's not attempt to run this test.
    print('Host-JID not found in log %s.' % host_log_file_names[-1])
    return '[Command failed]: %s, %s' % (command, host_log_file_names)

  retries = 0
  failed_tests_list = []
  # TODO(anandc): Remove this retry-logic once http://crbug/570840 is fixed.
  while retries <= MAX_RETRIES:
    # In order to ensure the host is online with the expected JID, pass in the
    # jid obtained from the host-log as a command-line parameter.
    command = command.replace('\n', '') + ' --hostjid=%s' % host_jid

    results = RunCommandInSubProcess(command)

    tear_down_index = results.find(TEST_ENVIRONMENT_TEAR_DOWN_INDICATOR)
    if tear_down_index == -1:
      # The test environment did not tear down. Something went horribly wrong.
      return '[Command failed]: ' + command, host_log_file_names

    end_results_list = results[tear_down_index:].split('\n')
    test_failed = False
    for result in end_results_list:
      if result.startswith(FAILED_INDICATOR):
        test_failed = True
        if retries == MAX_RETRIES:
          # Test failed and we have no more retries left.
          failed_tests_list.append(result)

    if test_failed:
      retries += 1
    else:
      break

  if failed_tests_list:
    test_result = '[Command]: ' + command
    # Note: Skipping the first one is intentional.
    for i in range(1, len(failed_tests_list)):
      test_result += '    ' + failed_tests_list[i]
    return test_result, host_log_file_names

  # All tests passed!
  return '', host_log_file_names
Launches the specified chromoting test driver command.

  Args:
    args: Command line args, used for test-case startup tasks.
    command: Chromoting Test Driver command line.
  Returns:
    command, host_log_file_names: Tuple of:
    "command" if there was a test-environment failure, or any failing test, and
    list of host-log file-names.
  
Launches the specified chromoting test driver command.
Launches the specified chromoting test driver command .
def LaunchCTDCommand(args, command):
  host_log_file_names = []
  host_log_file_names.append(TestCaseSetup(args))
  host_jid = GetJidFromHostLog(host_log_file_names[-1])
  if not host_jid:
    print('Host-JID not found in log %s.' % host_log_file_names[-1])
    return '[Command failed]: %s, %s' % (command, host_log_file_names)
  retries = 0
  failed_tests_list = []
  while retries <= MAX_RETRIES:
    command = command.replace('\n', '') + ' --hostjid=%s' % host_jid
    results = RunCommandInSubProcess(command)
    tear_down_index = results.find(TEST_ENVIRONMENT_TEAR_DOWN_INDICATOR)
    if tear_down_index == -1:
      return '[Command failed]: ' + command, host_log_file_names
    end_results_list = results[tear_down_index:].split('\n')
    test_failed = False
    for result in end_results_list:
      if result.startswith(FAILED_INDICATOR):
        test_failed = True
        if retries == MAX_RETRIES:
          failed_tests_list.append(result)
    if test_failed:
      retries += 1
    else:
      break
  if failed_tests_list:
    test_result = '[Command]: ' + command
    for i in range(1, len(failed_tests_list)):
      test_result += '    ' + failed_tests_list[i]
    return test_result, host_log_file_names
  return '', host_log_file_names
def LaunchCTDCommand ( args , command ) : host_log_file_names = [ ] host_log_file_names . append ( TestCaseSetup ( args ) ) host_jid = GetJidFromHostLog ( host_log_file_names [ - 1 ] ) if not host_jid : print ( 'Host-JID not found in log %s.' % host_log_file_names [ - 1 ] ) return '[Command failed]: %s, %s' % ( command , host_log_file_names ) retries = 0 failed_tests_list = [ ] while retries <= MAX_RETRIES : command = command . replace ( '\n' , '' ) + ' --hostjid=%s' % host_jid results = RunCommandInSubProcess ( command ) tear_down_index = results . find ( TEST_ENVIRONMENT_TEAR_DOWN_INDICATOR ) if tear_down_index == - 1 : return '[Command failed]: ' + command , host_log_file_names end_results_list = results [ tear_down_index : ] . split ( '\n' ) test_failed = False for result in end_results_list : if result . startswith ( FAILED_INDICATOR ) : test_failed = True if retries == MAX_RETRIES : failed_tests_list . append ( result ) if test_failed : retries += 1 else : break if failed_tests_list : test_result = '[Command]: ' + command for i in range ( 1 , len ( failed_tests_list ) ) : test_result += '    ' + failed_tests_list [ i ] return test_result , host_log_file_names return '' , host_log_file_names
Launches the specified chromoting test driver command.
Launches the specified chromoting test driver command .
"""Launches the specified chromoting test driver command.

  Args:
    args: Command line args, used for test-case startup tasks.
    command: Chromoting Test Driver command line.
  Returns:
    command, host_log_file_names: Tuple of:
    "command" if there was a test-environment failure, or any failing test, and
    list of host-log file-names.
  """ # Parse the me2me host log to obtain the JID that the host registered. # Host-JID not found in log. Let's not attempt to run this test. # TODO(anandc): Remove this retry-logic once http://crbug/570840 is fixed. # In order to ensure the host is online with the expected JID, pass in the # jid obtained from the host-log as a command-line parameter. # The test environment did not tear down. Something went horribly wrong. # Test failed and we have no more retries left. # Note: Skipping the first one is intentional. # All tests passed!
command, host_log_file_names: Tuple of:
"command" if there was a test-environment failure, or any failing test, and
list of host-log file-names.
command host_log_file_names : Tuple of : " command " if there was a test - environment failure or any failing test and list of host - log file - names .
args
Command line args, used for test-case startup tasks.
Command line args used for test - case startup tasks .
command
Chromoting Test Driver command line.
Chromoting Test Driver command line .