Files
react-native-devtools-frontend/scripts/devtools_paths.py
T
Tim van der Lippe 6a935445b3 Port perf test suite to mocha runner
This resurrects the perf test suite, as the older test-runner setup
was removed, but the perf test suite was not ported.

Example output:

Spawning hosted mode server
  Boot performance
    ✓ run 1/37 (1185ms)
    ✓ run 2/37 (1234ms)
    ✓ run 3/37 (1213ms)
    ✓ run 4/37 (1376ms)
    ✓ run 5/37 (1327ms)
    ✓ run 6/37 (1235ms)
    ✓ run 7/37 (1352ms)
    ✓ run 8/37 (1439ms)
    ✓ run 9/37 (1332ms)
    ✓ run 10/37 (1290ms)
    ✓ run 11/37 (1229ms)
    ✓ run 12/37 (1241ms)
    ✓ run 13/37 (1233ms)
    ✓ run 14/37 (1203ms)
    ✓ run 15/37 (1177ms)
    ✓ run 16/37 (1336ms)
    ✓ run 17/37 (1526ms)
    ✓ run 18/37 (1465ms)
    ✓ run 19/37 (1537ms)
    ✓ run 20/37 (1709ms)
    ✓ run 21/37 (1760ms)
    ✓ run 22/37 (1704ms)
    ✓ run 23/37 (2549ms)
    ✓ run 24/37 (1387ms)
    ✓ run 25/37 (1934ms)
    ✓ run 26/37 (1860ms)
    ✓ run 27/37 (1309ms)
    ✓ run 28/37 (1295ms)
    ✓ run 29/37 (1391ms)
    ✓ run 30/37 (1569ms)
    ✓ run 31/37 (1562ms)
    ✓ run 32/37 (1442ms)
    ✓ run 33/37 (1431ms)
    ✓ run 34/37 (1646ms)
    ✓ run 35/37 (1927ms)
    ✓ run 36/37 (1600ms)
    ✓ run 37/37 (1587ms)
Mean boot time: 1475.28ms
50th percentile boot time: 1390.83ms
90th percentile boot time: 1860.02ms
99th percentile boot time: 2549.29ms

R=aerotwist@chromium.org

Change-Id: I1b6a79fdfc1b7c98f6156d3309b5b98ff8530476
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2209108
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-05-20 13:42:43 +00:00

118 lines
3.5 KiB
Python

# 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.
"""
Helper to find the path to the correct third_party directory
"""
from os import path
import sys
import platform
# Find the root path of the checkout.
# In the Chromium repository, this is the src/chromium directory.
# In the external repository, standalone build, this is the devtools-frontend directory.
# In the external repository, integrated build, this is the src/chromium directory.
def root_path():
SCRIPTS_PATH = path.dirname(path.abspath(__file__))
ABS_DEVTOOLS_PATH = path.dirname(SCRIPTS_PATH)
PARENT_PATH = path.dirname(ABS_DEVTOOLS_PATH)
# TODO(1011259): remove Chromium repository handling
if path.basename(PARENT_PATH) == 'renderer':
# Chromium repository
return path.dirname(path.dirname(path.dirname(PARENT_PATH)))
elif path.basename(PARENT_PATH) == 'devtools-frontend':
# External repository, integrated build
return path.dirname(path.dirname(PARENT_PATH))
else:
# External repository, standalone build
return ABS_DEVTOOLS_PATH
# This is the third_party path relative to the root of the checkout.
def third_party_path():
return path.join(root_path(), 'third_party')
# This points to the node binary downloaded as part of the checkout.
def node_path():
try:
old_sys_path = sys.path[:]
sys.path.append(path.join(third_party_path(), 'node'))
import node
finally:
sys.path = old_sys_path
return node.GetBinaryPath()
def devtools_root_path():
return path.dirname((path.dirname(path.abspath(__file__))))
def node_modules_path():
return path.join(devtools_root_path(), 'node_modules')
def eslint_path():
return path.join(node_modules_path(), 'eslint', 'bin', 'eslint.js')
def mocha_path():
return path.join(node_modules_path(), 'mocha', 'bin', 'mocha')
def check_localizable_resources_path():
return path.join(devtools_root_path(), 'scripts', 'localization', 'check_localizable_resources.js')
def check_localized_strings_path():
return path.join(devtools_root_path(), 'scripts', 'localization', 'check_localizability.js')
def karma_path():
return path.join(node_modules_path(), 'karma', 'bin', 'karma')
def typescript_compiler_path():
return path.join(node_modules_path(), 'typescript', 'bin', 'tsc')
def hosted_mode_script_path():
return path.join(devtools_root_path(), 'scripts', 'hosted_mode', 'server.js')
def downloaded_chrome_binary_path():
return path.abspath(path.join(
*{
'Linux': (devtools_root_path(), 'third_party', 'chrome', 'chrome-linux', 'chrome'),
'Darwin': (devtools_root_path(), 'third_party', 'chrome', 'chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'),
'Windows': (devtools_root_path(), 'third_party', 'chrome', 'chrome-win', 'chrome.exe'),
}[platform.system()]))
def license_checker_path():
return path.join(node_modules_path(), 'license-checker', 'bin', 'license-checker')
def rollup_path():
return path.join(
node_modules_path(),
'rollup',
'dist',
'bin',
'rollup',
)
def package_lock_json_path():
return path.join(devtools_root_path(), 'package-lock.json')
def package_json_path():
return path.join(devtools_root_path(), 'package.json')
def browser_protocol_path():
return path.join(third_party_path(), 'blink', 'public', 'devtools_protocol', 'browser_protocol.pdl')