Commit f629859f authored by chenwilliam's avatar chenwilliam Committed by Commit bot

DevTools: Run devtools tests in release mode

This modifies our build process so regardless of whether debug_devtools is enabled
a release mode version is built specifically for our tests. This
doesn't affect the normal use or development of DevTools because it creates
a separate copy of the app in release mode in "out/Release/resources/inspector_release".

People can opt out of using release mode by passing "--additional-drt-flag='--debug-devtools'"
to run_layout_tests.py if they are trying to debug a layout test.

This will decrease the time of our test suite by ~25% (20 seconds faster).

Stats for running our tests:
16 process - debug mode: average 83 seconds (3 runs)
16 process - release mode: average 63 seconds (4 runs)

Even in fully parallel, this speeds up our test from ~50 seconds to ~40 seconds,
however fully parallel mode had a wide variance from 40 to 60 seconds
between different runs.

Tests included:
inspector inspector-protocol inspector-enabled http/tests/inspector

Review-Url: https://codereview.chromium.org/2262743002
Cr-Commit-Position: refs/heads/master@{#415742}
parent c1a0c4f2
...@@ -222,7 +222,8 @@ bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { ...@@ -222,7 +222,8 @@ bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) {
if (inspector_dir.empty()) if (inspector_dir.empty())
return false; return false;
*path = inspector_dir.AppendASCII(relative_path); // Use the non-bundled and non-minified devtools app for development
*path = inspector_dir.AppendASCII("debug").AppendASCII(relative_path);
return true; return true;
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/layout_test/blink_test_controller.h"
#include "content/shell/browser/shell.h" #include "content/shell/browser/shell.h"
#include "content/shell/common/layout_test/layout_test_switches.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
namespace content { namespace content {
...@@ -51,15 +52,17 @@ GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL( ...@@ -51,15 +52,17 @@ GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL(
// We need to go up 3 directories to get to out/Release. // We need to go up 3 directories to get to out/Release.
dir_exe = dir_exe.AppendASCII("../../.."); dir_exe = dir_exe.AppendASCII("../../..");
#endif #endif
bool is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDebugDevTools);
std::string folder = is_debug_dev_tools ? "debug/" : "";
base::FilePath dev_tools_path = base::FilePath dev_tools_path =
dir_exe.AppendASCII("resources/inspector/inspector.html"); dir_exe.AppendASCII("resources/inspector/" + folder + "inspector.html");
GURL result = net::FilePathToFileURL(dev_tools_path); GURL result = net::FilePathToFileURL(dev_tools_path);
std::string url_string = std::string url_string =
base::StringPrintf("%s?experiments=true", result.spec().c_str()); base::StringPrintf("%s?experiments=true", result.spec().c_str());
#if defined(DEBUG_DEVTOOLS) if (is_debug_dev_tools)
url_string += "&debugFrontend=true"; url_string += "&debugFrontend=true";
#endif // defined(DEBUG_DEVTOOLS)
return GURL(url_string); return GURL(url_string);
} }
......
...@@ -19,6 +19,9 @@ const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps"; ...@@ -19,6 +19,9 @@ const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps";
// causes the leak detector to cause immediate crash when found leak. // causes the leak detector to cause immediate crash when found leak.
const char kCrashOnFailure[] = "crash-on-failure"; const char kCrashOnFailure[] = "crash-on-failure";
// Run devtools tests in debug mode (not bundled and minified)
const char kDebugDevTools[] = "debug-devtools";
// Enable accelerated 2D canvas. // Enable accelerated 2D canvas.
const char kEnableAccelerated2DCanvas[] = "enable-accelerated-2d-canvas"; const char kEnableAccelerated2DCanvas[] = "enable-accelerated-2d-canvas";
......
...@@ -15,6 +15,7 @@ namespace switches { ...@@ -15,6 +15,7 @@ namespace switches {
extern const char kAllowExternalPages[]; extern const char kAllowExternalPages[];
extern const char kCheckLayoutTestSysDeps[]; extern const char kCheckLayoutTestSysDeps[];
extern const char kCrashOnFailure[]; extern const char kCrashOnFailure[];
extern const char kDebugDevTools[];
extern const char kEnableAccelerated2DCanvas[]; extern const char kEnableAccelerated2DCanvas[];
extern const char kEnableFontAntialiasing[]; extern const char kEnableFontAntialiasing[];
extern const char kAlwaysUseComplexText[]; extern const char kAlwaysUseComplexText[];
......
This diff is collapsed.
...@@ -409,6 +409,8 @@ Runtime.prototype = { ...@@ -409,6 +409,8 @@ Runtime.prototype = {
useTestBase: function() useTestBase: function()
{ {
Runtime._remoteBase = "http://localhost:8000/inspector-sources/"; Runtime._remoteBase = "http://localhost:8000/inspector-sources/";
if (Runtime.queryParam("debugFrontend"))
Runtime._remoteBase += "debug/";
}, },
/** /**
......
{ {
"modules": [ "modules": [
{ "name": "formatter_worker", "type": "autostart" }, { "name": "formatter_worker", "type": "autostart" },
{ "name": "gonzales", "type": "remoteInRelease" } { "name": "gonzales", "type": "remote" }
], ],
"has_html": false "has_html": false
......
...@@ -26,17 +26,17 @@ ...@@ -26,17 +26,17 @@
{ "name": "console" }, { "name": "console" },
{ "name": "source_frame" }, { "name": "source_frame" },
{ "name": "text_editor" }, { "name": "text_editor" },
{ "name": "cm_modes", "type": "remoteInRelease" }, { "name": "cm_modes", "type": "remote" },
{ "name": "settings" }, { "name": "settings" },
{ "name": "layers", "condition": "!v8only" }, { "name": "layers", "condition": "!v8only" },
{ "name": "snippets" }, { "name": "snippets" },
{ "name": "diff" }, { "name": "diff" },
{ "name": "sass", "condition": "!v8only" }, { "name": "sass", "condition": "!v8only" },
{ "name": "accessibility", "condition": "!v8only", "type": "remoteInRelease" }, { "name": "accessibility", "condition": "!v8only", "type": "remote" },
{ "name": "animation", "condition": "!v8only" }, { "name": "animation", "condition": "!v8only" },
{ "name": "es_tree" }, { "name": "es_tree" },
{ "name": "screencast", "condition": "remoteFrontend", "type": "remoteInRelease" }, { "name": "screencast", "condition": "remoteFrontend", "type": "remote" },
{ "name": "emulated_devices", "condition": "!v8only" , "type": "remoteInRelease" } { "name": "emulated_devices", "condition": "!v8only" , "type": "remote" }
], ],
"has_html": true "has_html": true
......
...@@ -100,9 +100,6 @@ class ReleaseBuilder(AppBuilder): ...@@ -100,9 +100,6 @@ class ReleaseBuilder(AppBuilder):
AppBuilder.__init__(self, application_name, descriptors, application_dir, output_dir) AppBuilder.__init__(self, application_name, descriptors, application_dir, output_dir)
def build_app(self): def build_app(self):
for module in self.descriptors.application.values():
if 'type' in module and module['type'] == 'remoteInRelease':
module['type'] = 'remote'
if self.descriptors.has_html: if self.descriptors.has_html:
self._build_html() self._build_html()
self._build_app_script() self._build_app_script()
......
#!/usr/bin/env bash
# Copyright (c) 2016 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.
# Get the full directory path of this script regardless of where it's run from
# Based on: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"
CHROMIUM_ROOT_PATH=${SCRIPT_PATH}"/../../../../.."
OUT_PATH=${CHROMIUM_ROOT_PATH}"/out/Release"
RUN_LAYOUT_TEST_PATH=${CHROMIUM_ROOT_PATH}"/blink/tools/run_layout_tests.py"
INSPECTOR_TEST_SUITES="inspector inspector-protocol inspector-enabled http/tests/inspector"
ninja -C ${OUT_PATH} -j 1000 chrome blink_tests
${RUN_LAYOUT_TEST_PATH} ${INSPECTOR_TEST_SUITES} --child-processes=16 "$@"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment