Need suggestions on how to test observer.c
Daniel Jacobowitz
drow@mvista.com
Mon Mar 10 23:26:00 GMT 2003
On Mon, Mar 10, 2003 at 02:43:56PM -0800, Joel Brobecker wrote:
> The last time I needed to do some unit-testing, it was for the xfullpath
> command, and it was pretty easy to test it inside gdb.gdb by debugging
> gdb itself, and use inferior function calls with appropriate parameters.
> It would be good to use the same approach one more time. Unfortunately,
> it is not so easy this time. We could use the same trick, except that
> one of the parameters is a function pointer. That means we would need to
> find some functions in GDB that could be used as callbacks:
> - Second case: we add 3 dummy functions to the GDB code that would
> do exactly what that functions in my testdrive do: increment an
> integer each time they are called. We would then use them as
> callbacks, and use the integers to check that the notifiation
> worked properly.
I have no objection to adding these dummies to observer.c; I think I
prefer that, because it tests observer code in the closer to the same
way it will be used.
>
> So, to summarize, we have several options (in order of personnal
> preference):
> 1. Compile and run my little test_observer.c program outside of GDB
> and check the output. To compile it, use the trick above to avoid
> the dependency on the entire GDB code.
> 2. Update the makefile to give runtest the information necessary in
> order to be able to find libgdb.a and all dependents. Then setup
> the test to compile test_observer with that information. Run
> this program outside of GDB, and check the output.
> 3. Add new benign functions inside observer.c to allow the testing
> to be done via inferior function calls.
> 4. Find and use already defined functions in GDB, test the observer
> via inferior function calls.
> 5. Do not add an observer-specific test. When a bug shows up due to
> an observer.c bug, we'll then add a testcase as usual. The testing
> coverage for observer.c will slowly increase.
>
> Let me know what you prefer, and I'll go from there.
>
> Thanks,
> --
> Joel
>
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb
mailing list