Skip to content

Unit tests under valgrind for a cargo project give hundreds of errors #16134

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

Closed
apoelstra opened this issue Jul 31, 2014 · 4 comments
Closed

Comments

@apoelstra
Copy link
Contributor

Running

cargo new test-project
cd test-project
rustc --test src/lib.rs
valgrind ./lib

gives a few hundred errors. Running cargo test under valgrind is clean and trivial projects without cargo are also clean. I'm not sure who's to blame here.

@alexcrichton
Copy link
Member

Can you paste some of the errors that you're seeing?

@apoelstra
Copy link
Contributor Author

I should mention that I am on Linux x86_64 Fedora 20.

Running the commands in the OP results in

==10722== Memcheck, a memory error detector
==10722== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10722== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==10722== Command: ./lib
==10722== 
==10722== Conditional jump or move depends on uninitialised value(s)
==10722==    at 0x4B9842: terminfo::parser::compiled::parse::hebbae3f04aa9f209LAa (in /home/apoelstra/test-project/lib)
==10722==    by 0x4CA77E: terminfo::TerminfoTerminal$LT$T$GT$.Terminal$LT$T$GT$::new::h5799471108736378461 (in /home/apoelstra/test-project/lib)
==10722==    by 0x4CA0D6: stdout::h08598f4cc0d16cb2ahc (in /home/apoelstra/test-project/lib)
==10722==    by 0x442896: run_tests_console::h2805fd0a2fd8a1bcuFc (in /home/apoelstra/test-project/lib)
==10722==    by 0x440A91: test_main::h48522b4de40e1fa6rvb (in /home/apoelstra/test-project/lib)
==10722==    by 0x44B960: test_main_static::h7a67716904b9cb3eczb (in /home/apoelstra/test-project/lib)
==10722==    by 0x407F2A: __test::main::hf2a689af4b08782anaa (in /home/apoelstra/test-project/lib)
==10722==    by 0x4401D2: start::closure.$x22closure$x22$LP$8271$RP$ (in /home/apoelstra/test-project/lib)
==10722==    by 0x507B0B: rust_try (in /home/apoelstra/test-project/lib)
==10722==    by 0x504D96: unwind::try::hbf56caf860a163e6XOd (in /home/apoelstra/test-project/lib)
==10722==    by 0x504B84: task::Task::run::h6627b5a080a9a32fzWc (in /home/apoelstra/test-project/lib)
==10722==    by 0x43FFEC: start::h1f86d2536e8f1a682pe (in /home/apoelstra/test-project/lib)
==10722== 

running 1 test
test it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

==10722== 
==10722== HEAP SUMMARY:
==10722==     in use at exit: 0 bytes in 0 blocks
==10722==   total heap usage: 534 allocs, 534 frees, 155,576 bytes allocated
==10722== 
==10722== All heap blocks were freed -- no leaks are possible
==10722== 
==10722== For counts of detected and suppressed errors, rerun with: -v
==10722== Use --track-origins=yes to see where uninitialised values come from
==10722== ERROR SUMMARY: 368 errors from 1 contexts (suppressed: 2 from 2)

I'm not sure how to make valgrind actually display the rest of the errors.

@alexcrichton
Copy link
Member

I'm not sure what's going on with the ERROR SUMMARY: 368 errors section, but the conditional jump warning may be related to #15932 or #11710

@thestinger
Copy link
Contributor

These are the usual false positives. There's not much point in having a bunch of issues open for something that's not a bug and isn't going to be fixed.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Feb 11, 2024
fix: waker_getters tracking issue from 87021 for 96992.

I was directed to make the fix here by this comment rust-lang#118960 (comment).
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

3 participants