зеркало из https://github.com/AvaloniaUI/angle.git
Capture/Replay: GN cleanups.
This adds a GN "angle_trace_library" template that will be used with capture replay tests and restricted trace tests to share code. It could also be theoretically used to fix the capture replay sample. Also changes the capture replay tests GN to make the test exe always build even without the defines. This is possible because of the switch to JSON from code autogen, and makes it easier to catch and fix compile errors in this test harness. Bug: angleproject:5133 Change-Id: Ia87b6bbb0ea6e1abb557f962ca16d074207325ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3360783 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
85de4f81e9
Коммит
58aeec65c9
|
@ -573,3 +573,59 @@ template("angle_trace") {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_defaults("angle_trace_library") {
|
||||
# Uses a short name to work around file path limits on Windows.
|
||||
short_names = false
|
||||
}
|
||||
|
||||
template("angle_trace_library") {
|
||||
_trace_json = read_file(invoker.json_path, "json")
|
||||
_trace_targets = []
|
||||
|
||||
if (invoker.short_names) {
|
||||
_trace_counter = 1
|
||||
}
|
||||
|
||||
foreach(_trace_and_version, _trace_json.traces) {
|
||||
_trace_and_version_arr = []
|
||||
_trace_and_version_arr = string_split(_trace_and_version)
|
||||
_trace = _trace_and_version_arr[0]
|
||||
if (defined(invoker.trace_dir)) {
|
||||
_trace_dir = invoker.trace_dir
|
||||
} else {
|
||||
_trace_dir = _trace
|
||||
}
|
||||
_trace_json_path = "$_trace_dir/$_trace.json"
|
||||
_trace_data = []
|
||||
_trace_data = read_file(_trace_json_path, "json")
|
||||
|
||||
if (invoker.short_names) {
|
||||
_target = "cr_trace_${_trace_counter}"
|
||||
_trace_counter += 1
|
||||
} else {
|
||||
_target = "${target_name}_$_trace"
|
||||
}
|
||||
angle_trace(_target) {
|
||||
sources = rebase_path(_trace_data.TraceFiles, ".", _trace_dir)
|
||||
|
||||
data = [
|
||||
"$_trace_dir/$_trace.json",
|
||||
"$_trace_dir/$_trace.angledata.gz",
|
||||
]
|
||||
fixture = invoker.trace_fixture
|
||||
|
||||
if (invoker.short_names) {
|
||||
output_name = _trace
|
||||
}
|
||||
}
|
||||
|
||||
_trace_targets += [ ":$_target" ]
|
||||
}
|
||||
|
||||
group(target_name) {
|
||||
testonly = true
|
||||
data = [ invoker.json_path ]
|
||||
data_deps = _trace_targets
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,79 +14,61 @@ declare_args() {
|
|||
angle_capture_replay_composite_file_id = 1
|
||||
}
|
||||
|
||||
angle_trace_fixture("angle_capture_replay_tests_fixture") {
|
||||
gl_header = "angle_trace_gl.h"
|
||||
public_deps = [
|
||||
"$angle_root:libEGL",
|
||||
"$angle_root/util:angle_util",
|
||||
]
|
||||
}
|
||||
|
||||
_test_names_file = "test_names_${angle_capture_replay_composite_file_id}.json"
|
||||
|
||||
if (angle_build_capture_replay_tests) {
|
||||
assert(angle_with_capture_by_default, "Must build with capture by default.")
|
||||
|
||||
angle_trace_fixture("angle_capture_replay_tests_fixture") {
|
||||
gl_header = "angle_trace_gl.h"
|
||||
public_deps = [
|
||||
"$angle_root:libEGL",
|
||||
"$angle_root/util:angle_util",
|
||||
]
|
||||
}
|
||||
|
||||
_dir = angle_capture_replay_test_trace_dir
|
||||
|
||||
# Build each trace into a module. Use a short name to work around file path limits on Windows.
|
||||
# TODO(jmadill): Merge this config with restricted traces. http://anglebug.com/5133
|
||||
|
||||
_test_names_file = "test_names_${angle_capture_replay_composite_file_id}.json"
|
||||
_test_names_json = read_file("$_dir/$_test_names_file", "json")
|
||||
|
||||
_trace_counter = 1
|
||||
_traces = []
|
||||
foreach(_trace, _test_names_json.traces) {
|
||||
_trace_json_path = "$_dir/$_trace.json"
|
||||
|
||||
# This extra empty step is needed to prevent GN from warning on reassignment.
|
||||
_trace_data = []
|
||||
_trace_data = read_file(_trace_json_path, "json")
|
||||
_target = "cr_trace_${_trace_counter}"
|
||||
_trace_counter += 1
|
||||
angle_trace(_target) {
|
||||
sources = rebase_path(_trace_data.TraceFiles, ".", _dir)
|
||||
data = []
|
||||
fixture = ":angle_capture_replay_tests_fixture"
|
||||
output_name = _trace
|
||||
}
|
||||
|
||||
_traces += [ ":${_target}" ]
|
||||
}
|
||||
|
||||
angle_executable("capture_replay_tests") {
|
||||
testonly = true
|
||||
sources = [ "CaptureReplayTests.cpp" ]
|
||||
data = [ "$_dir/$_test_names_file" ]
|
||||
deps = [
|
||||
":angle_capture_replay_tests_fixture",
|
||||
"$angle_root:angle_common",
|
||||
"$angle_root:angle_compression",
|
||||
"$angle_root/util:angle_frame_capture_test_utils",
|
||||
] + _traces
|
||||
configs += [
|
||||
"$angle_root:library_name_config",
|
||||
"$angle_root:libANGLE_config",
|
||||
]
|
||||
defines = []
|
||||
|
||||
if ((is_linux || is_chromeos) && !is_component_build) {
|
||||
# Set rpath to find shared libs in a non-component build.
|
||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
|
||||
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
|
||||
|
||||
# Disable optimization to avoid optimizing huge files.
|
||||
_trace_folder_relative_path = "./" + angle_capture_replay_test_trace_dir
|
||||
_data_path = rebase_path(_trace_folder_relative_path, root_out_dir)
|
||||
defines = [
|
||||
"ANGLE_CAPTURE_REPLAY_TEST_DATA_DIR=\"${_data_path}\"",
|
||||
"ANGLE_CAPTURE_REPLAY_TEST_NAMES_PATH=\"${_data_path}/${_test_names_file}\"",
|
||||
"ANGLE_REPLAY_EXPORT=",
|
||||
]
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
} else {
|
||||
group("capture_replay_tests") {
|
||||
angle_trace_library("angle_capture_replay_library") {
|
||||
_tracedir = angle_capture_replay_test_trace_dir
|
||||
trace_dir = _tracedir
|
||||
json_path = "$_tracedir/$_test_names_file"
|
||||
trace_fixture = ":angle_capture_replay_tests_fixture"
|
||||
short_names = true
|
||||
}
|
||||
}
|
||||
|
||||
angle_executable("capture_replay_tests") {
|
||||
testonly = true
|
||||
sources = [ "CaptureReplayTests.cpp" ]
|
||||
deps = [
|
||||
":angle_capture_replay_tests_fixture",
|
||||
"$angle_root:angle_common",
|
||||
"$angle_root:angle_compression",
|
||||
"$angle_root/util:angle_frame_capture_test_utils",
|
||||
]
|
||||
configs += [
|
||||
"$angle_root:library_name_config",
|
||||
"$angle_root:libANGLE_config",
|
||||
]
|
||||
defines = []
|
||||
|
||||
if ((is_linux || is_chromeos) && !is_component_build) {
|
||||
# Set rpath to find shared libs in a non-component build.
|
||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
|
||||
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
|
||||
|
||||
# Disable optimization to avoid optimizing huge files.
|
||||
_trace_folder_relative_path = "./" + angle_capture_replay_test_trace_dir
|
||||
_data_path = rebase_path(_trace_folder_relative_path, root_out_dir)
|
||||
defines = [
|
||||
"ANGLE_CAPTURE_REPLAY_TEST_DATA_DIR=\"${_data_path}\"",
|
||||
"ANGLE_CAPTURE_REPLAY_TEST_NAMES_PATH=\"${_data_path}/${_test_names_file}\"",
|
||||
"ANGLE_REPLAY_EXPORT=",
|
||||
]
|
||||
include_dirs = [ "." ]
|
||||
|
||||
if (angle_build_capture_replay_tests) {
|
||||
data_deps = [ ":angle_capture_replay_library" ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,29 +27,9 @@ angle_trace_fixture("angle_restricted_trace_fixture") {
|
|||
public_configs = [ "$angle_root:no_gl_prototypes" ]
|
||||
}
|
||||
|
||||
_trace_json = read_file("restricted_traces.json", "json")
|
||||
_trace_targets = []
|
||||
|
||||
foreach(_trace_and_version, _trace_json.traces) {
|
||||
_trace_and_version_arr = []
|
||||
_trace_and_version_arr = string_split(_trace_and_version)
|
||||
_trace = _trace_and_version_arr[0]
|
||||
_trace_json_path = "$_trace/$_trace.json"
|
||||
_trace_data = []
|
||||
_trace_data = read_file(_trace_json_path, "json")
|
||||
_target = "angle_restricted_trace_$_trace"
|
||||
|
||||
angle_trace(_target) {
|
||||
sources = rebase_path(_trace_data.TraceFiles, ".", _trace)
|
||||
|
||||
data = [
|
||||
"$_trace/$_trace.json",
|
||||
"$_trace/$_trace.angledata.gz",
|
||||
]
|
||||
fixture = ":angle_restricted_trace_fixture"
|
||||
}
|
||||
|
||||
_trace_targets += [ ":$_target" ]
|
||||
angle_trace_library("angle_restricted_trace") {
|
||||
json_path = "restricted_traces.json"
|
||||
trace_fixture = ":angle_restricted_trace_fixture"
|
||||
}
|
||||
|
||||
angle_shared_library("angle_restricted_traces") {
|
||||
|
@ -59,7 +39,7 @@ angle_shared_library("angle_restricted_traces") {
|
|||
|
||||
data = [ "restricted_traces.json" ]
|
||||
|
||||
data_deps = _trace_targets
|
||||
data_deps = [ ":angle_restricted_trace" ]
|
||||
defines = [ "ANGLE_TRACE_IMPLEMENTATION" ]
|
||||
|
||||
deps = [
|
||||
|
|
Загрузка…
Ссылка в новой задаче