jfrimmel / cargo-valgrind

A cargo subcommand, that runs valgrind and displays its output in a helpful manner.

Home Page:https://crates.io/crates/cargo-valgrind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working on unit tests (missing field `xwhat`)

faern opened this issue · comments

Hi. Really awesome project. I love how much simpler it is to check for memory leaks etc with this tool. However I'm not able to run this on my integration tests on a Fedora Linux machine. I'm not sure if Cargo changed in some incompatible way or if I have an unsupported version of valgrind?

This is the software I'm running:

$ valgrind --version
valgrind-3.15.0
$ cargo valgrind --version
cargo-valgrind 1.3.0
$ cargo --version
cargo 1.43.0 (3532cf738 2020-03-17)

And this is the issue I'm getting:

$ cargo valgrind --test all_tests
...
error: Could not parse XML: custom: 'missing field `xwhat`'

It seems to work when running under Rust 1.39. cargo +1.39.0 valgrind --test all_tests does work. But only after a cargo clean. The builds with newer Rust seem to leave some metadata that cargo-valgrind does not understand.

that would be great if I could run this on unit tests.

Hello @faern,

can you provide me some test input for reproduction? Alternatively, you can try out the new version I've just updated. If you want to, you can try the new software using the following command:

cargo install --git https://github.com/jfrimmel/cargo-valgrind --branch custom-runner

I currently can't reproduce the issue. I can't remember exactly how I hit the problem, but I remember it being easy to get back then. I now have valgrind-3.16.1. So that could be why. Or newer Rust.

I think I got the problem in this repo: https://github.com/faern/loom-executor. It's the only one of my repos where I can find a all_tests.rs.

I ran into this issue when using Valgrind 3.15.0 as packaged in the Ubuntu 20.04 repositories. The problem went away when I compiled Valgrind 3.16.1 on my own.

Hello and thank you very much for this tool which is incredibly useful!

I am encountering the same bug locally with valgrind 3.16.1. Therefore, I installed cargo-valgrind from the malformed-xml branch using:

$ cargo install --git https://github.com/jfrimmel/cargo-valgrind --branch malformed-xml -- cargo-valgrind

I rerun the test and I now have the failing XML printed out!

valgrind.log

I hope this helps!

Thank you for the log, that's helpful. I'll have a look and hope to fix it soon.

Hi! I wanted to share the environment in which I’m encountering the same issue today, including sample project and Dockerfile to reproduce. I hope this helps!
valgrind_test.zip