예제 #1
0
  def execute(self, sys_args=None):
    if sys_args is None:  # pragma: no cover
      sys_args = sys.argv[1:]
    try:
      parser = self._create_parser()
      options, args = self._parse_args(parser, sys_args)
      self.infra_staging = options.infra_staging
      if options.swarming:
        # Swarming doesn't print how isolated commands are called. Lets make
        # this less cryptic by printing it ourselves.
        print(' '.join(sys.argv))

        # TODO(machenbach): Print used Python version until we have switched to
        # Python3 everywhere.
        print('Running with:')
        print(sys.version)

        # Kill stray processes from previous tasks on swarming.
        util.kill_processes_linux()

      self._load_build_config(options)
      command.setup(self.target_os, options.device)

      try:
        self._process_default_options(options)
        self._process_options(options)
      except TestRunnerError:
        parser.print_help()
        raise

      args = self._parse_test_args(args)
      tests = self._load_testsuite_generators(args, options)
      self._setup_env()
      print(">>> Running tests for %s.%s" % (self.build_config.arch,
                                             self.mode_options.label))
      exit_code = self._do_execute(tests, args, options)
      if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
        print("Force exit code 0 after failures. Json test results file "
              "generated with failure information.")
        exit_code = utils.EXIT_CODE_PASS
      return exit_code
    except TestRunnerError:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    except KeyboardInterrupt:
      return utils.EXIT_CODE_INTERRUPTED
    except Exception:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    finally:
      command.tear_down()
예제 #2
0
파일: base_runner.py 프로젝트: v8/v8
  def execute(self, sys_args=None):
    if sys_args is None:  # pragma: no cover
      sys_args = sys.argv[1:]
    try:
      parser = self._create_parser()
      options, args = self._parse_args(parser, sys_args)
      if options.swarming:
        # Swarming doesn't print how isolated commands are called. Lets make
        # this less cryptic by printing it ourselves.
        print(' '.join(sys.argv))

      self._load_build_config(options)
      command.setup(self.target_os, options.device)

      try:
        self._process_default_options(options)
        self._process_options(options)
      except TestRunnerError:
        parser.print_help()
        raise

      args = self._parse_test_args(args)
      tests = self._load_testsuite_generators(args, options)
      self._setup_env()
      print(">>> Running tests for %s.%s" % (self.build_config.arch,
                                            self.mode_name))
      exit_code = self._do_execute(tests, args, options)
      if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
        print("Force exit code 0 after failures. Json test results file "
              "generated with failure information.")
        exit_code = utils.EXIT_CODE_PASS
      return exit_code
    except TestRunnerError:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    except KeyboardInterrupt:
      return utils.EXIT_CODE_INTERRUPTED
    except Exception:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    finally:
      command.tear_down()
예제 #3
0
    def __init__(self, args):
        super(DesktopPlatform, self).__init__(args)
        self.command_prefix = []

        # Setup command class to OS specific version.
        command.setup(utils.GuessOS(), args.device)

        if args.prioritize or args.affinitize != None:
            self.command_prefix = ['schedtool']
            if args.prioritize:
                self.command_prefix += ['-n', '-20']
            if args.affinitize != None:
                # schedtool expects a bit pattern when setting affinity, where each
                # bit set to '1' corresponds to a core where the process may run on.
                # First bit corresponds to CPU 0. Since the 'affinitize' parameter is
                # a core number, we need to map to said bit pattern.
                cpu = int(args.affinitize)
                core = 1 << cpu
                self.command_prefix += ['-a', ('0x%x' % core)]
            self.command_prefix += ['-e']
예제 #4
0
  def __init__(self, options):
    super(DesktopPlatform, self).__init__(options)
    self.command_prefix = []

    # Setup command class to OS specific version.
    command.setup(utils.GuessOS())

    if options.prioritize or options.affinitize != None:
      self.command_prefix = ["schedtool"]
      if options.prioritize:
        self.command_prefix += ["-n", "-20"]
      if options.affinitize != None:
      # schedtool expects a bit pattern when setting affinity, where each
      # bit set to '1' corresponds to a core where the process may run on.
      # First bit corresponds to CPU 0. Since the 'affinitize' parameter is
      # a core number, we need to map to said bit pattern.
        cpu = int(options.affinitize)
        core = 1 << cpu
        self.command_prefix += ["-a", ("0x%x" % core)]
      self.command_prefix += ["-e"]
예제 #5
0
    def __init__(self, options):
        super(DesktopPlatform, self).__init__(options)
        self.command_prefix = []

        # Setup command class to OS specific version.
        command.setup(utils.GuessOS(), options.device)

        if options.prioritize or options.affinitize != None:
            self.command_prefix = ["schedtool"]
            if options.prioritize:
                self.command_prefix += ["-n", "-20"]
            if options.affinitize != None:
                # schedtool expects a bit pattern when setting affinity, where each
                # bit set to '1' corresponds to a core where the process may run on.
                # First bit corresponds to CPU 0. Since the 'affinitize' parameter is
                # a core number, we need to map to said bit pattern.
                cpu = int(options.affinitize)
                core = 1 << cpu
                self.command_prefix += ["-a", ("0x%x" % core)]
            self.command_prefix += ["-e"]
