[PATCH] Add a parameterised gtype for structs

Havoc Pennington hp at redhat.com
Mon Feb 6 19:11:01 PST 2006

On Mon, 2006-02-06 at 14:19 -0500, John (J5) Palmieri wrote:
> Coding looks good though I just gave it a once over for obvious errors.
> I see you have a functional test but did you update the tests in
> tests/glib?  It would be nice to see glib sending a struct and then
> getting it back and decoding it correctly.  It would be even nicer to
> see python sending it a struct and then getting it back as is.

Unit tests should definitely cover this IMO; when I wrote the original
struct marshaling code, there were a ton of corner cases I messed up and
only discovered via unit testing. Look at all the cases covered by

Ideally we could find a way to use the code in
dbus-marshal-recursive-util.c to also test the glib stuff. It exports a
function already (grep for generate_bodies) that returns all its test
cases as raw data; if we could use that (or export some slightly
different function) then the glib test suite could just get each test
case, round-trip it through the glib bindings, and see if it gets back
the same bytes as the original test case. Really this would be a pretty
airtight way to test any binding.

On the bigger picture of the patch - I think we had a discussion about
how to do structs a while back? Any writeup of why this patch does it in
this way vs. others, general notes on the approach, etc.?

Also, I asked Colin if he would take a high-level look at it.


More information about the dbus mailing list