[Grml-devel] Unittests for grml

Ulrich Dangel mru at grml.org
Tue Mar 30 20:24:18 CEST 2010


Hi,
I am happy to announce that we now have unit tests for grml. This means it is 
possible to automatically test at software like grml2hd, grml2usb and
grml-autoconfig at runtime on the iso in an automated way.

Please provide comments about the whole idea, if it is worthwhile in your 
opinion, what should be changed and if it is a good idea to use this kind of 
automated testing for an live cd.

But now to the more interesting part:

How to get it
=============
Just check it out from the git repository:
git://git.grml.org/grml-unittests.git

How does it work
================
grml supports the netscript boot-parameter allowing loading code from some 
remote service. With this parameter it is possible to execute code and 
bootstrap additional tests/commands.

kvm supports directly loading kernel, initrd and specifying boot parameters.
This means using kvm and specifying the kernel, initrd and the boot-parameters 
allows to run custom code inside grml with the help of the netscript parameter 
without any need to modify the system.

To report the result of the executed tests inside kvm a side channel towards 
the host system is needed. I used an simple HTTP Server with two predefined 
urls, /FAIL /DONE. Both urls support HTTP post to allow additional info 
messages to be displayed.

If you mix now everything and use some little shell scripts an unit-testing 
environment for the grml live cd is created.

How to run
============
Please note that some of the tests, e.g. grml2hd create a  2GB file in /tmp. 
So only run them if you have enough space available.

Download a grml cd, and mount it via loopback, e.g.
# mount -o loop /srv/grml-medium_2010.04-rc1.iso /mnt/tests

Run run_tests and specify the iso and the mountpoint, e.g.:
$ ./run_tests.sh /srv/grml-medium_2010.04-rc1.iso /mnt/tests

It is also possible to only run a specific test, you have to specify it as 
additional parameters, to run for example the autoconfig and lvm tests use:
$ ./run_tests.sh /srv/grml-medium_2010.04-rc1.iso /mnt/tests autoconfig lvm

Requirements
===============
Grml iso (mounted to a directory), kvm


Have fun and start writing tests ;0
Ulrich


More information about the Grml-devel mailing list