From d85b29053d633a51bb1c5b2941fad1e654a93ca2 Mon Sep 17 00:00:00 2001 From: Roman Lavrov Date: Tue, 15 Aug 2023 16:50:03 -0400 Subject: [PATCH] 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 Reviewed-by: Cody Northrop --- src/tests/py_utils/android_helper.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tests/py_utils/android_helper.py b/src/tests/py_utils/android_helper.py index 7f755c09e..bacc29b50 100644 --- a/src/tests/py_utils/android_helper.py +++ b/src/tests/py_utils/android_helper.py @@ -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)