angle_trace_tests_android_binaries: test -> group

We don't need it to be a test to begin with. But I looked into it
because test with use_raw_android_executable=True makes things
really complicated due to the way this is implemented upstream:
'''
this __dist target here
    https://crsrc.org/c/testing/test.gni;drc=acb6ab509901650450fc387c0d9f09eb6f3f3248;l=265
which uses create_native_executable_dist
which copies files according to the list of libs:
    https://crsrc.org/c/build/config/android/rules.gni;drc=a8c26a11f6cf763a5e81b2bced40584a678b9b8a;l=94
which is actually generated not at build time but by gn gen
(also called when editing gn args)
and so the inputs are not the libs themselves but
this file which only contains a list of file names
so when libs change there is no change to the inputs of this rule..
so it doesn't get invoked and the copy doesn't happen
'''

One caveat is we need to produce a list of .so libs as a data dependency
for them to be picked up by isolate

Bug: b/276474703
Change-Id: I375a5be8499f13311654244036e36c60d945c363
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4507534
Auto-Submit: Roman Lavrov <romanl@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Roman Lavrov
2023-05-04 15:57:43 -04:00
committed by Angle LUCI CQ
parent e24f45195c
commit 3ad1d7024a
3 changed files with 34 additions and 37 deletions

View File

@@ -560,20 +560,10 @@ if (angle_standalone || build_with_chromium) {
if (is_android) {
public_configs += [ "$angle_root:build_id_config" ]
configs -= [ "//build/config/android:hide_all_but_jni" ]
use_default_launcher = false
apk_build = true
if (defined(invoker.use_raw_android_executable)) {
# If the caller of this template has requested binaries only, skip the APK steps below
apk_build = !invoker.use_raw_android_executable
}
# Some of our build targets don't want an APK on Android, specifically trace tests which exceed APK size
if (apk_build) {
generate_final_jni = false
android_manifest_template = "$angle_root/src/tests/test_utils/runner/android/java/AndroidManifest.xml.jinja2"
configs -= [ "//build/config/android:hide_all_but_jni" ]
}
generate_final_jni = false
android_manifest_template = "$angle_root/src/tests/test_utils/runner/android/java/AndroidManifest.xml.jinja2"
deps += [
"$angle_root/src/tests:native_test_java",
@@ -646,11 +636,18 @@ set_defaults("angle_trace_library") {
template("angle_trace_library") {
_trace_targets = []
_trace_lib_files = []
if (invoker.short_names) {
_trace_counter = 1
}
if (is_android && is_component_build) {
_cr_suffix = ".cr"
} else {
_cr_suffix = ""
}
foreach(_trace_and_version, invoker.trace_list) {
_trace_and_version_arr = []
_trace_and_version_arr = string_split(_trace_and_version)
@@ -698,6 +695,21 @@ template("angle_trace_library") {
}
_trace_targets += [ ":$_target" ]
_trace_lib_files += [ "${root_out_dir}/lib${_target}${_cr_suffix}.so" ]
}
if (restricted_traces_outside_of_apk) {
group("angle_trace_tests_android_binaries") {
testonly = true
deps = [
":angle_restricted_traces",
"$angle_root/util:angle_trace_interpreter",
]
# Also need files listed as data to be picked up by isolate
data = _trace_lib_files +
[ "${root_out_dir}/libangle_trace_interpreter${_cr_suffix}.so" ]
}
}
angle_shared_library(target_name) {

View File

@@ -504,30 +504,9 @@ if (build_angle_trace_tests) {
"$angle_root/util:angle_png_utils",
]
# These go together, either inside or outside of the APK depending on the config
_angle_trace_libs = [
"$angle_root/util:angle_trace_interpreter",
"restricted_traces:angle_restricted_traces",
]
# Allows us to edit traces and remove chunks of code without compile warnings.
_angle_trace_common_clang_flags = [ "-Wno-unused-const-variable" ]
if (restricted_traces_outside_of_apk) {
# If this flag is set, we want to build the trace libraries independent of the APK, i.e. not packaged.
# We're doing this for size reasons - the APK is too large if you include all the traces.
# We've repurposed the `angle_test` template for this, although we don't plan to run `restricted_traces_outside_of_apk` as a test itself.
# It will be used in conjunction with `angle_trace_tests`.
angle_test("angle_trace_tests_android_binaries") {
use_raw_android_executable = true
sources = _angle_trace_common_sources
deps = _angle_trace_common_deps +
[ "$angle_root/util:angle_trace_fixture" ] + _angle_trace_libs
cflags_cc = _angle_trace_common_clang_flags
}
}
angle_test("angle_trace_tests") {
# http://anglebug.com/6009: Traces with long shaders are hitting string literal
# limit in MSVC, so only compile them when using clang
@@ -541,10 +520,16 @@ if (build_angle_trace_tests) {
sources = _angle_trace_common_sources
deps = _angle_trace_common_deps
# If this flag is set, we want to build the trace libraries independent of the APK, i.e. not packaged.
# We're doing this for size reasons - the APK is too large if you include all the traces.
if (restricted_traces_outside_of_apk) {
deps += [ "$angle_root/util:angle_trace_loader" ]
} else {
deps += _angle_trace_libs
deps += [
"$angle_root/util:angle_trace_interpreter",
"restricted_traces:angle_restricted_traces",
]
}
data = [ "$angle_root/src/tests/py_utils/android_helper.py" ]
@@ -578,7 +563,7 @@ if (build_angle_trace_tests) {
]
if (restricted_traces_outside_of_apk) {
data_deps += [ ":angle_trace_tests_android_binaries" ]
deps = [ "restricted_traces:angle_trace_tests_android_binaries" ]
}
}

View File

@@ -276,7 +276,7 @@ def PrepareRestrictedTraces(traces):
_AdbRun(['push', local_path, device_path])
def _PushLibToAppDir(lib_name):
local_path = 'angle_trace_tests_android_binaries__dist/' + lib_name
local_path = lib_name
device_path = '/data/user/0/com.android.angle.test/angle_traces/' + lib_name
if _HashesMatch(local_path, device_path):
return