Skip to content

Commit 8c48e39

Browse files
authored
[test] Add --param remote_run_extra_args (swiftlang#18885)
This goes with 810b240: if we want to pass extra arguments to SSH when using remote-run, there has to be a way to get them to remote-run when using lit.
1 parent 643154f commit 8c48e39

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docs/Testing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ out with ``lit.py -h``. We document some of the more useful ones below:
126126
* ``--param remote_run_identity=<FILE>`` provides an SSH private key to be used
127127
when testing with `remote_run_host`. (`remote-run` does not support
128128
passwords.)
129+
* ``--param remote_run_extra_args="ARG1 ARG2 ..."`` provides a list of extra
130+
arguments to pass to `remote-run`. (This can be used with `remote-run`'s `-o`
131+
option to pass extra options to SSH.)
129132
* ``--param remote_run_skip_upload_stdlib`` assumes that the standard library
130133
binaries have already been uploaded to `remote_run_tmpdir` and are up to date.
131134
This is meant for repeat runs and probably shouldn't be used in automation.

test/lit.cfg

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import platform
2323
import re
24+
import shlex
2425
import shutil
2526
import subprocess
2627
import sys
@@ -950,10 +951,12 @@ if (not getattr(config, 'target_run', None) and
950951
remote_run_host = lit_config.params['remote_run_host']
951952
remote_tmp_dir = lit_config.params['remote_run_tmpdir']
952953
remote_lib_dir = os.path.join(remote_tmp_dir, 'stdlib')
954+
955+
remote_run_extra_args_param = lit_config.params.get('remote_run_extra_args')
956+
remote_run_extra_args = shlex.split(remote_run_extra_args_param or '')
953957
if 'remote_run_identity' in lit_config.params:
954-
identity_args = ['-i', lit_config.params['remote_run_identity']]
955-
else:
956-
identity_args = []
958+
remote_run_identity = lit_config.params['remote_run_identity']
959+
remote_run_extra_args += ['-i', remote_run_identity]
957960

958961
if 'remote_run_skip_upload_stdlib' not in lit_config.params:
959962
lit_config.note(
@@ -969,19 +972,19 @@ if (not getattr(config, 'target_run', None) and
969972
'--remote-dir', remote_tmp_dir,
970973
'--input-prefix', sdk_lib_dir,
971974
'--remote-input-prefix', 'stdlib/'
972-
] + identity_args + [
975+
] + remote_run_extra_args + [
973976
remote_run_host,
974977
'--',
975978
'true' # A dummy command that ignores its arguments.
976979
] + libs)
977980

978981
config.target_run = (
979982
"/usr/bin/env "
980-
"REMOTE_RUN_CHILD_DYLD_FALLBACK_LIBRARY_PATH='{0}' " # Apple option
983+
"REMOTE_RUN_CHILD_DYLD_LIBRARY_PATH='{0}' " # Apple option
981984
"REMOTE_RUN_CHILD_LD_LIBRARY_PATH='{0}' " # Linux option
982985
"%utils/remote-run --input-prefix %S --output-prefix %t "
983986
"--remote-dir '{1}'%t {2} {3}".format(remote_lib_dir, remote_tmp_dir,
984-
' '.join(identity_args),
987+
' '.join(remote_run_extra_args),
985988
remote_run_host))
986989
TARGET_ENV_PREFIX = 'REMOTE_RUN_CHILD_'
987990

0 commit comments

Comments
 (0)