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

a test in rust fails only when using tarpaulin #1488

Closed
tessus opened this issue Mar 8, 2024 · 2 comments
Closed

a test in rust fails only when using tarpaulin #1488

tessus opened this issue Mar 8, 2024 · 2 comments
Assignees

Comments

@tessus
Copy link

tessus commented Mar 8, 2024

Describe the bug

One of the tests in a rust test suite fails, when tarpaulin is used.

Here's the output for the action: https://github.com/orhun/rustypaste/actions/runs/8196615717/job/22417207146?pr=246#step:5:1

When I run cargo test -- --test-threads 1 locally or remove tarpaulin from the action, all tests pass.

To Reproduce

I don't know how to reproduce this with your own code. I don't know why tarpaulin makes the test fail in the first place.
In the rustypaste project the workflow just has to be triggered and the error happens.

Expected behavior
The test should not fail.

@xd009642
Copy link
Owner

xd009642 commented Apr 27, 2024

So I've finally got round to looking at this and I can confirm some tests do fail with the ptrace engine with default args, but using --engine llvm which uses the same backend as cargo-llvm-cov everything passes as expected.

Given ptrace works by intercepting OS signals and rewriting the code to add breakpoints there can be some weird side effects with certain programs especially if signals are used or processes are spawned. I reran the ptrace engine using the flag --follow-exec and all the tests pass with multiple runs so I guess this is down to process spawning somewhere in your code or tests. Using ptrace can be a bit finnicky because you end up needing certain flags sometimes to mitigate certain side effects (and those flags cause different side effects that aren't always desirable)

Sorry I didn't respond earlier had a lot on my plate (and am the sole maintainer 😅 ).

To summarise either run one of these two commands:

cargo tarpaulin --engine llvm
cargo tarpaulin --follow-exec

@tessus
Copy link
Author

tessus commented Apr 27, 2024

Thanks a lot for your reply. I'll let orhun know about this. We can try using the options you've suggested.

Have a great weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants