예제 #1
0
def FindDependencies(target_paths, options):
    # Verify arguments.
    for target_path in target_paths:
        if not os.path.exists(target_path):
            raise ValueError('Path does not exist: %s' % target_path)

    dependencies = path_set.PathSet()

    # Including Telemetry's major entry points will (hopefully) include Telemetry
    # and all its dependencies. If the user doesn't pass any arguments, we just
    # have Telemetry.
    dependencies |= FindPythonDependencies(
        os.path.realpath(
            os.path.join(path_util.GetTelemetryDir(), 'telemetry',
                         'command_line', 'parser.py')))
    dependencies |= FindPythonDependencies(
        os.path.realpath(
            os.path.join(path_util.GetTelemetryDir(), 'telemetry', 'testing',
                         'run_tests.py')))

    # Add dependencies.
    for target_path in target_paths:
        base_dir = os.path.dirname(os.path.realpath(target_path))

        dependencies.add(base_dir)
        dependencies |= FindBootstrapDependencies(base_dir)
        dependencies |= FindPythonDependencies(target_path)

    # Remove excluded files.
    dependencies -= FindExcludedFiles(set(dependencies), options)

    return dependencies
예제 #2
0
def SetupTelemetryPaths():
  SetupToolsPerfPath()
  from core import path_util

  AddDirToPathIfNeeded(path_util.GetTelemetryDir())

  py_utils_path = os.path.join(GetCatapultDir(), 'common', 'py_utils')
  AddDirToPathIfNeeded(py_utils_path)
예제 #3
0
def SetupTelemetryPaths():
    chromium_src_dir = GetChromiumSrcDir()

    perf_path = os.path.join(chromium_src_dir, 'tools', 'perf')
    absolute_perf_path = os.path.abspath(perf_path)

    sys.path.append(absolute_perf_path)
    from core import path_util

    telemetry_path = path_util.GetTelemetryDir()
    if telemetry_path not in sys.path:
        sys.path.append(telemetry_path)

    py_utils_path = os.path.join(chromium_src_dir, 'third_party', 'catapult',
                                 'common', 'py_utils')
    if py_utils_path not in sys.path:
        sys.path.append(py_utils_path)

    pylint_path = os.path.join(chromium_src_dir, 'third_party', 'pylint')
    if pylint_path not in sys.path:
        sys.path.append(pylint_path)
예제 #4
0
# Copyright 2015 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 sys

from core import path_util

sys.path.append(path_util.GetTelemetryDir())
예제 #5
0
#!/usr/bin/env vpython
# Copyright 2018 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 shutil
import sys
import tempfile
import json
import unittest

from core import path_util
sys.path.insert(1, path_util.GetTelemetryDir())
sys.path.insert(
    1, os.path.join(path_util.GetTelemetryDir(), 'third_party', 'mock'))

import mock

import process_perf_results as ppr_module


class _FakeLogdogStream(object):
    def write(self, data):
        pass

    def close(self):
        pass

    def get_viewer_url(self):
        return 'http://foobar.not.exit'
예제 #6
0
from py_utils import binary_manager

SRC_ROOT = os.path.abspath(
    os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
RESULTS2JSON = os.path.join(SRC_ROOT, 'third_party', 'catapult', 'tracing',
                            'bin', 'results2json')
HISTOGRAM2CSV = os.path.join(SRC_ROOT, 'third_party', 'catapult', 'tracing',
                             'bin', 'histograms2csv')
RUN_BENCHMARK = os.path.join(SRC_ROOT, 'tools', 'perf', 'run_benchmark')
DATA_DIR = os.path.join(SRC_ROOT, 'tools', 'perf', 'page_sets', 'data')
RECORD_WPR = os.path.join(SRC_ROOT, 'tools', 'perf', 'record_wpr')
DEFAULT_REVIEWERS = ['*****@*****.**']
MISSING_RESOURCE_RE = re.compile(
    r'\[network\]: Failed to load resource: the server responded with a status '
    r'of 404 \(\) ([^\s]+)')
TELEMETRY_BIN_DEPS_CONFIG = os.path.join(path_util.GetTelemetryDir(),
                                         'telemetry',
                                         'binary_dependencies.json')


def _GetBranchName():
    return subprocess.check_output(
        ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()


def _OpenBrowser(url):
    # Redirect I/O before invoking browser to avoid it spamming our output.
    # Based on https://stackoverflow.com/a/2323563.
    savout = os.dup(1)
    saverr = os.dup(2)
    os.close(1)
예제 #7
0
# Copyright 2019 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

# Add //tools/perf/ to system path.
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))

