From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16111 invoked by alias); 10 Mar 2003 23:26:03 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 16104 invoked from network); 10 Mar 2003 23:26:03 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 172.16.49.205 with SMTP; 10 Mar 2003 23:26:03 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18sYY3-0001SP-00 for ; Mon, 10 Mar 2003 19:27:19 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18sWef-0003Xs-00 for ; Mon, 10 Mar 2003 18:26:01 -0500 Date: Mon, 10 Mar 2003 23:26:00 -0000 From: Daniel Jacobowitz To: gdb@sources.redhat.com Subject: Re: Need suggestions on how to test observer.c Message-ID: <20030310232601.GA13541@nevyn.them.org> Mail-Followup-To: gdb@sources.redhat.com References: <20030310224356.GG972@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030310224356.GG972@gnat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-03/txt/msg00148.txt.bz2 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