Skip to content

Commit 9ff695f

Browse files
authored
Merge pull request #19130 from jrose-apple/run-remote-run
[test] Yet more tweaks to remote-run
2 parents fee237e + c52809b commit 9ff695f

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

test/remote-run/custom-options.test-sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ RUN: %utils/remote-run -n --remote-dir /xyz-REMOTE -o FIRST_OPT -o SECOND_OPT --
33
CHECK: /usr/bin/ssh -n
44
CHECK-DAG: -p 12345
55
CHECK-DAG: -o FIRST_OPT -o SECOND_OPT
6+
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/rm' '-rf' '{{.+}}-REMOTE/output'
7+
8+
CHECK-NEXT: /usr/bin/ssh -n
9+
CHECK-DAG: -p 12345
10+
CHECK-DAG: -o FIRST_OPT -o SECOND_OPT
611
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'
712

813
CHECK-NEXT: /usr/bin/sftp

test/remote-run/identity.test-sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ RUN: %utils/remote-run -n --remote-dir /xyz-REMOTE -i spiderman --output-prefix
33
CHECK: /usr/bin/ssh -n
44
CHECK-DAG: -p 12345
55
CHECK-DAG: -i spiderman
6+
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/rm' '-rf' '{{.+}}-REMOTE/output'
7+
8+
CHECK-NEXT: /usr/bin/ssh -n
9+
CHECK-DAG: -p 12345
10+
CHECK-DAG: -i spiderman
611
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'
712

813
CHECK-NEXT: /usr/bin/sftp

utils/remote-run

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CommandRunner(object):
2828

2929
@staticmethod
3030
def _dirnames(files):
31-
return list(set(os.path.dirname(f) for f in files))
31+
return sorted(set(os.path.dirname(f) for f in files))
3232

3333
def popen(self, command, **kwargs):
3434
if self.verbose:
@@ -195,23 +195,32 @@ def main():
195195
runner.dry_run = args.dry_run
196196
runner.verbose = args.verbose or args.dry_run
197197

198+
assert not args.remote_dir == '/'
199+
198200
upload_files = dict()
199201
download_files = dict()
202+
remote_test_specific_dir = None
200203
if args.input_prefix:
204+
assert not args.remote_input_prefix.startswith("..")
201205
remote_dir = os.path.join(args.remote_dir, args.remote_input_prefix)
202206
input_files = find_transfers(args.command, args.input_prefix,
203207
remote_dir)
204208
assert not any(upload_files.has_key(f) for f in input_files)
205209
upload_files.update(input_files)
206210
if args.output_prefix:
211+
assert not args.remote_output_prefix.startswith("..")
207212
remote_dir = os.path.join(args.remote_dir, args.remote_output_prefix)
208213
test_files = find_transfers(args.command, args.output_prefix,
209214
remote_dir)
210215
assert not any(upload_files.has_key(f) for f in test_files)
211216
upload_files.update(test_files)
212217
assert not any(download_files.has_key(f) for f in test_files)
213218
download_files.update(test_files)
219+
remote_test_specific_dir = remote_dir
214220

221+
if remote_test_specific_dir:
222+
assert remote_test_specific_dir.startswith(args.remote_dir)
223+
runner.run_remote(['/bin/rm', '-rf', remote_test_specific_dir])
215224
if upload_files:
216225
runner.send(upload_files)
217226

validation-test/Reflection/lit.local.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
config.substitutions = list(config.substitutions)
33

44
config.substitutions.insert(0, ("%target-run-reflection-test",
5-
# Link %target-swift-reflection-test into %t to convince %target-run to copy
5+
# Copy %target-swift-reflection-test into %t to convince %target-run to copy
66
# it, then use DYLD_LIBRARY_PATH to make sure it can find SwiftRemoteMirrors
77
# from its new location when /not/ run remotely.
8-
("ln %target-swift-reflection-test %t/swift-reflection-test && "
8+
("cp %target-swift-reflection-test %t/swift-reflection-test && "
99
"env %env-DYLD_LIBRARY_PATH=%platform-module-dir/../ %target-run "
1010
" %t/swift-reflection-test")))

0 commit comments

Comments
 (0)