luser / rust-gdb-remote-protocol

A Rust crate implementing the GDB Remote Serial Protocol
Apache License 2.0
33 stars 13 forks source link

Add integration tests with gdb #51

Closed luser closed 6 years ago

luser commented 6 years ago

I mentioned this on IRC recently but I think now that we have most of the basics supported it'd be good to start adding some gdb integration tests. My thought would be that we'd have something like struct TestHandler that has an impl Handler, but with ways to mock out its output. (There don't seem to be any trait-mocking crates that work with stable Rust without requiring a build script currently, so we may just have to hand-roll something.) Tests would instantiate a TestHandler, add some expectations to it, then run a server for it on a background thread. We would then run like gdb -nx -batch -ex 'target remote localhost:port' [-ex cmd] -ex quit where the test would pass a list of additional commands, and match against gdb's output. I recently wrote some tests for sccache using assert-cli which was pretty nice for writing this sort of test.

Until we get useful support for qXfer for files and whatnot we might need to have a prebuilt binary checked in and point gdb at it with file or whatever to make things work.

luser commented 6 years ago

https://github.com/luser/rust-gdb-remote-protocol/pull/52