In SVN trunk, gnome-power-manager has grown a test suite. Executing “test/gnome-power-self-test –all” executes 100 self tests on some of the key GObjects, testing for things like numerical accuracy, segfaults on error conditions, some parts of the DBUS interface and other useful stuff like that. The output is pretty crude, something like this:
> check #19 GpmArray : clear array……OK [cleared]
> check #20 GpmArray : get cleared size……OK [get size passed]
> check #21 GpmArray : save to disk……OK [saved to disk]
> check #22 GpmArray : load from disk……OK [loaded from disk]
> check #23 GpmArray : get file appended size……OK [get size passed]
> check #24 GpmArray : interpolate data……OK [interpolated]
> check #25 GpmArray : limit x size……OK [limited size X]
> check #26 GpmArray : limit x width……OK [limited width X]
> check #27 GpmArray : test copy……OK [copied]
> check #28 GpmArray : uniform weighted average……OK [averaged okay]
> check #29 GpmArray : integration down……OK [integrated okay]
> test passes (100/100) : ALL OKAY
It lets me continually add features, hopefully without regressing. If I process a crasher bug in bugzilla that could have been tested for and prevented, I add it to the self test program so that any refactoring in the future does not re-introduce the bug.
This found even the simplest functions of gnome-power-manager were suffering from bugs really hard to pin-point in real world use. I'm also adding more and more tests everyday to the test program as some of the nastier bits of g-p-m (GpmPower, GpmBattery) get refactored into nice clean GObjects.
Hopefully this refactoring and restructuring of g-p-m will allow me to just slot in the profile code, and everything will “just work”, with less memory and less complexity. Let's wait and see..