g-p-m test suite

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.. :-)

Published by

hughsie

Richard has over 10 years of experience developing open source software. He is the maintainer of GNOME Software, PackageKit, GNOME Packagekit, GNOME Power Manager, GNOME Color Manager, colord, and UPower and also contributes to many other projects and opensource standards. Richard has three main areas of interest on the free desktop, color management, package management, and power management. Richard graduated a few years ago from the University of Surrey with a Masters in Electronics Engineering. He now works for Red Hat in the desktop group, and also manages a company selling open source calibration equipment. Richard's outside interests include taking photos and eating good food.