Commit 97efa22
authored
Excute E2E tests in parallel (#7456)
## Description
This PR implements parallel execution of E2E tests by using the approach
similar to one introduced by @JoshuaBatty for running LSP garbage
collection tests in parallel. The approach is based on:
- `test` binary getting an additional `--exact` option used by the
parallel runner to run exactly one test passed as an argument to
`--exact`. The argument is the full path to the test's `toml` file.
- parallel runner that uses `rayon` and `std::process::Command` to span
`test --exact <test toml path>` processes in parallel. The original
command line argument passed to `test` get forwarded to `test --exact`
only if they are applicable while running tests in parallel.
On my laptop with 20 cores, **the execution time of the complete E2E
test suite reduces from reproducible 10:48 minutes to reproducible 1:47
minutes**.
Parallel execution is set to be the default one. Sequential execution
can still be used via `--sequential` or `-s` flag: `cargo run -- -s` or
`test -s`.
Similar to parallel garbage collection tests, the parallel execution of
E2E tests shows `stderr` output of the executed tests, but not the
`stdout`. Being non-deterministic, the position of displayed errors will
not come immediately after or before the failing test display, but will
always be easy to relate to a concrete failing test. In practice, this
will be perfectly enough for troubleshooting failing tests. If all the
output is needed during troubleshooting, failing tests can always be
executed sequentially, by using the `--sequential` or `-s` flag.
Additionally the PR:
- adds `no_output` flag to `BuildOpts` to instructs `forc-pkg` not to
output build artifacts like bytecode, ABI JSON, or storage slots JSON.
This improves test execution speed in general because it skips writing
to disc artifacts that are anyhow not used in tests. Also, it simplifies
parallelization, because in case of tests with several
`test.<feature>.toml` files, we don't need to worry about racing
conditions when writing output files. If needed for troubleshooting,
output can still be optionally generated in tests by passing the newly
added `--write-output` CLI flag to the `test` binary. This flag is
ignored when running tests in parallel. A support for the `no_output`
option is not added neither to `forc` CLI, nor to CLI of any other tools
like, e.g., `forc deploy`. If it proves useful to those tools, we can
always easily add it to their CLIs.
- fixes #7449 by annotating the `test` binary `main` function with
`#[tokio::main(flavor = "current_thread")]`.
- renames `exclude_std` CLI option to `no_std_only` to follow the
`_only` pattern in naming filters in `FilterConfig` that filter out only
the tests with a certain property.
Implementing parallel execution for snapshot and IR tests (if required)
will be done in followup PRs.
## Checklist
- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.1 parent a5654fc commit 97efa22
File tree
17 files changed
+523
-184
lines changed- forc-pkg/src
- forc-plugins/forc-client/src/op
- run
- forc-test/src
- forc/src
- cli/commands
- ops
- sway-core/src
- sway-features/src
- test
- src
- e2e_vm_tests
17 files changed
+523
-184
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| |||
2210 | 2212 | | |
2211 | 2213 | | |
2212 | 2214 | | |
| 2215 | + | |
2213 | 2216 | | |
2214 | 2217 | | |
2215 | 2218 | | |
| |||
2301 | 2304 | | |
2302 | 2305 | | |
2303 | 2306 | | |
2304 | | - | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
2305 | 2311 | | |
2306 | 2312 | | |
2307 | 2313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
| 870 | + | |
870 | 871 | | |
871 | 872 | | |
872 | 873 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
| |||
468 | 470 | | |
469 | 471 | | |
470 | 472 | | |
| 473 | + | |
471 | 474 | | |
472 | 475 | | |
473 | 476 | | |
| |||
494 | 497 | | |
495 | 498 | | |
496 | 499 | | |
| 500 | + | |
497 | 501 | | |
498 | 502 | | |
499 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
0 commit comments