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
* Ulrich Dangel mru@grml.org [Tue Mar 30, 2010 at 08:24:18PM +0200]:
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.
As you know I consider this an awesome feature.
I'd like to be able to run automated unittests based on our daily ISOs on an according host once a day as soon as we've the according infrastructure available.
I think writing unittests for all our important features is worth the effort and in the long run I'd like to see new features added to Grml only if they have an according unit test.
I think this unit tests feature through Grml might be interesting for other projects as well, because they can test their own software stuff without any risks - even if it's pretty hardware related like all the partitioning, installation and deployment stuff. Oh and thanks to grml-live they can easily build their own live system if the software isn't shipped as part of Grml. :)
regards, -mika-
On Tue, Mar 30, 2010 at 20:24, Ulrich Dangel mru@grml.org wrote:
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.
Yes, this is a Very Good Thing. I would suggest that all scripts for custom images run those tests by default. That way, regressions can be mitigated which increases usefulness to the user and thus kudos to Grml.
RIchard
Teilnehmer (3)
-
Michael Prokop -
Richard Hartmann -
Ulrich Dangel