Skip to content

Re-apply "[test] Yet more tweaks to remote-run" #19150

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 1 commit into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions test/remote-run/custom-options.test-sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ RUN: %utils/remote-run -n --remote-dir /xyz-REMOTE -o FIRST_OPT -o SECOND_OPT --
CHECK: /usr/bin/ssh -n
CHECK-DAG: -p 12345
CHECK-DAG: -o FIRST_OPT -o SECOND_OPT
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/rm' '-rf' '{{.+}}-REMOTE/output'

CHECK-NEXT: /usr/bin/ssh -n
CHECK-DAG: -p 12345
CHECK-DAG: -o FIRST_OPT -o SECOND_OPT
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'

CHECK-NEXT: /usr/bin/sftp
Expand Down
5 changes: 5 additions & 0 deletions test/remote-run/identity.test-sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ RUN: %utils/remote-run -n --remote-dir /xyz-REMOTE -i spiderman --output-prefix
CHECK: /usr/bin/ssh -n
CHECK-DAG: -p 12345
CHECK-DAG: -i spiderman
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/rm' '-rf' '{{.+}}-REMOTE/output'

CHECK-NEXT: /usr/bin/ssh -n
CHECK-DAG: -p 12345
CHECK-DAG: -i spiderman
CHECK-SAME: some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'

CHECK-NEXT: /usr/bin/sftp
Expand Down
11 changes: 10 additions & 1 deletion utils/remote-run
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CommandRunner(object):

@staticmethod
def _dirnames(files):
return list(set(os.path.dirname(f) for f in files))
return sorted(set(os.path.dirname(f) for f in files))

def popen(self, command, **kwargs):
if self.verbose:
Expand Down Expand Up @@ -195,23 +195,32 @@ def main():
runner.dry_run = args.dry_run
runner.verbose = args.verbose or args.dry_run

assert not args.remote_dir == '/'

upload_files = dict()
download_files = dict()
remote_test_specific_dir = None
if args.input_prefix:
assert not args.remote_input_prefix.startswith("..")
remote_dir = os.path.join(args.remote_dir, args.remote_input_prefix)
input_files = find_transfers(args.command, args.input_prefix,
remote_dir)
assert not any(upload_files.has_key(f) for f in input_files)
upload_files.update(input_files)
if args.output_prefix:
assert not args.remote_output_prefix.startswith("..")
remote_dir = os.path.join(args.remote_dir, args.remote_output_prefix)
test_files = find_transfers(args.command, args.output_prefix,
remote_dir)
assert not any(upload_files.has_key(f) for f in test_files)
upload_files.update(test_files)
assert not any(download_files.has_key(f) for f in test_files)
download_files.update(test_files)
remote_test_specific_dir = remote_dir

if remote_test_specific_dir:
assert remote_test_specific_dir.startswith(args.remote_dir)
runner.run_remote(['/bin/rm', '-rf', remote_test_specific_dir])
if upload_files:
runner.send(upload_files)

Expand Down
4 changes: 2 additions & 2 deletions validation-test/Reflection/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
config.substitutions = list(config.substitutions)

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