As I wrote two weeks ago, I consider the QA related changes in Ubuntu 12.04 a great success. But while we will continue and even extend our efforts there, this is not where the ball stops: it’s great to have the feedback cycle between “break it” and “notice the bug” reduced from potentially a few months to one day in many cases, but wouldn’t it be cool to reduce that to a few minutes, and also put the machinery right at where stuff really happens — into the upstream trunks? If for every commit to PyGObject, GTK, NetworkManager, udisks, D-BUS, telepathy, gvfs, etc. we’d immediately build and test all reverse dependencies and the committer would be told about regressions?
I have had the desire to work on automated tests in Linux Plumbing and GNOME for quite a while now. Also, after 8 years of doing distribution work of packaging and processes (tech lead, release engineering/management, stable release updates, etc.) I wanted to shift my focus towards technology development. So I’ve been looking for a new role for some time now.
It seems that time is finally there: At the recent UDS, Mark announced that we will extend our QA efforts to upstream. I am very happy that in two weeks I can now move into a role to make this happen: Developing technology to make testing easier, work with our key upstreams to set up test suites and reporting, and I also can do some general development in areas that are near and dear to my heart, like udev/systemd, udisks, pygobject, etc. This work will be following the upstream conventions for infrastructure and development policies. In particular, it is not bound by Canonical copyright license agreements.
I have a bunch of random ideas what to work on, such as:
- Making it possible/easier to write tests with fake hardware. E. g. in the upower integration tests that I wrote a while ago there is some code to create a fake sysfs tree which should really go into udev itself, available from C and introspection and be greatly extended. Also, it’s currently not possible to simulate a uevent that way, that’s something I’d like to add. Right now you can only set up /sys, start your daemon, and check the state after the coldplugging phase.
- Interview some GNOME developers what kind of bugs/regressions/code they have most trouble with and what/how they would like to test. Then write a test suite with a few working and one non-working case (bugzilla should help with finding these), discuss the structure with the maintainer again, find some ways to make the tests radically simpler by adding/enhancing the API available from gudev/glib/gtk, etc. E. g. in the tests for apport-gtk I noticed that while it’s possible to do automatic testing of GUI applications it is still way harder than it should and needs to be. I guess that’s the main reason why there are hardly any GUI tests in GNOME?
- I’ve heard from several people that it would be nice to be able to generate some mock wifi/ethernet/modem adapters to be able to automatically test NetworkManager and the like. As network devices are handled specially in Linux, not in the usual
/devand sysfs manner, they are not easy to fake. It probably needs a kernel module similar to scsi_debug, which fakes enough of the properties and behaviour of particular nmetwork card devices to be useful for testing. One could certainly provide a pipe or a regular bridge device at the other end to actually talk to the application through the fake device. (NB this is just an idea, I haven’t looked into details at all yet). - For some GUI tests it would be much easier if there was a very simple way of providing mocks/stubs for D-BUS services like udisks or NetworkManager than having to set up the actual daemons, coerce them into some corner-case behaviour, and needing root privileges for the test due to that. There seems to be some prior art in Ruby, but I’d really like to see this in D-BUS itself (perhaps a new library there?), and/or having this in GDBus where it would even be useful for Python or JavaScript tests through gobject-introspection.
- There are nice tools like the Clang static code analyzer out there. I’d like to play with those and see how we can use it without generating a lot of false positives.
- Robustify jhbuild to be able to keep up with building everything largely unattended. Right now you need to blow away and rebuild your tree way too often, due to brittle autotools or undeclared dependencies, and if we want to run this automatically in Jenkins it needs to be able to recover by itself. It should be able to keep up with the daily development, automatically starting build/test jobs for all reverse dependencies for a module that just has changed (and for basic libraries like GLib or GTK that’s going to be a lot), and perhaps send out mail notifications when a commit breaks something else. This also needs some discussion first, about how/where to do the notifications, etc.
Other ideas will emerge, and I hope lots of you have their own ideas what we can do. So please talk to me! We’ll also look for a second person to work in that area, so that we have some capacity and also the possibility to bounce ideas and code reviews between each other.
Pingback: Ubuntu developers: Martin Pitt: To boldly go where no test has gone before | Linux-Support.com
#1 by Philip Withnall on 2012/05/18 - 09:44
Zitieren
There already exists a tool for mocking up D-Bus services for testing their clients. It’s called Bendy Bus (http://tecnocode.co.uk/2012/01/19/all-aboard-the-bendy-bus/). Disclaimer: I wrote it.
It’s still quite young, and currently aimed at fuzz testing the clients by simulating the servers, but I think there’s a solid foundation to build on from there. I’ve successfully built deterministic unit tests with it (although just as an experiment; none are in actual use anywhere).
#2 by pitti on 2012/05/18 - 09:51
Zitieren
Thanks Philip for pointing this out!
#3 by Frank on 2012/05/18 - 10:24
Zitieren
“I guess that’s the main reason why there are hardly any GUI tests in GNOME?”
Have you ever heard of Dogtail and LDTP?
#4 by pitti on 2012/05/18 - 10:45
Zitieren
Yes, I am aware of both, and have used dogtail myself a while ago. But still the fact remains that almost no GNOME package has a “make check” for the GUI parts. That might have several reasons; they might not be familiar to GNOME maintainers, are still too hard to use, or might not be a blessed dependency. Whatever it is, we’ll need some discussion and initial “demo” test suites for those and then see what we can improve.
#5 by Antono Vasiljev on 2012/05/18 - 12:26
Zitieren
Ruby community embraced unit/acceptance testing. Personally i would love to see support for integration testing of GTK apps in gtk/glib core.
One of best examples i seen before is (ruby/gtk only) Gutcumber: http://danlucraft.com/blog/2009/05/new-project-gutkumber-integration-testing-for-ruby-gnome2/
I belive its possible to introspect full GTK app (like gtkparasite.so) and allow external code click buttons and check results.
Mentioned prior art in ruby is generic solution for object mocking in unit tests. You are right, for integration testing you need mocking on server side.
PS: Any way to get mysql.service included into your systemd ppa package?
#6 by Ole Laursen on 2012/05/18 - 13:00
Zitieren
Sounds great to me.
Another explanation for the GUI tests could be that it’s usually faster to just be a click monkey. There’s a hype around automated tests at the moment that says more automated tests == improvement, but that’s just not true in general; there’s a maintenance burden involved in automated tests so it really only makes sense to automate the stuff that’s complex enough to break regularly or too tedious to check manually. On a related note, there’s a danger in stubbing too much stuff if the errors typically result from behavioral changes in one of the dependencies.
#7 by Gil Forcada on 2012/05/18 - 14:15
Zitieren
Nice to see Ubuntu/Canonical embracing more upstream and trying to work together as they should (and do)!
That’s really refreshing and exciting news coming from Canonical!
Looking forward to it!!
#8 by pitti on 2012/05/18 - 14:47
Zitieren
Ole, I generally agree to your sentiment that the effort in maintaining the tests must be reasonable, otherwise you’d spend more time writing and maintaining them than with manual testing. On the other hand, I’ve seen quite a lot of unexpected breakages when your underlying libraries change, and many of e. g. apport-gtk’s UI tests are now fairly quick to write, especially for the less obvious properties (“is this window resizable in precisely the situations when it should be, e. g. when the expander is open?”).
So I do favour GUI integration tests where they test a lot of the underlying stack as well and are fairly cumbersome to do manually, such as in the areas of remote/virtual file systems (nautilus/gvfs), race conditions, power management/suspend, memory leaks (it’s trivial to do an operation a thousand times in an automatic test), or plugin systems. For the latter, I could envision some automatic testing of global menu bars or Gedit plugins, which both broke a lot in the past (going through indicators and libdbusmenu, or introspection and libpeas respectively, and both relying on lots of API to work).
#9 by Lucas Meneghel Rodrigues on 2012/05/18 - 16:18
Zitieren
Hi Martin, when you have some time, you might check out some automated testing efforts such as autotest (http://autotest.github.com/). We believe autotest is a mature and fairly complete end to end testing framework, and if we could be of any use for you guys, we’ll be happy to help.
Cheers!
#10 by Bjoern Michaelsen on 2012/05/19 - 00:57
Zitieren
The Clang static analyser has already been applied to LibreOffice and resulted in a few fixes already, see for example:
https://bugs.freedesktop.org/show_bug.cgi?id=39596
http://nabble.documentfoundation.org/PATCH-Some-fixes-for-Clang-warnings-td3930590.html#a3933586
http://nabble.documentfoundation.org/LibreOffice-3-6-0alpha-built-on-clang-td3758515.html#a3761952
If you wanna exchange experiences with one of those guys, I will try to set you up.
#11 by Gema on 2012/05/21 - 13:38
Zitieren
Looking forward to collaborating with you in this, sounds like our paths are converging real quick and you are going to make the QA journey much easier
Pingback: Ubuntu Weekly Newsletter Issue 266 | Ubuntu Linux FAQs
Pingback: Second upstream QA engineer position at Canonical « Martin Pitt
Pingback: Ubuntu developers: Martin Pitt: Second upstream QA engineer position at Canonical | Linux-Support.com