Exemplo n.º 1
0
                                                  test_class.Description())
        print >> sys.stderr

    filtered_tests = [
        test_class for test_class in tests
        if issubclass(test_class, page_test.PageTest)
    ]
    if filtered_tests:
        print >> sys.stderr, 'Available page tests are:'
        for test_class in sorted(filtered_tests, key=lambda t: t.Name()):
            print >> sys.stderr, format_string % (test_class.Name(),
                                                  test_class.Description())
        print >> sys.stderr


config = environment.Environment([util.GetBaseDir()])


def main():
    # Get the command name from the command line.
    if len(sys.argv) > 1 and sys.argv[1] == '--help':
        sys.argv[1] = 'help'

    command_name = 'run'
    for arg in sys.argv[1:]:
        if not arg.startswith('-'):
            command_name = arg
            break

    # Validate and interpret the command name.
    commands = _MatchingCommands(command_name)
Exemplo n.º 2
0
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import sys

sys.path.append(
    os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
                 'tools', 'telemetry'))

from telemetry import test_runner
from telemetry.core import environment

if __name__ == '__main__':
    base_dir = os.path.dirname(os.path.realpath(__file__))
    test_runner.config = environment.Environment([base_dir])
    sys.exit(test_runner.main())
Exemplo n.º 3
0
  _LaunchDBus(), above, actually spawned the dbus-daemon.
  """
  import signal
  if 'DBUS_SESSION_BUS_PID' in os.environ:
    dbus_pid = os.environ['DBUS_SESSION_BUS_PID']
    try:
      os.kill(int(dbus_pid), signal.SIGTERM)
      print ' killed dbus-daemon with PID %s' % dbus_pid
    except OSError as e:
      print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e)
  # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment
  # variable too. Some of the bots seem to re-invoke runtest.py in a
  # way that this variable sticks around from run to run.
  if 'DBUS_SESSION_BUS_ADDRESS' in os.environ:
    del os.environ['DBUS_SESSION_BUS_ADDRESS']
    print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable'


if __name__ == '__main__':
  base_dir = os.path.dirname(os.path.realpath(__file__))
  benchmark_runner.config = environment.Environment([base_dir])

  did_launch_dbus = _LaunchDBus()
  try:
    retcode = benchmark_runner.main()
  finally:
    if did_launch_dbus:
      _ShutdownDBus()

  sys.exit(retcode)