My experience with The NetBSD Foundation as a part of Google Summer of Code, 2017
As the first evaluation is approaching, I’d like to share my experience, so far, with The NetBSD Foundation. My project is related to adding support for other virtual machine systems, like GXemul, Virtualbox etc. to Anita (a tool for automated testing of NetBSD installations on various platforms.) as well as integrating support for cpu architectures it doesn’t currently support.
Anita is a set of a library and a few scripts. Although, its main purpose is to test sysinst installation procedure and quickly detecting the errors encountered in the process, it is also used for testing the whole NetBSD system by running ATF test suite. In future, we also have plans for supporting kyua, which would ultimately replace ATF. The problem with kyua right now is that it doesn’t get installed properly when a NetBSD release is built with MKKYUA=yes build option. Although, it can be installed manually, that’s not really what Anita should be doing. Both, the library part and the controlling script for Anita are written in python. Additionally the package includes a bourne shell script for testing older NetBSD releases too. This has been done to ensure back compatibility.
So far, throughout the coding period, I have build lots of realeases (and fixed many of them), done lots of testing and also contributed to the Anita library and the controlling script.
Building releases is as easy as cloning the repository and executing build.sh in the root of source directory along with all the options. However, it takes a lot of time for the build process to complete. On a laptop with intel core-i5 6300hq, building the amd64 release takes about an hour and ten minutes with all the 4 cores enabled. (On a laptop that was purchased for web browsing and using spreadsheet, this will take much much longer than that.) This may look like an easy task and you might be thinking “Bro! I’ll just let it build for an hour, leave it like that and enjoy all this while”, but it’s not that easy. While testing random realeses or trying to get a build to work, it will fail to compile several times. Let’s suppose, it fails 5 times, just when the build was about to complete. On my system, you’d end up wasting 5 hours building and let’s say, an hour, in total, fixing the errors. So, that’s a solid 6 hours. Not only that, while all this is happening, you’ll get up and leave several times and wouldn’t know that the build has failed. This will lead to extra loss of time. The only way to stop this is to keep sitting in front of your screen.
Let’s add up an hour for it too. So now, it’s 7 hours. This was just for one release. While trying to figure out which release broke the build process, you’ll have to test multiple releases. In my case, this was almost always 15 – 16 releases. So lets multiply that too. 7*16 = 112 hours. Now imagine, on a machine running exactly 4 times slower, how long would it take? 112*4 = 448 hours. Now let’s suppose, you work for 10 hours a day. In my case, it would take me just 11.2 days to finish off the work whereas on a 4X slower machine, it’ll take 44.8 days. I hope you got the point! And mind you, the entire calculation assumes that you’ll be using your processor to the fullest possible extent, so don’t expect a long battery life. It’ll probably get reduced to 1/3rd or 1/4th. So even if you get 5 hours of extra usage with a slower machine, the difference will now be merely 1 hour 15 minutes.
The system libraries a generally written in C and sometimes in assembly language. So, you need have at least basic debugging skills for C. Although, the system files are quite long (in length) and contain a lot of macros and pointer usage etc. that a regular college student might not be familiar with, you won’t face any difficulty in debugging them if you are good at understanding what the code is trying to do, i.e. your skill for interpreting new code base is strong enough.
The testing part is actually a bit better than the building part. All you need is a virtual machine system, like GXemul, an empty (or populated with a working filesystem) raw disk image. In some cases, it requires us to have a kernel and an iso image for the first boot too. Basically, you just need to be familiar with the command line for that particular virtual machine system. The main objective of testing is to make sure there are no errors during the boot process and you’re able to log in and then halt the system properly. In case of any errors, you’ll have to fix that and go through the build process once again.
Apart from that, the entire NetBSD system can be tested with ATF test suite and kyua. But, that is not really a part of my project. Anita does that for me.
Contribution to Anita library
This is something that required the least amount of effort until now. Now that we have a few more ports working (by going through the build process, testing and then fixing errors.), the code contribution to this and possibly the controlling script is going to increase. A special emphasis was given on finding the simplest possible solution with least amount of additional code. I ensured that I took full advantage of the classes and funtions that already existed in the library. Of course, this means that I had to go through lots of code muliple number of times. The Anita library was already over 1700 lines of code, when I started.
Currently, we’re working on adding support for NetBSD/evbearmv7hf-el. Now this port contains a lot of kernels. The first kernel to be supported would be VEXPRESS_A15.
In future (during the GSoC period), we may even have a working NetBSD/macppc. This is yet to be tested successfully.
Work is already on for getting a mips port supported on Anita. I (with the help of my mentors and various other members of The NetBSD Foundation) have succesfully tested the NetBSD/pmax port. If time permits, we will likely have more arm and mips ports supported on Anita.
For me, Google Summer of Code was the single best experience I’ve had in years. Until now, it has been quite adventurous and I’ve learnt a lot more than any college could have taught me.