from core import path_util
sys.path.insert(1, path_util.GetTelemetryDir())

from telemetry import benchmark_runner

from chrome_telemetry_build import chromium_config


def main():
    config = chromium_config.ChromiumConfig(
        benchmark_dirs=[
            path_util.GetOfficialBenchmarksDir(),
            path_util.GetContribDir()
        ],
        top_level_dir=path_util.GetPerfDir(),
        expectations_files=[path_util.GetExpectationsPath()])
    return benchmark_runner.main(config)


if __name__ == '__main__':
    sys.exit(main())
예제 #8
0
# Copyright 2017 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 unittest
import sys

from core import system_health_csv_generator
from core import path_util
sys.path.insert(1, path_util.GetTelemetryDir())  # To resolve telemetry imports


class GenerateSystemHealthCSVTest(unittest.TestCase):
  def testPopulateExpectations(self):
    expected_result = {
        'browse:media:tumblr': 'Mac 10.11',
        'browse:news:cnn': 'Mac Platforms',
        'browse:news:hackernews': 'Win Platforms, Mac Platforms',
        'browse:search:google': 'Win Platforms',
        'browse:tools:earth': 'All Platforms',
        'browse:tools:maps': 'All Platforms',
        'play:media:google_play_music': 'All Platforms',
        'play:media:pandora': 'All Platforms',
        'play:media:soundcloud': 'Win Platforms'}
    all_expects = [{
        'browse:news:cnn': [(
            ['Mac Platforms'], 'crbug.com/728576')],
        'browse:tools:earth': [(
            ['All Platforms'], 'crbug.com/760966')],
        'browse:news:hackernews': [(
            ['Win Platforms', 'Mac Platforms'],
예제 #9
0
# Copyright 2017 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

# Add //tools/perf/ to system path
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))

from chrome_telemetry_build import chromium_config
from core import path_util

TELEMETRY_DIR = path_util.GetTelemetryDir()
PYLIB_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                         '..', '..', '..', '..',
                                         'build', 'android'))

_top_level_dir = os.path.dirname(os.path.realpath(__file__))

def Config(benchmark_subdirs):
  return chromium_config.ChromiumConfig(
      top_level_dir=_top_level_dir,
      benchmark_dirs=[os.path.join(_top_level_dir, subdir)
                      for subdir in benchmark_subdirs])
예제 #10
0
# Copyright 2015 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

# pylint: disable=wrong-import-position
from core import path_util

CLIENT_CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                  'binary_dependencies.json')

with path_util.SysPath(path_util.GetTelemetryDir()):
    from telemetry import project_config
with path_util.SysPath(path_util.GetVariationsDir()):
    import fieldtrial_util  # pylint: disable=import-error


class ChromiumConfig(project_config.ProjectConfig):
    def __init__(self,
                 top_level_dir=None,
                 benchmark_dirs=None,
                 client_configs=None,
                 default_chrome_root=None,
                 expectations_files=None):
        if client_configs is None:
            client_configs = [CLIENT_CONFIG_PATH]
        if default_chrome_root is None:
            default_chrome_root = path_util.GetChromiumSrcDir()

        super(ChromiumConfig,
예제 #11
0
SRC_ROOT = os.path.abspath(
    os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
RESULTS2JSON = os.path.join(
    SRC_ROOT, 'third_party', 'catapult', 'tracing', 'bin', 'results2json')
HISTOGRAM2CSV = os.path.join(
    SRC_ROOT, 'third_party', 'catapult', 'tracing', 'bin', 'histograms2csv')
RUN_BENCHMARK = os.path.join(SRC_ROOT, 'tools', 'perf', 'run_benchmark')
DATA_DIR = os.path.join(SRC_ROOT, 'tools', 'perf', 'page_sets', 'data')
RECORD_WPR = os.path.join(SRC_ROOT, 'tools', 'perf', 'record_wpr')
DEFAULT_REVIEWERS = ['*****@*****.**']
MISSING_RESOURCE_RE = re.compile(
    r'\[network\]: Failed to load resource: the server responded with a status '
    r'of 404 \(\) ([^\s]+)')
TELEMETRY_BIN_DEPS_CONFIG = os.path.join(
    path_util.GetTelemetryDir(), 'telemetry', 'binary_dependencies.json')


def _GetBranchName():
  return subprocess.check_output(
      ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()


def _OpenBrowser(url):
  # Redirect I/O before invoking browser to avoid it spamming our output.
  # Based on https://stackoverflow.com/a/2323563.
  savout = os.dup(1)
  saverr = os.dup(2)
  os.close(1)
  os.close(2)
  os.open(os.devnull, os.O_RDWR)