-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
bug: tests fail when running cargo tarpaulin with recent nightly toolchain #885
Comments
This isn't something I'm aware of so looking into it a bit now to see if anything jumps out (otherwise it may be a longer investigation), but I can recreate it. Initially got a list of things that failed first run with the newer toolchain
|
Hi, I just wanted to dig little bit deeper to understand where the issue is. And this happened: I renamed the And the test passed! I revert back the name to in fact , when i rename all failing tests to bug_test1,bug_test2,bug_test3 etc - they all pass ( at least in pallet-xyk crate under pallets/xyk directory) . Can this give you any hint ? |
update: i was just curious, so i renamed all failing tests - and they all pass. However few other tests starts failing after that change which were ok initially. At this point i wont dig deeper. I guess it wont have anything to do with the code itself. Hope this information will give you an idea. Let me know if you need anything else, I am happy to help. |
If you have time, if you could try #894 and let me know if it works. My laptop is quite weak so running the basilisk tests does take quite a lot of time 😅. Otherwise this fixes another issue that looks similar so I'll likely do a release next week with this PR included |
Sure. I will have a look and try it out later today. I'lllet you know. |
Using the branch Now the tests actually segfault.
to reproduce - you can actually run the tests for selected package only, so it does not take so long, eg:
This executes ok on tarpaulin And with the change from remove-sched_affinity branch - it segfaults with each toolchain. |
Interesting, with latest nightly it works for me, maybe remove the If it works with the test-threads arg it suggests there's some global mutable state in your test created via something like thread-local variables that isn't reset between tests. Which you probably want to fix as it means tests are subject to stop working based on the implementation of the test runner (i.e. rustc moving to a thread pool based implementation could cause them to fail) |
Just tried it twice with The segfault is concerning though, I'll try to run the sched change across a variety of projects but if you could run without |
I can confirm that using However, it still segfaults using the I am going to refactor our tests to not use the thread_local as it is not really needed in some cases ( substrate framework uses this approach in their tests so it was used as an inspiration ). |
I've done a PR using --test-threads then instead of removing the affinity, which I'll merge once CI passes |
actually my tests keeps failing . I must have done something incorrect when it passed as mentioned previously ( no surprise since i was switching toolchains and branches) Latest tarpaulin develop and nightly-2021-12-10 - > segfault when running all tests in workspace ( but these are tests which dont use thread_local at all) but if run tests just for that specific pallet - they are fine. Well, assuming that the segfault refers to the last executed test in the output ( i am not sure bout anything anymore at this point :-) ). |
Quick update - latest tarpaulin using Without that - tests fail ( it is either segfault or different outcome ) |
Is it actually using the latest develop, and not one from say 2 days ago or the start of the day? Because now it uses |
Yes. it is precisely this commit - |
Hmm, I just pushed a commit which adds verbose logging for the args and env vars which the test binary is executed with - since there didn't seem to be anything. If you grab the latest develop commit and run with |
I guess that's the issue, correct ? However, I can see also the following line for the first batch of tests:
After that it is only 1. Grep only the debug:
|
Oohh I believe I see what's happening, give me a sec and I'll put up a PR for it for you to try out! |
Well I couldn't build all of Basilisk after some attempts, maybe a wasm thing... Either way tested it on another project and it looks like it should fix the issue of --test-threads resetting! #899 |
Interestingly one of the nightly CI jobs segfaulted so maybe that's the same issue, I'll dig in more |
decided to tweak it a bit further so it's more similar to what went before - that should solve the segfault and your issue 👍 |
I could see a segfault too but wanted to check first before reporting somethingincorrect;-) I will try it with the latest update. |
It's never segfaulted on my machine but did on 1 CI run... Just part of the fun of using ptrace I guess 😅 |
Nice. Seems to be working fine now. Hopefully i did it correctly. Run it twice and all tests passed thank you very much . Where is the sponsor button ?;-) |
Brilliant, I'll merge the PR then! And there should be a sponsor button somewhere as I do have github sponsors/patreon and the FUNDING.yml in the repo, but it's not necessary unless you really want to 😅 |
Describe the bug
We have been using tarpaulin for our project for quite some time.
We haven't had any issues until now. We updated toolchain to more recent one -> nightly-2021-11-08.
And using tarpaulin to generate code coverage, our tests started failing. The tests produce different results than expected.
However, running just the tests without tarpaulin is fine and results are correct.
Note using any earlier toolchain than the one from 2021-11-08 is fine (eg. 2021-11-07 is fine ).
To Reproduce
our project is quite complex, using even more complex Substrate framework.
However to reproduce - it is fairly simple:
rust-toolchain
file - edit to change toolchain to one from 2021-11-08.make coverage
( takes quite some time ). Fails.make test
. Tests pass.Expected behavior
I'd expect tests not to fail considering they pass correctly without tarpaulin.
Personally, I cannot tell yet what can cause this issue.
I'll dig deeper to figure out what have the failing tests in common - it is not obvious from the first quick look.
but I figured it would be good to let you know, as there might be something which you are already aware of.
Version
cargo tarpaulin --version
cargo-tarpauin version: 0.18.5
The text was updated successfully, but these errors were encountered: