Commit Graph

29 Commits

Author SHA1 Message Date
Justice Adams
444fcbc528 Update remote-run (#64880)
replace encoding errors when using utf-8
2023-04-04 12:01:50 -07:00
Alastair Houghton
fdb010433d [Remote Test] Fix remote-run to process environment variables.
`remote-run` should look in the environment for input/output paths as
well as considering command line arguments.

With this change, `test/Runtime/Paths.cpp` should work for remote testing
and device testing.

rdar://106294557
2023-03-07 16:01:10 +00:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Alastair Houghton
2f6f051f75 Use rsync for remote-run.
Not only does this give us a huge speed-up, it also works around a problem
where sftp doesn't always update the modification time, which causes random
test failures.

rdar://88179140
2022-02-01 19:21:23 +00:00
Saleem Abdulrasool
2b8d57c2e3 test: sort the environment for remote-run
With Python 3, there have been some sorting inconsistencies.  Always
sort the items to allow for the lit test to reliably match the output.
2020-07-28 15:30:55 -07:00
Saleem Abdulrasool
061d6514dc test: make remote-run Python 3 friendly
Without this the remote-run tests fail due to expecting a "bytes-like"
object rather than str.
2020-07-09 20:03:42 +00:00
Saleem Abdulrasool
24003e639a utils: update remote-run for Python 3 compatibility
Make `remote-run` be compatible with python 2 and python 3.  The changes
are:
- replace `viewitems` with `items`
- replace `viewvalues` with `values`
- replace `viewkeys` with `keys`
- replace `haskey` with `in`
2020-06-23 08:22:39 -07:00
Mike Ash
d8a7c5a997 [Tests] Pass -r to sftp in remote-run.
rdar://problem/50503952
2019-05-22 16:07:58 -04:00
Mishal Shah
4774b54fad Add support for SSH config file option in remote-run 2019-04-23 23:26:15 -07:00
Saleem Abdulrasool
043912fd93 remote-run: make tests partially pass on Windows
Not all the tests are possible to run on Windows since they expect a
Unix-like shell environment.  However, the rest of the tests can be
accommodated.  This actually found an issue in the implementation.
Since the implementation assumes the target is POSIX/Unix-y, we should
use posixpath rather than os.path which uses the host's path style.
2018-12-02 20:58:19 -08:00
Jordan Rose
7ec1db9aa3 Re-apply "[test] Yet more tweaks to remote-run" (#19150) 2018-09-05 19:24:51 -07:00
Jordan Rose
1377722f86 Revert "[test] Yet more tweaks to remote-run" 2018-09-05 10:29:01 -07:00
Jordan Rose
bcb10b505c [remote-run] Clear out %t on the remote machine
Really we ought to clear out "%t*", but running wildcards with 'rm'
scares me a little too much for that. This still fixes a handful of
tests that were relying on %t being an empty directory.

Note that this doesn't interfere with generated files persisting
between %target-run invocations; they'll be downloaded and then
re-uploaded as long as they're mentioned in the invocation.
2018-09-04 18:25:24 -07:00
Jordan Rose
810b240354 [remote-run] Add support for custom ssh_config options with -o (#18814)
This has precedent in 'sftp', which also forwards anything passed with
-o through to ssh.
2018-08-20 08:40:13 -07:00
Jordan Rose
1f9ef88ec1 [test] Check for sftp-server for remote-run --debug-as-local tests (#18759)
Not all systems have sftp-server installed.
2018-08-16 13:05:40 -07:00
Jordan Rose
feb8cb8538 [remote-run] Look for sftp-server in both /usr/libexec/ and /usr/lib/
This only matters for --debug-as-local mode anyway, but it looks like
Ubuntu OpenSSH doesn't use 'libexec'. (Maybe it's a Linux vs. BSD
thing.)
2018-08-08 20:20:07 -07:00
Jordan Rose
dd8c85ef81 [remote-run] Add help text to the options
(and reorder them so that the help text looks better)
2018-08-08 17:44:28 -07:00
Jordan Rose
15920eaa7b [remote-run] Reformat for 80 cols, use main() function for scoping
No functionality change.
2018-08-08 17:44:28 -07:00
Jordan Rose
b69f003489 [remote-run] Add -i/--identity to provide an SSH private key 2018-08-08 17:44:28 -07:00
Jordan Rose
b6bb375d5a [remote-run] Allow specifying the SSH port using 'host:port' syntax
ssh itself doesn't support this for its primary hostname, but it's
pretty standard elsewhere.
2018-08-08 17:44:28 -07:00
Jordan Rose
0aed9e05cc [remote-run] Add a -n/--dry-run mode that /just/ dumps commands
Like -v, but doesn't actually run anything.
2018-08-08 17:44:28 -07:00
Jordan Rose
a64ac39af0 [remote-run] Add -v/--verbose to dump shell and SFTP commands 2018-08-08 17:44:28 -07:00
Jordan Rose
d625e08479 [remote-run] Allow custom input/output prefixes on the remote side
This is mostly important to allow remote-run to be used to upload
files generally, while still using the same interface and arguments
that will be used to actually run executables.
2018-08-08 17:44:28 -07:00
Jordan Rose
1a0912c9b7 [remote-run] Pass stdout through directly too
This makes sure it's still printed when the remote process exits
abnormally.
2018-08-08 17:44:28 -07:00
Jordan Rose
9947e6f1c6 [remote-run] Pass through stderr for sftp failures
(mostly for human debugging)
2018-08-08 17:44:28 -07:00
Jordan Rose
a10be46488 [remote-run] --source-dir/test-dir to --input-prefix/output-prefix
This handles things like "%t.dylib" that some tests use.
2018-08-08 17:42:55 -07:00
Jordan Rose
10259e181f [remote-run] Send environment variables to the remote process
Taking a cue from Apple's 'simctl' tool, send over any variables
prefixed with REMOTE_RUN_CHILD_ (after stripping the prefix).
2018-08-08 17:42:55 -07:00
Jordan Rose
e147a4fc1b [remote-run] Pass stderr output through directly
Also, handle early exit codes
2018-08-08 17:42:55 -07:00
Jordan Rose
74da057e13 [test] Start work on 'remote-run', to run executable tests over SSH
(instead of locally)

The primary use case I'm looking at is easier testing across macOS
versions, but it could also be used for cross-compilation tests in
general (someday).
2018-08-08 17:42:55 -07:00