@@ -147,10 +147,81 @@ the Docker image, run it, build Rust within the image, and run the tests.
147147[ src/ci/docker ] : https://github.com/rust-lang/rust/tree/master/src/ci/docker
148148[ src/ci/docker/run.sh ] : https://github.com/rust-lang/rust/blob/master/src/ci/docker/run.sh
149149
150+ ## Running tests on a remote machine
151+
152+ Tests may be run on a remote machine (e.g. to test builds for a different
153+ architecture). This is done using ` remote-test-client ` on the build machine
154+ to send test programs to ` remote-test-server ` running on the remote machine.
155+ ` remote-test-server ` executes the test programs and sends the results back to
156+ the build machine. ` remote-test-server ` provides * unauthenticated remote code
157+ execution* so be careful where it is used.
158+
159+ To do this, first build ` remote-test-server ` for the remote
160+ machine, e.g. for RISC-V
161+ ``` sh
162+ ./x.py build src/tools/remote-test-server --target riscv64gc-unknown-linux-gnu
163+ ```
164+
165+ The binary will be created at
166+ ` ./build/$HOST_ARCH/stage2-tools/$TARGET_ARCH/release/remote-test-server ` . Copy
167+ this over to the remote machine.
168+
169+ On the remote machine, run the ` remote-test-server ` with the ` remote ` argument
170+ (and optionally ` -v ` for verbose output). Output should look like this:
171+ ``` sh
172+ $ ./remote-test-server -v remote
173+ starting test server
174+ listening on 0.0.0.0:12345!
175+ ```
176+
177+ You can test if the ` remote-test-server ` is working by connecting to it and
178+ sending ` ping\n ` . It should reply ` pong ` :
179+ ``` sh
180+ $ nc $REMOTE_IP 12345
181+ ping
182+ pong
183+ ```
184+
185+ To run tests using the remote runner, set the ` TEST_DEVICE_ADDR ` environment
186+ variable then use ` x.py ` as usual. For example, to run ` ui ` tests for a RISC-V
187+ machine with the IP address ` 1.2.3.4 ` use
188+ ``` sh
189+ export TEST_DEVICE_ADDR=" 1.2.3.4:12345"
190+ ./x.py test src/test/ui --target riscv64gc-unknown-linux-gnu
191+ ```
192+
193+ If ` remote-test-server ` was run with the verbose flag, output on the test machine
194+ may look something like
195+ ```
196+ [...]
197+ run "/tmp/work/test1007/a"
198+ run "/tmp/work/test1008/a"
199+ run "/tmp/work/test1009/a"
200+ run "/tmp/work/test1010/a"
201+ run "/tmp/work/test1011/a"
202+ run "/tmp/work/test1012/a"
203+ run "/tmp/work/test1013/a"
204+ run "/tmp/work/test1014/a"
205+ run "/tmp/work/test1015/a"
206+ run "/tmp/work/test1016/a"
207+ run "/tmp/work/test1017/a"
208+ run "/tmp/work/test1018/a"
209+ [...]
210+ ```
211+
212+ Tests are built on the machine running ` x.py ` not on the remote machine. Tests
213+ which fail to build unexpectedly (or ` ui ` tests producing incorrect build
214+ output) may fail without ever running on the remote machine.
215+
150216## Testing on emulators
151217
152218Some platforms are tested via an emulator for architectures that aren't
153- readily available. There is a set of tools for orchestrating running the
219+ readily available. For architectures where the standard library is well
220+ supported and the host operating system supports TCP/IP networking, see the
221+ above instructions for testing on a remote machine (in this case the
222+ remote machine is emulated).
223+
224+ There is also a set of tools for orchestrating running the
154225tests within the emulator. Platforms such as ` arm-android ` and
155226` arm-unknown-linux-gnueabihf ` are set up to automatically run the tests under
156227emulation on Travis. The following will take a look at how a target's tests
@@ -165,15 +236,8 @@ reading the results. The Docker image is set up to launch
165236communicate with the server to coordinate running tests (see
166237[ src/bootstrap/test.rs] ).
167238
168- > TODO: What are the steps for manually running tests within an emulator?
169- > ` ./src/ci/docker/run.sh armhf-gnu ` will do everything, but takes hours to
170- > run and doesn't offer much help with interacting within the emulator.
171- >
172- > Is there any support for emulating other (non-Android) platforms, such as
173- > running on an iOS emulator?
174- >
175- > Is there anything else interesting that can be said here about running tests
176- > remotely on real hardware?
239+ > TODO:
240+ > Is there any support for using an iOS emulator?
177241>
178242> It's also unclear to me how the wasm or asm.js tests are run.
179243
0 commit comments