|
| 1 | +# Fuchsia integration tests |
| 2 | + |
| 3 | +[Fuchsia](https://fuchsia.dev) is an open-source operating system with about 2 |
| 4 | +million lines of Rust code.[^loc] It has caught a large number of [regressions] |
| 5 | +in the past and was subsequently included in CI. |
| 6 | + |
| 7 | +## Building Fuchsia in CI |
| 8 | + |
| 9 | +Fuchsia builds as part of the suite of bors tests that run before a pull request |
| 10 | +is merged. |
| 11 | + |
| 12 | +If you are worried that a pull request might break the Fuchsia builder and want to test it out before submitting it to the bors queue, simply add this line to your PR description: |
| 13 | + |
| 14 | +> try-job: x86_64-gnu-integration |
| 15 | +
|
| 16 | +Then when you `@bors try` it will pick the job that builds Fuchsia. |
| 17 | + |
| 18 | +## Building Fuchsia locally |
| 19 | + |
| 20 | +Because Fuchsia uses languages other than Rust, it does not use Cargo as a build |
| 21 | +system. It also requires the toolchain build to be configured in a [certain |
| 22 | +way][build-toolchain]. |
| 23 | + |
| 24 | +The recommended way to build Fuchsia is to use the Docker scripts that check out |
| 25 | +and run a Fuchsia build for you. If you've run Docker tests before, you can |
| 26 | +simply run this command from your Rust checkout to download and build Fuchsia |
| 27 | +using your local Rust toolchain. |
| 28 | + |
| 29 | +``` |
| 30 | +src/ci/docker/run.sh x86_64-gnu-integration |
| 31 | +``` |
| 32 | + |
| 33 | +See the [Testing with Docker](docker.md) chapter for more details on how to run |
| 34 | +and debug jobs with Docker. |
| 35 | + |
| 36 | +Note that a Fuchsia checkout is *large* – as of this writing, a checkout and |
| 37 | +build takes 46G of space – and as you might imagine, it takes awhile to |
| 38 | +complete. |
| 39 | + |
| 40 | +### Customizing the Fuchsia checkout and build |
| 41 | + |
| 42 | +The main reason you would want to build Fuchsia locally is because you need to |
| 43 | +investigate a regression. After running a Docker build, you'll find the Fuchsia |
| 44 | +checkout inside the `obj/fuchsia` directory of your Rust checkout. If you |
| 45 | +modify the `KEEP_CHECKOUT` line in the [build-fuchsia.sh] script to |
| 46 | +`KEEP_CHECKOUT=1`, you can change the checkout as needed and rerun the build |
| 47 | +command above. This will reuse all the build results from before. |
| 48 | + |
| 49 | +You can find more options to customize the Fuchsia checkout in the |
| 50 | +[build-fuchsia.sh] script, and more info about building Fuchsia in the |
| 51 | +[build_fuchsia_from_rust_ci.sh] script it invokes. |
| 52 | + |
| 53 | +## Fuchsia target support |
| 54 | + |
| 55 | +To learn more about Fuchsia target support, see the Fuchsia chapter in [the |
| 56 | +rustc book][platform-support]. |
| 57 | + |
| 58 | +[regressions]: https://gist.github.com/tmandry/7103eba4bd6a6fb0c439b5a90ae355fa |
| 59 | +[build-toolchain]: https://fuchsia.dev/fuchsia-src/development/build/rust_toolchain |
| 60 | +[build-fuchsia.sh]: https://github.com/rust-lang/rust/pull/126105/files?file-filters%5B%5D=.sh&show-viewed-files=true |
| 61 | +[build_fuchsia_from_rust_ci.sh]: https://cs.opensource.google/fuchsia/fuchsia/+/main:scripts/rust/build_fuchsia_from_rust_ci.sh?q=build_fuchsia_from_rust_ci&ss=fuchsia |
| 62 | +[platform-support]: https://doc.rust-lang.org/nightly/rustc/platform-support/fuchsia.html |
| 63 | + |
| 64 | +[^loc]: As of June 2024, Fuchsia had about 2 million lines of first-party Rust code |
| 65 | +and a roughly equal amount of third-party code, as counted by tokei (excluding |
| 66 | +comments and blanks). |
0 commit comments