Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more test to be tested with miri in CI #6885

Merged
merged 15 commits into from
Oct 11, 2024
Merged

Conversation

tiif
Copy link
Contributor

@tiif tiif commented Oct 7, 2024

Motivation

Open up more test to be tested in Miri as mentioned in #6812

Solution

@tiif
Copy link
Contributor Author

tiif commented Oct 7, 2024

Currently all tests passed except for https://github.com/tokio-rs/tokio/actions/runs/11220730350/job/31189595252?pr=6885, seems like a toolchain installation problem?

@tiif tiif changed the title Add miri to CI Add more test to be tested with miri to CI Oct 7, 2024
@tiif tiif changed the title Add more test to be tested with miri to CI Add more test to be tested with miri in CI Oct 7, 2024
@Darksonn
Copy link
Contributor

Darksonn commented Oct 7, 2024

I'll try rerunning that particular check.

@Darksonn Darksonn added the A-ci Area: The continuous integration setup label Oct 7, 2024
@tiif
Copy link
Contributor Author

tiif commented Oct 8, 2024

Yup cargo miri test --features full --lib --tests works. So I added it in ci.yml in the latest commit.

working-directory: tokio
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields -Zmiri-tree-borrows
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added tree-borrows check because I ran the test suite with it, if this is not desired I can remove them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine. We may want to consider whether it makes sense to run with both?

Copy link
Contributor Author

@tiif tiif Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both means tree borrows and stacked borrows, I think -Zmiri-tree-borrows will replace stacked borrows with tree borrows rule. On second thought, since tree borrows seems to be more experimental, let me remove this and keep it to stacked borrow.

@tiif
Copy link
Contributor Author

tiif commented Oct 8, 2024

The CI logs said error: unsupported operation: returning ready events from epoll_wait is not yet implemented. This unsupported error has already been removed, is the CI using older version of miri?

EDIT: Yup I saw rustup toolchain install nightly-2024-05-05 --component miri --profile minimal --no-self-update. Is it possible to update it to at least 2024-09-19?

rustc 1.83.0-nightly (506f22b46 2024-09-19)
binary: rustc
commit-hash: 506f22b4663f3e756e1e6a4f66c6309fdc00819c
commit-date: 2024-09-19
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

@Darksonn
Copy link
Contributor

Darksonn commented Oct 8, 2024

Sure, feel free to change the miri version.

Comment on lines 424 to 426
rustup toolchain install nightly-2024-09-19 --component miri --profile minimal --no-self-update
rustup override set nightly
cargo miri test --features full --lib --tests --no-fail-fast
Copy link
Contributor Author

@tiif tiif Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to keep the change minimal, so I don't really want to change env.rust_nightly, but I am not sure if this will work.

EDIT: This won't work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to get them back in sync as a follow-up PR, then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean rust_miri_nightly and rust_nightly?

@tiif
Copy link
Contributor Author

tiif commented Oct 10, 2024

As expected, with the amount of new tests tested with miri, it slows down the CI significantly. It goes from 1 minute to 37 minutes.

@tiif tiif marked this pull request as ready for review October 10, 2024 03:43
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overal looks good. It would be nice to know why tests are disabled - I see you commented the reason on only a few of them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This both disables miri for the entire file and for specific tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks for catching this.

Comment on lines +3 to +4
// Blocked on https://github.com/rust-lang/miri/issues/3911
#![cfg(not(miri))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I don't think the latest fix is synced to rustc yet.

working-directory: tokio
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this line seems like a spurious change.

@tiif
Copy link
Contributor Author

tiif commented Oct 10, 2024

Overal looks good. It would be nice to know why tests are disabled - I see you commented the reason on only a few of them.

I checked the error messages, most of them are either too slow, or having unsupported error. I also filed issues for other errors. If you don't mind, I can annotate them in future PRs. I planned to collect and count all the unsupported error, so I can do this together too.

Besides, I am thinking of bumping the miri nightly version again in future to include all the fixes. So it might be better to keep rust_miri_nightly and rust_nightly separated as there will be more frequent version bump needed for miri?

Comment on lines +423 to +426
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
Copy link
Contributor Author

@tiif tiif Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nextest decreased miri running time roughly from 37 minutes to 21 minutes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nice. The loom jobs are already much longer than that. We could consider gating it similarly to what we did for loom tests.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable. We can merge it as-is if you think it is ready. We can always continue to improve it in follow-up PRs, e.g. for bumping miri versions and such.

@tiif
Copy link
Contributor Author

tiif commented Oct 11, 2024

Yup, this PR is ready. I added the tasks that should be done in future PR in #6812, so we might want to keep the issue open until they are resolved. Thanks for the review and mentoring!

@Darksonn Darksonn merged commit 161b8c8 into tokio-rs:master Oct 11, 2024
81 checks passed
@tiif tiif deleted the ignoremiri branch October 11, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ci Area: The continuous integration setup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants