testing: Use nextest for unit-tests#39812
Conversation
mukilan
left a comment
There was a problem hiding this comment.
Do you mind adding cargo-nextest to shell.nix as well, like we have for cargo-deny? I've tested on my Mac where I use nix and it seems to work with the version we get from nixpkgs which is 0.9.105.
| pass # there is no argument for debug | ||
| else: | ||
| args += ["--profile", build_type.profile] | ||
| args += ["--cargo-profile", build_type.profile] |
There was a problem hiding this comment.
What is rationale for this change?
There was a problem hiding this comment.
The --profile parameter for nextest is unfortunately not the same as a the --profile parameter for cargo. The nextest profile is for essentially choosing a test profile / configuration (e.g. CI). So when switching from cargo test to cargo nextest one needs to use --cargo-profile instead of --profile
There was a problem hiding this comment.
I updated the PR description to mention these changes, since the commits will be squashed and the original commit messages lost.
Nextest is a powerful test runner, with many advantages of cargo test. Among others it will run each test in a separate process, provide a summary of the completed test execution, supports output formats like JUnit, and can handle flaky test by retrying. Signed-off-by: Jonathan Schwender <[email protected]>
nextest takes the argument directly, not the test harness (difference to cargo test). We also don't want to fail fast and run all tests. Signed-off-by: Jonathan Schwender <[email protected]>
The --profile option in nextest is not the cargo profile, but refers to nextest configuration profiles. Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
3a82adb to
a14268c
Compare
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Follow-up to #39812, using nextests builtin retry feature to rerun flaky unit-tests. This also adds a per-test timeout, replacing the global timeout set for the retry action. We could also add a global timeout for nextest tests, but per-test timeouts should be sufficient and noticably speedup CI when individual unit tests get stuck. Testing: [mach try](https://github.com/servo/servo/actions/runs/18519094535) running the unit-tests with retries in CI. --------- Signed-off-by: Jonathan Schwender <[email protected]>
The changes in servo#39812 seem to have completely disabled the API tests, so this PR gets them running again by removing the custom test harness (apart from the multiprocess test). The custom test harness is typically not necessary now that all tests are run in their own process. In addition, the behavior of the `WebView::page_zoom()` is fixed when set via the `viewport` meta tag. This functionality was broken, but the unit test wasn't catching it. There is still one failing test, but that is tracked via servo#40129. Signed-off-by: Martin Robinson <[email protected]>
The changes in servo#39812 seem to have completely disabled the API tests, so this PR gets them running again by removing the custom test harness (apart from the multiprocess test). The custom test harness is typically not necessary now that all tests are run in their own process. In addition, the behavior of the `WebView::page_zoom()` is fixed when set via the `viewport` meta tag. This functionality was broken, but the unit test wasn't catching it. There is still one failing test, but that is tracked via servo#40129. Signed-off-by: Martin Robinson <[email protected]>
The changes in servo#39812 seem to have completely disabled the API tests, so this PR gets them running again by removing the custom test harness (apart from the multiprocess test). The custom test harness is typically not necessary now that all tests are run in their own process. In addition, the behavior of the `WebView::page_zoom()` is fixed when set via the `viewport` meta tag. This functionality was broken, but the unit test wasn't catching it. There is still one failing test, but that is tracked via servo#40129. Signed-off-by: Martin Robinson <[email protected]>
) The changes in #39812 seem to have completely disabled the API tests, so this PR gets them running again by removing the custom test harness (apart from the multiprocess test). The custom test harness is typically not necessary now that all tests are run in their own process. In addition, the behavior of the `WebView::page_zoom()` is fixed when set via the `viewport` meta tag. This functionality was broken, but the unit test wasn't catching it. There is still one failing test, but that is tracked via #40129. Testing: This change fixes the tests. Signed-off-by: Martin Robinson <[email protected]>
Nextest is a powerful test runner, with many advantages over cargo test. Among others it will run each test in a separate process, provide a summary of the completed test execution, supports output formats like JUnit, and can handle flaky test by retrying. This PR does not use most of these advanced features yet though, that will be left to future PRs.
The change also uncovered racy tests in
netwhich rely on someone initializing theASYNC_RUNTIMEbefore the test in questions is run. By explicitly accessing the lazy static in a common setup routine, we make sure it is initialized.CLI differences of
cargo testvscargo nextest:--profileoption in nextest is not the cargo profile, but refers to nextest configuration profiles.--nocaptureis a direct argument to nextest, not to the testharness, so we can remove the preceding--seperator.Testing: Tested by running unit-tests in CI
Fixes: #39797