mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix test_sky in release builds
This CL passes the configuration information from test_sky to sky_server so that sky_server can find the correct output directory. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/705623003
This commit is contained in:
parent
3d14b06ca9
commit
593a7cc231
@ -8,7 +8,8 @@ import cherrypy
|
||||
import json
|
||||
import os
|
||||
import staticdirindex
|
||||
import skypy.paths as paths
|
||||
from skypy.paths import Paths
|
||||
import skypy.configuration as configuration
|
||||
|
||||
def skydir(section="", dir="", path="", **kwargs):
|
||||
if cherrypy.request.params.get('format') is None:
|
||||
@ -33,10 +34,13 @@ def main():
|
||||
help='Enable logging to the console.')
|
||||
parser.add_argument('app_path', type=str)
|
||||
parser.add_argument('port', type=int)
|
||||
configuration.add_arguments(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
log_dir = os.path.abspath(os.getcwd())
|
||||
|
||||
paths = Paths(os.path.join('out', args.configuration))
|
||||
|
||||
config = {
|
||||
'global': {
|
||||
'server.socket_port': args.port,
|
||||
@ -55,15 +59,15 @@ def main():
|
||||
},
|
||||
'/mojo/public': {
|
||||
'tools.staticdir.on': True,
|
||||
'tools.staticdir.dir': os.path.join(paths.GEN_ROOT, 'mojo', 'public'),
|
||||
'tools.staticdir.dir': os.path.join(paths.gen_root, 'mojo', 'public'),
|
||||
},
|
||||
'/mojo/services': {
|
||||
'tools.staticdir.on': True,
|
||||
'tools.staticdir.dir': os.path.join(paths.GEN_ROOT, 'mojo', 'services'),
|
||||
'tools.staticdir.dir': os.path.join(paths.gen_root, 'mojo', 'services'),
|
||||
},
|
||||
'/sky/services': {
|
||||
'tools.staticdir.on': True,
|
||||
'tools.staticdir.dir': os.path.join(paths.GEN_ROOT, 'sky', 'services'),
|
||||
'tools.staticdir.dir': os.path.join(paths.gen_root, 'sky', 'services'),
|
||||
},
|
||||
}
|
||||
cherrypy.quickstart(config=config)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import skypy.paths as paths
|
||||
from skypy.paths import Paths
|
||||
import socket;
|
||||
import subprocess
|
||||
import sys
|
||||
@ -23,6 +23,7 @@ SUPPORTED_MIME_TYPES = [
|
||||
class SkyDebugger(object):
|
||||
def __init__(self):
|
||||
self._sky_server = None
|
||||
self.paths = Paths(os.path.join('out', 'Debug'))
|
||||
|
||||
@staticmethod
|
||||
def _port_in_use(port):
|
||||
@ -32,9 +33,10 @@ class SkyDebugger(object):
|
||||
def _start_http_server_for_file(self, path):
|
||||
HTTP_PORT = 9999
|
||||
|
||||
|
||||
path = os.path.abspath(path)
|
||||
if os.path.commonprefix([path, paths.SRC_ROOT]) == paths.SRC_ROOT:
|
||||
server_root = paths.SRC_ROOT
|
||||
if os.path.commonprefix([path, self.paths.src_root]) == self.paths.src_root:
|
||||
server_root = self.paths.src_root
|
||||
else:
|
||||
server_root = os.path.dirname(path)
|
||||
logging.warn(
|
||||
@ -48,7 +50,8 @@ class SkyDebugger(object):
|
||||
HTTP_PORT)
|
||||
else:
|
||||
server_command = [
|
||||
os.path.join(paths.SKY_TOOLS_DIRECTORY, 'sky_server'),
|
||||
os.path.join(self.paths.sky_tools_directory, 'sky_server'),
|
||||
'--debug',
|
||||
server_root,
|
||||
str(HTTP_PORT),
|
||||
]
|
||||
@ -67,7 +70,7 @@ class SkyDebugger(object):
|
||||
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
|
||||
for mime_type in SUPPORTED_MIME_TYPES]
|
||||
shell_command = [
|
||||
paths.MOJO_SHELL_PATH,
|
||||
self.paths.mojo_shell_path,
|
||||
'--v=1',
|
||||
'--content-handlers=%s' % ','.join(content_handlers),
|
||||
'--url-mappings=mojo:window_manager=mojo:sky_debugger',
|
||||
|
||||
15
engine/src/flutter/tools/skypy/configuration.py
Normal file
15
engine/src/flutter/tools/skypy/configuration.py
Normal file
@ -0,0 +1,15 @@
|
||||
# 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 optparse
|
||||
|
||||
|
||||
def add_arguments(parser):
|
||||
parser.add_argument("-t", "--target", dest="configuration",
|
||||
help="Specify the target configuration to use (Debug/Release)", default='Release')
|
||||
parser.add_argument('--debug', action='store_const', const='Debug', dest="configuration",
|
||||
help='Set the configuration to Debug')
|
||||
parser.add_argument('--release', action='store_const', const='Release', dest="configuration",
|
||||
help='Set the configuration to Release')
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
|
||||
import os
|
||||
|
||||
BUILD_DIRECTORY = 'out'
|
||||
CONFIG_DIRECTORY = 'Debug'
|
||||
SRC_ROOT = os.path.abspath(os.path.join(__file__,
|
||||
os.pardir, os.pardir, os.pardir, os.pardir))
|
||||
SKY_ROOT = os.path.join(SRC_ROOT, 'sky')
|
||||
GEN_ROOT = os.path.join(SRC_ROOT, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'gen')
|
||||
SKY_TOOLS_DIRECTORY = os.path.join(SRC_ROOT, 'sky', 'tools')
|
||||
MOJO_SHELL_PATH = os.path.join(SRC_ROOT, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'mojo_shell')
|
||||
class Paths(object):
|
||||
def __init__(self, build_directory):
|
||||
self.src_root = os.path.abspath(os.path.join(__file__,
|
||||
os.pardir, os.pardir, os.pardir, os.pardir))
|
||||
self.sky_root = os.path.join(self.src_root, 'sky')
|
||||
self.gen_root = os.path.join(self.src_root, build_directory, 'gen')
|
||||
self.sky_tools_directory = os.path.join(self.src_root, 'sky', 'tools')
|
||||
self.mojo_shell_path = os.path.join(self.src_root, build_directory, 'mojo_shell')
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
import skypy.paths as paths
|
||||
from skypy.paths import Paths
|
||||
import subprocess
|
||||
import requests
|
||||
|
||||
@ -20,27 +20,6 @@ HTTP_PORT = 9999
|
||||
DASHBOARD_URL = 'https://chromeperf.appspot.com/add_point'
|
||||
|
||||
|
||||
def sky_tester_command(url):
|
||||
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
|
||||
for mime_type in SUPPORTED_MIME_TYPES]
|
||||
return [
|
||||
paths.MOJO_SHELL_PATH,
|
||||
'--args-for=mojo://native_viewport_service/ --use-headless-config --use-osmesa',
|
||||
'--args-for=mojo://window_manager/ %s' % url,
|
||||
'--content-handlers=%s' % ','.join(content_handlers),
|
||||
'--url-mappings=mojo:window_manager=mojo://sky_tester/',
|
||||
'mojo:window_manager',
|
||||
]
|
||||
|
||||
|
||||
def start_sky_server(port):
|
||||
return subprocess.Popen([
|
||||
os.path.join(paths.SKY_TOOLS_DIRECTORY, 'sky_server'),
|
||||
paths.SRC_ROOT,
|
||||
str(port),
|
||||
])
|
||||
|
||||
|
||||
def values_from_output(output):
|
||||
# Parse out the raw values from the PerfRunner output:
|
||||
# values 90, 89, 93 ms
|
||||
@ -82,15 +61,33 @@ def send_json_to_dashboard(json):
|
||||
class PerfHarness(object):
|
||||
def __init__(self):
|
||||
self._sky_server = None
|
||||
self.paths = Paths(os.path.join('out', 'Debug'))
|
||||
|
||||
def _start_server(self):
|
||||
self._sky_server = start_sky_server(HTTP_PORT)
|
||||
return subprocess.Popen([
|
||||
os.path.join(self.paths.sky_tools_directory, 'sky_server'),
|
||||
self.paths.src_root,
|
||||
str(HTTP_PORT),
|
||||
])
|
||||
|
||||
def _sky_tester_command(self, url):
|
||||
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
|
||||
for mime_type in SUPPORTED_MIME_TYPES]
|
||||
return [
|
||||
self.paths.mojo_shell_path,
|
||||
'--args-for=mojo://native_viewport_service/ --use-headless-config --use-osmesa',
|
||||
'--args-for=mojo://window_manager/ %s' % url,
|
||||
'--content-handlers=%s' % ','.join(content_handlers),
|
||||
'--url-mappings=mojo:window_manager=mojo://sky_tester/',
|
||||
'mojo:window_manager',
|
||||
]
|
||||
|
||||
|
||||
def main(self):
|
||||
test = 'http://localhost:9999/sky/benchmarks/layout/simple-blocks.sky'
|
||||
|
||||
self._start_server()
|
||||
output = subprocess.check_output(sky_tester_command(test))
|
||||
output = subprocess.check_output(self._sky_tester_command(test))
|
||||
values = values_from_output(output)
|
||||
json = create_json_blob(values)
|
||||
send_json_to_dashboard(json)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user