Commit 16c41931 authored by chenwilliam's avatar chenwilliam Committed by Commit bot

DevTools: npm test - add --target=SUB_DIRECTORY_NAME

See readme for how-to use.

BUG=none

Review-Url: https://codereview.chromium.org/2669593003
Cr-Commit-Position: refs/heads/master@{#447935}
parent 9d8e8152
......@@ -100,6 +100,12 @@ npm test -- --time-out-ms=6000000 <test_path>
npm test -- --fetch-content-shell
```
#### `--target=SUB_DIRECTORY_NAME`
```
# If you're using a build sub-directory that's not out/Release,
# such as out/Default, then use --target=SUB_DIRECTORY_NAME
npm test -- --target=Default
```
### Development
* All devtools commits: [View the log], [RSS feed] or [@DevToolsCommits] on Twitter
* [All open DevTools tickets] on crbug.com
......
......@@ -14,7 +14,8 @@ var Flags = {
DEBUG_DEVTOOLS_SHORTHAND: '-d',
FETCH_CONTENT_SHELL: '--fetch-content-shell',
COMPAT_PROTOCOL: '--compat-protocol', // backwards compatibility testing
CHROMIUM_PATH: '--chromium-path' // useful for bisecting
CHROMIUM_PATH: '--chromium-path', // useful for bisecting
TARGET: '--target', // build sub-directory (e.g. Release, Default)
};
var COMPAT_URL_MAPPING = {
......@@ -26,6 +27,7 @@ var IS_DEBUG_ENABLED =
var COMPAT_PROTOCOL = utils.parseArgs(process.argv)[Flags.COMPAT_PROTOCOL];
var CUSTOM_CHROMIUM_PATH = utils.parseArgs(process.argv)[Flags.CHROMIUM_PATH];
var IS_FETCH_CONTENT_SHELL = utils.includes(process.argv, Flags.FETCH_CONTENT_SHELL);
var TARGET = utils.parseArgs(process.argv)[Flags.TARGET] || 'Release';
var CONTENT_SHELL_ZIP = 'content-shell.zip';
var MAX_CONTENT_SHELLS = 10;
......@@ -33,7 +35,7 @@ var PLATFORM = getPlatform();
var PYTHON = process.platform === 'win32' ? 'python.bat' : 'python';
var CHROMIUM_SRC_PATH = CUSTOM_CHROMIUM_PATH || path.resolve(__dirname, '..', '..', '..', '..', '..');
var RELEASE_PATH = path.resolve(CHROMIUM_SRC_PATH, 'out', 'Release');
var RELEASE_PATH = path.resolve(CHROMIUM_SRC_PATH, 'out', TARGET);
var BLINK_TEST_PATH = path.resolve(CHROMIUM_SRC_PATH, 'blink', 'tools', 'run_layout_tests.py');
var DEVTOOLS_PATH = path.resolve(CHROMIUM_SRC_PATH, 'third_party', 'WebKit', 'Source', 'devtools');
var CACHE_PATH = path.resolve(DEVTOOLS_PATH, '.test_cache');
......@@ -72,7 +74,7 @@ function runCompatibilityTests() {
utils.removeRecursive(path.resolve(RELEASE_PATH, 'resources', 'inspector'));
compileFrontend();
var outPath = path.resolve(CACHE_PATH, folder, 'out');
var contentShellDirPath = path.resolve(outPath, 'Release');
var contentShellDirPath = path.resolve(outPath, TARGET);
var hasCachedContentShell = utils.isFile(getContentShellBinaryPath(contentShellDirPath));
if (hasCachedContentShell) {
console.log(`Using cached content shell at: ${outPath}`);
......@@ -99,7 +101,7 @@ function compileFrontend() {
}
function onUploadedCommitPosition(commitPosition) {
var contentShellDirPath = path.resolve(CACHE_PATH, commitPosition, 'out', 'Release');
var contentShellDirPath = path.resolve(CACHE_PATH, commitPosition, 'out', TARGET);
var contentShellResourcesPath = path.resolve(contentShellDirPath, 'resources');
var contentShellPath = path.resolve(CACHE_PATH, commitPosition, 'out');
......@@ -239,7 +241,7 @@ function extractContentShell(contentShellZipPath) {
shell(`${PYTHON} ${unzipScriptPath} ${src} ${dest}`);
fs.unlinkSync(src);
var originalDirPath = path.resolve(dest, 'content-shell');
var newDirPath = path.resolve(dest, 'Release');
var newDirPath = path.resolve(dest, TARGET);
fs.renameSync(originalDirPath, newDirPath);
fs.chmodSync(getContentShellBinaryPath(newDirPath), '755');
if (process.platform === 'darwin') {
......@@ -267,6 +269,8 @@ function runTests(buildDirectoryPath, useDebugDevtools) {
'--no-pixel-tests',
'--build-directory',
buildDirectoryPath,
'--target',
TARGET,
]);
if (useDebugDevtools)
testArgs.push('--additional-driver-flag=--debug-devtools');
......
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