That is an interesting trick for testing. We do some similar things in our testing, but normally not in every test run, we do some longer tests like this as part of our continuous integration tests as well as the nightly test runs. How long does it take in comparison to other tests?
It doesn't seem like a bad idea to have some tests like this to avoid regression, so long as the test is quick and isn't brittle. peace, Dan Mayer Co-founder, Devver (http://devver.net) follow us on twitter: http://twitter.com/devver My Blog (http://mayerdan.com) On Sat, Nov 29, 2008 at 10:05 PM, Keith Rarick <[EMAIL PROTECTED]> wrote: > > I just thought of a clever (IMHO) trick to use gdb for writing > white-box unit tests. I wanted to get opinions about it before merging > into master. > > The motivation: I wanted to write a regression test for the fix in > http://github.com/gbarr/beanstalkd/commit/b9df37, but all_jobs_used is > static in job.c, so there's no way to write an assert statement > involving that value. On the other hand, I had just finished using gdb > to inspect that variable and observe the bug -- gdb can easily access > any part of the program, static or otherwise. > > The trick: use gdb's watchpoints feature to get a trace of every value > taken on by a variable during the test, then compare that trace with a > file of expected values. > > You can see an implementation at > http://github.com/kr/beanstalkd/commit/d65d34. > > kr > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "beanstalk-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en -~----------~----~----~----~------~----~------~--~---
