Skip to content

Commit ec0f54f

Browse files
committed
sembr src/tests/docker.md
1 parent db34304 commit ec0f54f

1 file changed

Lines changed: 37 additions & 23 deletions

File tree

src/tests/docker.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Testing with Docker
22

3-
The [`src/ci/docker`] directory includes [Docker] image definitions for Linux-based jobs executed on GitHub Actions (non-Linux jobs run outside Docker). You can run these jobs on your local development machine, which can be
4-
helpful to test environments different from your local system. You will
5-
need to install Docker on a Linux, Windows, or macOS system (typically Linux
3+
The [`src/ci/docker`] directory includes [Docker] image definitions for Linux-based jobs executed on GitHub Actions (non-Linux jobs run outside Docker).
4+
You can run these jobs on your local development machine, which can be
5+
helpful to test environments different from your local system.
6+
You will need to install Docker on a Linux, Windows, or macOS system (typically Linux
67
will be much faster than Windows or macOS because the latter use virtual
78
machines to emulate a Linux environment).
89

9-
Jobs running in CI are configured through a set of bash scripts, and it is not always trivial to reproduce their behavior locally. If you want to run a CI job locally in the simplest way possible, you can use a provided helper `citool` that tries to replicate what happens on CI as closely as possible:
10+
Jobs running in CI are configured through a set of bash scripts, and it is not always trivial to reproduce their behavior locally.
11+
If you want to run a CI job locally in the simplest way possible, you can use a provided helper `citool` that tries to replicate what happens on CI as closely as possible:
1012

1113
```bash
1214
cargo run --manifest-path src/ci/citool/Cargo.toml run-local <job-name>
@@ -18,39 +20,51 @@ If the above script does not work for you, you would like to have more control o
1820

1921
## The `run.sh` script
2022
The [`src/ci/docker/run.sh`] script is used to build a specific Docker image, run it,
21-
build Rust within the image, and either run tests or prepare a set of archives designed for distribution. The script will mount your local Rust source tree in read-only mode, and an `obj` directory in read-write mode. All the compiler artifacts will be stored in the `obj` directory. The shell will start out in the `obj`directory. From there, it will execute `../src/ci/run.sh` which starts the build as defined by the Docker image.
23+
build Rust within the image, and either run tests or prepare a set of archives designed for distribution.
24+
The script will mount your local Rust source tree in read-only mode, and an `obj` directory in read-write mode.
25+
All the compiler artifacts will be stored in the `obj` directory.
26+
The shell will start out in the `obj`directory.
27+
From there, it will execute `../src/ci/run.sh` which starts the build as defined by the Docker image.
2228

23-
You can run `src/ci/docker/run.sh <image-name>` directly. A few important notes regarding the `run.sh` script:
24-
- When executed on CI, the script expects that all submodules are checked out. If some submodule that is accessed by the job is not available, the build will result in an error. You should thus make sure that you have all required submodules checked out locally. You can either do that manually through git, or set `build.submodules = true` in your `bootstrap.toml` and run a command such as `x build` to let bootstrap download the most important submodules (this might not be enough for the given CI job that you are trying to execute though).
25-
- `<image-name>` corresponds to a single directory located in one of the `src/ci/docker/host-*` directories. Note that image name does not necessarily correspond to a job name, as some jobs execute the same image, but with different environment variables or Docker build arguments (this is a part of the complexity that makes it difficult to run CI jobs locally).
29+
You can run `src/ci/docker/run.sh <image-name>` directly.
30+
A few important notes regarding the `run.sh` script:
31+
- When executed on CI, the script expects that all submodules are checked out.
32+
If some submodule that is accessed by the job is not available, the build will result in an error.
33+
You should thus make sure that you have all required submodules checked out locally.
34+
You can either do that manually through git, or set `build.submodules = true` in your `bootstrap.toml` and run a command such as `x build` to let bootstrap download the most important submodules (this might not be enough for the given CI job that you are trying to execute though).
35+
- `<image-name>` corresponds to a single directory located in one of the `src/ci/docker/host-*` directories.
36+
Note that image name does not necessarily correspond to a job name, as some jobs execute the same image, but with different environment variables or Docker build arguments (this is a part of the complexity that makes it difficult to run CI jobs locally).
2637
- If you are executing a "dist" job (job beginning with `dist-`), you should set the `DEPLOY=1` environment variable.
2738
- If you are executing an "alternative dist" job (job beginning with `dist-` and ending with `-alt`), you should set the `DEPLOY_ALT=1` environment variable.
28-
- Some of the std tests require IPv6 support. Docker on Linux seems to have it
29-
disabled by default. Run the commands in [`enable-docker-ipv6.sh`] to enable
30-
IPv6 before creating the container. This only needs to be done once.
39+
- Some of the std tests require IPv6 support.
40+
Docker on Linux seems to have it disabled by default.
41+
Run the commands in [`enable-docker-ipv6.sh`] to enable IPv6 before creating the container.
42+
This only needs to be done once.
3143

3244
### Interactive mode
3345

34-
Sometimes, it can be useful to build a specific Docker image, and then run custom commands inside it, so that you can experiment with how the given system behaves. You can do that using an interactive mode, which will
46+
Sometimes, it can be useful to build a specific Docker image, and then run custom commands inside it, so that you can experiment with how the given system behaves.
47+
You can do that using an interactive mode, which will
3548
start a bash shell in the container, using `src/ci/docker/run.sh --dev <image-name>`.
3649

37-
When inside the Docker container, you can run individual commands to do specific tasks. For
38-
example, you can run `../x test tests/ui` to just run UI tests.
50+
When inside the Docker container, you can run individual commands to do specific tasks.
51+
For example, you can run `../x test tests/ui` to just run UI tests.
3952

4053
Some additional notes about using the interactive mode:
4154

4255
- The container will be deleted automatically when you exit the shell, however
43-
the build artifacts persist in the `obj` directory. If you are switching
44-
between different Docker images, the artifacts from previous environments
45-
stored in the `obj` directory may confuse the build system. Sometimes you
46-
will need to delete parts or all of the `obj` directory before building
56+
the build artifacts persist in the `obj` directory.
57+
If you are switching between different Docker images, the artifacts from previous environments
58+
stored in the `obj` directory may confuse the build system.
59+
Sometimes you will need to delete parts or all of the `obj` directory before building
4760
inside the container.
48-
- The container is bare-bones, with only a minimal set of packages. You may
49-
want to install some things like `apt install less vim`.
50-
- You can open multiple shells in the container. First you need the container
61+
- The container is bare-bones, with only a minimal set of packages.
62+
You may want to install some things like `apt install less vim`.
63+
- You can open multiple shells in the container.
64+
First you need the container
5165
name (a short hash), which is displayed in the shell prompt, or you can run
52-
`docker container ls` outside of the container to list the available
53-
containers. With the container name, run `docker exec -it <CONTAINER>
66+
`docker container ls` outside of the container to list the available containers.
67+
With the container name, run `docker exec -it <CONTAINER>
5468
/bin/bash` where `<CONTAINER>` is the container name like `4ba195e95cef`.
5569

5670
[Docker]: https://www.docker.com/

0 commit comments

Comments
 (0)