Android: improve error message due to missing trace libs

I think this only happens when angle_restricted_traces wasn't set in gn
args, resulting in traces outside of the apk.

Previously we'd get a confusing error about missing gen/tracegz...
files, now we get this:

    I15:55:48.527742Z Syncing harry_potter_hogwarts_mystery trace (1/1)
    Error: missing library: libangle_restricted_traces_harry_potter_hogwarts_mystery.so
    Is angle_restricted_traces set in gn args?

Also removed swallowing errors in _PushLibToAppDir, crashing seems
better than running with out of date files.

Bug: b/294861737
Change-Id: I5696f35a910f6db2310d90e112a83881af3a8f50
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4781569
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Roman Lavrov
2023-08-15 16:50:03 -04:00
parent 78f95b1e6a
commit d85b29053d

View File

@@ -14,6 +14,7 @@ import posixpath
import random
import re
import subprocess
import sys
import tarfile
import tempfile
import threading
@@ -333,6 +334,11 @@ def PrepareRestrictedTraces(traces):
def _PushLibToAppDir(lib_name):
local_path = lib_name
if not os.path.exists(local_path):
print('Error: missing library: ' + local_path)
print('Is angle_restricted_traces set in gn args?') # b/294861737
sys.exit(1)
device_path = '/data/user/0/com.android.angle.test/angle_traces/' + lib_name
if _HashesMatch(local_path, device_path):
return
@@ -343,8 +349,6 @@ def PrepareRestrictedTraces(traces):
_AdbRun(['push', local_path, tmp_path])
_AdbShell('run-as ' + TEST_PACKAGE_NAME + ' cp ' + tmp_path + ' ./angle_traces/')
_AdbShell('rm ' + tmp_path)
except Exception as e:
logging.error('An error occurred in _PushToAppDir: %s' % e)
finally:
_RemoveDeviceFile(tmp_path)
@@ -359,13 +363,13 @@ def PrepareRestrictedTraces(traces):
path_from_root = 'src/tests/restricted_traces/' + trace + '/' + trace + '.angledata.gz'
_Push('../../' + path_from_root, path_from_root)
tracegz = 'gen/tracegz_' + trace + '.gz'
_Push(tracegz, tracegz)
if _Global.traces_outside_of_apk:
lib_name = 'libangle_restricted_traces_' + trace + _Global.lib_extension
_PushLibToAppDir(lib_name)
tracegz = 'gen/tracegz_' + trace + '.gz'
_Push(tracegz, tracegz)
# Push one additional file when running outside the APK
if _Global.traces_outside_of_apk:
_PushLibToAppDir('libangle_trace_interpreter' + _Global.lib_extension)