Skip to content

[android] adb_test_runner.py pushes file arguments. #19949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion utils/android/adb/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ def execute_on_device(executable_path, executable_arguments):
for (k, v) in os.environ.items()
if k.startswith(ENV_PREFIX)]

# The executables are sometimes passed arguments, and sometimes those
# arguments are files that have to be pushed, but also the argument values
# have to be changed to the new path in the Android device.
translated_executable_arguments = []
for executable_argument in executable_arguments:
# Currently we only support arguments that are file paths themselves.
# Things like `--foo=/path/to/file` or directories are not supported.
# Relative paths from the executable to the arguments are not kept.
if os.path.isfile(executable_argument):
final_path = '{}/{}'.format(uuid_dir,
os.path.basename(executable_argument))
push(executable_argument, final_path)
translated_executable_arguments.append(final_path)
else:
translated_executable_arguments.append(executable_argument)

# When running the executable on the device, we need to pass it the same
# arguments, as well as specify the correct LD_LIBRARY_PATH. Save these
# to a file we can easily call multiple times.
Expand All @@ -111,7 +127,7 @@ def execute_on_device(executable_path, executable_arguments):
tmp_dir=DEVICE_TEMP_DIR,
child_environment=' '.join(child_environment),
executable=executable,
executable_arguments=' '.join(executable_arguments)))
executable_arguments=' '.join(translated_executable_arguments)))

# Write the output from the test executable to a file named '__stdout', and
# if the test executable succeeds, write 'SUCCEEDED' to a file
Expand Down