예제 #6
0
파일: run_perf.py 프로젝트: v8/v8
  def __init__(self, args):
    super(DesktopPlatform, self).__init__(args)
    self.command_prefix = []

    # Setup command class to OS specific version.
    command.setup(utils.GuessOS(), args.device)

    if args.prioritize or args.affinitize != None:
      self.command_prefix = ['schedtool']
      if args.prioritize:
        self.command_prefix += ['-n', '-20']
      if args.affinitize != None:
      # schedtool expects a bit pattern when setting affinity, where each
      # bit set to '1' corresponds to a core where the process may run on.
      # First bit corresponds to CPU 0. Since the 'affinitize' parameter is
      # a core number, we need to map to said bit pattern.
        cpu = int(args.affinitize)
        core = 1 << cpu
        self.command_prefix += ['-a', ('0x%x' % core)]
      self.command_prefix += ['-e']
예제 #7
0
파일: base_runner.py 프로젝트: cclauss/v8-1
  def execute(self, sys_args=None):
    if sys_args is None:  # pragma: no cover
      sys_args = sys.argv[1:]
    try:
      parser = self._create_parser()
      options, args = self._parse_args(parser, sys_args)
      if options.swarming:
        # Swarming doesn't print how isolated commands are called. Lets make
        # this less cryptic by printing it ourselves.
        print(' '.join(sys.argv))

      self._load_build_config(options)
      command.setup(self.target_os)

      try:
        self._process_default_options(options)
        self._process_options(options)
      except TestRunnerError:
        parser.print_help()
        raise

      args = self._parse_test_args(args)
      tests = self._load_testsuite_generators(args, options)
      self._setup_env()
      print(">>> Running tests for %s.%s" % (self.build_config.arch,
                                            self.mode_name))
      return self._do_execute(tests, args, options)
    except TestRunnerError:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    except KeyboardInterrupt:
      return utils.EXIT_CODE_INTERRUPTED
    except Exception:
      traceback.print_exc()
      return utils.EXIT_CODE_INTERNAL_ERROR
    finally:
      command.tear_down()
예제 #8
0
  def execute(self, sys_args=None):
    if sys_args is None:  # pragma: no cover
      sys_args = sys.argv[1:]
    try:
      parser = self._create_parser()
      options, args = self._parse_args(parser, sys_args)
      if options.swarming:
        # Swarming doesn't print how isolated commands are called. Lets make
        # this less cryptic by printing it ourselves.
        print ' '.join(sys.argv)

      self._load_build_config(options)
      command.setup(self.target_os)

      try:
        self._process_default_options(options)
        self._process_options(options)
      except TestRunnerError:
        parser.print_help()
        raise

      args = self._parse_test_args(args)
      suites = self._get_suites(args, options)
      self._prepare_suites(suites, options)

      self._setup_env()

      print(">>> Running tests for %s.%s" % (self.build_config.arch,
                                            self.mode_name))
      tests = [t for s in suites for t in s.tests]
      return self._do_execute(tests, args, options)
    except TestRunnerError:
      return utils.EXIT_CODE_INTERNAL_ERROR
    except KeyboardInterrupt:
      return utils.EXIT_CODE_INTERRUPTED
    finally:
      command.tear_down()
"""

# for py2/py3 compatibility
from __future__ import absolute_import
from __future__ import print_function

import sys

from testrunner.local import command
from testrunner.local import utils

MAX_TRIES = 3
TIMEOUT = 120

# Predictable mode works only when run on the host os.
command.setup(utils.GuessOS(), None)


def maybe_decode(message):
    if not isinstance(message, str):
        return message.decode()
    return message


def main(args):
    def allocation_str(stdout):
        for line in reversed((stdout or '').splitlines()):
            if maybe_decode(line).startswith('### Allocations = '):
                return line
        return None
예제 #10
0
"""

# for py2/py3 compatibility
from __future__ import print_function
from __future__ import absolute_import

import sys

from testrunner.local import command
from testrunner.local import utils

MAX_TRIES = 3
TIMEOUT = 120

# Predictable mode works only when run on the host os.
command.setup(utils.GuessOS())


def main(args):
    def allocation_str(stdout):
        for line in reversed((stdout or '').splitlines()):
            if line.startswith('### Allocations = '):
                return line
        return None

    cmd = command.Command(args[0], args[1:], timeout=TIMEOUT)

    previous_allocations = None
    for run in range(1, MAX_TRIES + 1):
        print('### Predictable run #%d' % run)
        output = cmd.execute()
예제 #11
0

# for py2/py3 compatibility
from __future__ import print_function

import sys

from testrunner.local import command
from testrunner.local import utils


MAX_TRIES = 3
TIMEOUT = 120

# Predictable mode works only when run on the host os.
command.setup(utils.GuessOS(), None)

def main(args):
  def allocation_str(stdout):
    for line in reversed((stdout or '').splitlines()):
      if line.startswith('### Allocations = '):
        return line
    return None

  cmd = command.Command(args[0], args[1:], timeout=TIMEOUT)

  previous_allocations = None
  for run in range(1, MAX_TRIES + 1):
    print('### Predictable run #%d' % run)
    output = cmd.execute()
    if output.stdout:
예제 #12
0
predictable_wrapper.py path/to/d8 --test --predictable --flag1 --flag2

The command is run up to three times and the printed allocation hash is
compared. Differences are reported as errors.
"""

import sys

from testrunner.local import command
from testrunner.local import utils

MAX_TRIES = 3
TIMEOUT = 120

# Predictable mode works only when run on the host os.
command.setup(utils.GuessOS())

def main(args):
  def allocation_str(stdout):
    for line in reversed((stdout or '').splitlines()):
      if line.startswith('### Allocations = '):
        return line
    return None

  cmd = command.Command(args[0], args[1:], timeout=TIMEOUT)

  previous_allocations = None
  for run in range(1, MAX_TRIES + 1):
    print '### Predictable run #%d' % run
    output = cmd.execute()
    if output.stdout: