Commit 96c5e2df authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[test] Enable auto-detection of test flags in gyp

This ports the build_config json from GN to GYP to prepare deprecating
tedious flags passing to the test runner.

This also removes two unused GN flags that only hold temporary values.

Bug: v8:6917
Change-Id: I976185f1541277dc5c9bfbaa7578f35c19dd254c
Reviewed-on: https://chromium-review.googlesource.com/725706
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48715}
parent 73f984bd
...@@ -838,7 +838,6 @@ action("v8_dump_build_config") { ...@@ -838,7 +838,6 @@ action("v8_dump_build_config") {
is_gcov_coverage = v8_code_coverage && !is_clang is_gcov_coverage = v8_code_coverage && !is_clang
args = [ args = [
rebase_path("$root_out_dir/v8_build_config.json", root_build_dir), rebase_path("$root_out_dir/v8_build_config.json", root_build_dir),
"current_cpu=\"$current_cpu\"",
"dcheck_always_on=$dcheck_always_on", "dcheck_always_on=$dcheck_always_on",
"is_asan=$is_asan", "is_asan=$is_asan",
"is_cfi=$is_cfi", "is_cfi=$is_cfi",
...@@ -849,7 +848,6 @@ action("v8_dump_build_config") { ...@@ -849,7 +848,6 @@ action("v8_dump_build_config") {
"is_tsan=$is_tsan", "is_tsan=$is_tsan",
"is_ubsan_vptr=$is_ubsan_vptr", "is_ubsan_vptr=$is_ubsan_vptr",
"target_cpu=\"$target_cpu\"", "target_cpu=\"$target_cpu\"",
"v8_current_cpu=\"$v8_current_cpu\"",
"v8_enable_i18n_support=$v8_enable_i18n_support", "v8_enable_i18n_support=$v8_enable_i18n_support",
"v8_target_cpu=\"$v8_target_cpu\"", "v8_target_cpu=\"$v8_target_cpu\"",
"v8_use_snapshot=$v8_use_snapshot", "v8_use_snapshot=$v8_use_snapshot",
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
'msvs_use_common_release': 0, 'msvs_use_common_release': 0,
'clang%': 0, 'clang%': 0,
'asan%': 0, 'asan%': 0,
'cfi_vptr%': 0,
'lsan%': 0, 'lsan%': 0,
'msan%': 0, 'msan%': 0,
'tsan%': 0, 'tsan%': 0,
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
{ {
'target_name': 'v8', 'target_name': 'v8',
'dependencies_traverse': 1, 'dependencies_traverse': 1,
'dependencies': ['v8_maybe_snapshot'], 'dependencies': ['v8_maybe_snapshot', 'v8_dump_build_config'],
'conditions': [ 'conditions': [
['want_separate_host_toolset==1', { ['want_separate_host_toolset==1', {
'toolsets': ['host', 'target'], 'toolsets': ['host', 'target'],
...@@ -2519,5 +2519,49 @@ ...@@ -2519,5 +2519,49 @@
}], }],
], ],
}, },
{
'target_name': 'v8_dump_build_config',
'type': 'none',
'variables': {
},
'conditions': [
[ 'want_separate_host_toolset==1', {
'toolsets': ['host'],
}, {
'toolsets': ['target'],
}]
],
'actions': [
{
'action_name': 'v8_dump_build_config',
'inputs': [
'../tools/testrunner/utils/dump_build_config_gyp.py',
],
'outputs': [
'<(PRODUCT_DIR)/v8_build_config.json',
],
'action': [
'python',
'../tools/testrunner/utils/dump_build_config_gyp.py',
'<(PRODUCT_DIR)/v8_build_config.json',
'dcheck_always_on=<(dcheck_always_on)',
'is_asan=<(asan)',
'is_cfi=<(cfi_vptr)',
'is_component_build="<(component)"',
'is_debug="<(CONFIGURATION_NAME)"',
# Not available in gyp.
'is_gcov_coverage=0',
'is_msan=<(msan)',
'is_tsan=<(tsan)',
# Not available in gyp.
'is_ubsan_vptr=0',
'target_cpu="<(target_arch)"',
'v8_enable_i18n_support=<(v8_enable_i18n_support)',
'v8_target_cpu="<(v8_target_arch)"',
'v8_use_snapshot=<(v8_use_snapshot)',
],
},
],
},
], ],
} }
...@@ -15,7 +15,7 @@ import json ...@@ -15,7 +15,7 @@ import json
import os import os
import sys import sys
assert len(sys.argv) > 1 assert len(sys.argv) > 2
def as_json(kv): def as_json(kv):
assert '=' in kv assert '=' in kv
...@@ -23,4 +23,4 @@ def as_json(kv): ...@@ -23,4 +23,4 @@ def as_json(kv):
return k, json.loads(v) return k, json.loads(v)
with open(sys.argv[1], 'w') as f: with open(sys.argv[1], 'w') as f:
json.dump(dict(as_json(kv) for kv in sys.argv[2:]), f) json.dump(dict(map(as_json, sys.argv[2:])), f)
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The same as dump_build_config.py but for gyp legacy.
Expected to be called like:
dump_build_config.py path/to/file.json [key1=value1 ...]
Raw gyp values are supported - they will be tranformed into valid json.
"""
# TODO(machenbach): Remove this when gyp is deprecated.
import json
import os
import sys
assert len(sys.argv) > 2
GYP_GN_CONVERSION = {
'is_component_build': {
'"shared_library"': 'true',
'"static_library"': 'false',
},
'is_debug': {
'"Debug"': 'true',
'"Release"': 'false',
},
}
DEFAULT_CONVERSION ={
'0': 'false',
'1': 'true',
'"ia32"': '"x86"',
}
def gyp_to_gn(key, value):
return GYP_GN_CONVERSION.get(key, DEFAULT_CONVERSION).get(value, value)
def as_json(kv):
assert '=' in kv
k, v = kv.split('=', 1)
return k, json.loads(gyp_to_gn(k, v))
with open(sys.argv[1], 'w') as f:
json.dump(dict(map(as_json, sys.argv[2:])), f)
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