Skip to content

Commit 12e784c

Browse files
committed
Replace sftp_server with rsync
remote-run uses rsync instead of sftp server. Some of the tests were incorrectly labelled as requiring sftp server. Fixed those and replaced the requirement with rsync.
1 parent 80863f0 commit 12e784c

14 files changed

+30
-20
lines changed

test/lit.cfg

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,19 +2522,16 @@ check_runtime_libs(runtime_libs)
25222522

25232523
config.substitutions.append(('%target-objc-interop', run_objc_interop))
25242524

2525-
# For testing the remote-run utility itself, see if we can find an sftp-server
2526-
# binary.
2527-
def find_sftp_server():
2528-
paths_to_try = ['/usr/libexec/sftp-server', '/usr/lib/sftp-server',
2529-
'/usr/libexec/openssh/sftp-server',
2530-
'/usr/lib/openssh/sftp-server']
2531-
return next((path for path in paths_to_try if os.path.isfile(path)), None)
2532-
2533-
sftp_server_path = find_sftp_server()
2534-
if sftp_server_path:
2535-
config.available_features.add('sftp_server')
2536-
config.substitutions.append(('%sftp-server',
2537-
sftp_server_path or 'no-sftp-server'))
2525+
2526+
def find_rsync():
2527+
for path in os.getenv("PATH").split(":"):
2528+
rsync_path = os.path.join(path, "rsync")
2529+
if os.path.isfile(rsync_path):
2530+
return rsync_path
2531+
2532+
2533+
if find_rsync():
2534+
config.available_features.add("rsync")
25382535

25392536
subst_target_repl_run_simple_swift = ""
25402537
if 'swift_repl' in config.available_features:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
REQUIRES: rsync
2+
13
RUN: %remote-run -n --remote-dir /xyz-REMOTE -o FIRST_OPT -o SECOND_OPT --output-prefix %/t some_user@some_host:12345 cp %/t/nested/input %/t/nested/output 2>&1 >/dev/null | %FileCheck %s
24

35
CHECK: /usr/bin/ssh -n

test/remote-run/download.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REQUIRES: sftp_server
1+
REQUIRES: rsync
22

33
RUN: %empty-directory(%t)
44
RUN: %empty-directory(%t-REMOTE)
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
REQUIRES: rsync
2+
13
RUN: %remote-run -n --remote-dir /xyz-REMOTE --input-prefix %S/Inputs/ some_user@some_host ls %S/Inputs/upload/1.txt %S/Inputs/upload/2.txt 2>&1 >/dev/null | %FileCheck -check-prefix CHECK-INPUT %s
24

35
CHECK-INPUT: /usr/bin/ssh -n some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/input'
4-
CHECK-INPUT-NEXT: /usr/bin/rsync
6+
CHECK-INPUT-NEXT: rsync
57
CHECK-INPUT-SAME: some_user@some_host
68

79
CHECK-INPUT: /usr/bin/ssh -n some_user@some_host -- '/usr/bin/env' {{.*}}'ls'
@@ -12,11 +14,11 @@ RUN: touch %t/nested/input %t/nested/BAD
1214
RUN: %remote-run -n --remote-dir /xyz-REMOTE --output-prefix %/t some_user@some_host cp %/t/nested/input %/t/nested/output 2>&1 >/dev/null | %FileCheck -check-prefix CHECK-OUTPUT %s
1315

1416
CHECK-OUTPUT: /usr/bin/ssh -n some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output'
15-
CHECK-OUTPUT-NEXT: /usr/bin/rsync
17+
CHECK-OUTPUT-NEXT: rsync
1618
CHECK-OUTPUT-SAME: some_user@some_host
1719

1820
CHECK-OUTPUT: /usr/bin/ssh -n some_user@some_host -- '/usr/bin/env' {{.*}}'cp'
1921
CHECK-OUTPUT-NEXT: {{^}}/bin/mkdir -p {{.+}}
20-
CHECK-OUTPUT-NEXT: /usr/bin/rsync
22+
CHECK-OUTPUT-NEXT: rsync
2123
CHECK-OUTPUT-SAME: some_user@some_host
2224

test/remote-run/dry-run.test-sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
REQUIRES: rsync
12
REQUIRES: shell
23

34
RUN: %empty-directory(%t)

test/remote-run/env.test-sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
REQUIRES: rsync
12
REQUIRES: shell
23

34
RUN: env REMOTE_RUN_CHILD_FOO=foo REMOTE_RUN_CHILD_BAR=bar %debug-remote-run sh -c 'echo ":${FOO}:" ":${BAR}:"' | %FileCheck %s

test/remote-run/exit-code.test-sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
REQUIRES: rsync
12
REQUIRES: shell
23

34
RUN: export SWIFT_BACKTRACE=

test/remote-run/identity.test-sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
REQUIRES: rsync
2+
13
RUN: %remote-run -n --remote-dir /xyz-REMOTE -i spiderman --output-prefix %/t some_user@some_host:12345 cp %/t/nested/input %/t/nested/output 2>&1 >/dev/null | %FileCheck %s
24

35
CHECK: /usr/bin/ssh -n

test/remote-run/port.test-sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
REQUIRES: rsync
2+
13
RUN: %remote-run -n --remote-dir /xyz-REMOTE --output-prefix %/t some_user@some_host:12345 cp %/t/nested/input %/t/nested/output 2>&1 >/dev/null | %FileCheck %s
24

35
CHECK: /usr/bin/ssh -n -p 12345 some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'

test/remote-run/run-only.test-sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
REQUIRES: rsync
12
REQUIRES: shell
23

34
RUN: %debug-remote-run echo hello | %FileCheck %s

test/remote-run/stderr.test-sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
REQUIRES: rsync
12
REQUIRES: shell
23

34
RUN: %debug-remote-run sh -c "echo hello; echo goodbye >&2" > %t.stdout.txt 2> %t.stderr.txt

test/remote-run/upload-and-download.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REQUIRES: sftp_server
1+
REQUIRES: rsync
22

33
RUN: %empty-directory(%t)
44
RUN: %empty-directory(%t-REMOTE)

test/remote-run/upload-stderr.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REQUIRES: sftp_server
1+
REQUIRES: rsync
22

33
RUN: %empty-directory(%t)
44
RUN: %empty-directory(%t/REMOTE/input)

test/remote-run/upload.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REQUIRES: sftp_server
1+
REQUIRES: rsync
22

33
RUN: env REMOTE_RUN_CHILD_FOO=%S/Inputs/upload/3.txt %debug-remote-run --input-prefix %S/Inputs/upload/ ls %S/Inputs/upload/1.txt %S/Inputs/upload/2.txt | %FileCheck -check-prefix CHECK-REMOTE %s
44
RUN: ls %t-REMOTE/input/ | %FileCheck %s

0 commit comments

Comments
 (0)