So this is my forth release and I finally feel like I have something of use to someone other than myself. Today I finished off the first release of Logfribulator. This odd sounding thing is a system which is going to take Mozilla testing logs and inject a serious amount of cool into them. To get to this stage I have written some patches to enable timestamps in the testing infrastructure. So far I have patched xpcshell, feed and reftest output to add “1234567890 | “ as a prefix to their test status messages. I have decided that I am going to try to get the patches through without needing an autoconf option to simplify my work. If this doesn’t work I am going to have to figure out how to pre-process javascript files. If these patches land as is (minus some tweaking in the xpcshell tests), life will be good.
I would like to take this time to introduce you to my system. As it is right now, this is the interface we have for looking at test logs
. That same file put through Logfribulator looks something like
. This is much easier to look at. Currently there is no sorting or filtering. This is going to be a tough one for me because I will have to do this browser side to avoid the rather long roundtrips. I am guessing that I am going to need to use the DOM to do this, but I am not too sure. I guess this gives me a reason to learn JavaScript more thoroughly
I would love to talk about what I have done to get here but that would take another 3 weeks to write out. Basically, I rewrote the parser that I had before. I added the ability to slurp an error log if it is in between “>>>>>>>” and “<<<<<<<<“ strings on their own line. An example is: TEST-OUTPUT
>>>>>>>
Test failed because…
<<<<<<<
This means that the line from “TEST-OUTPUT” has an error log of “Test failed because….” This is critical to the usefulness of this system because this system focuses on fails, not passes. I also changed the way I was picking out results. Instead of searching for “PASS” and “FAIL”, I am now making heavy use of Python’s regex class. This is a really well written library! I made heavy use of named groupings, which is a nice feature. Basically, when you use a regex like match = re.search(r“^(?Pyou will get back a match object which you can search the groupings. Normally, you are limited to using integer keys, but by using the (?P you can access the groups as a dictionary match.group(‘name’) will give you the name and match.groupdict()[‘number’] will give you the number. This is really neat and really helped keep my code readable.
Another thing I paid attention to in this release a lot was unit tests. I found them to be really useful during my development because I was able to find many errors. I also found that as soon as I discovered a weak spot in my code fixing it in the unit test first was most helpful as I knew when I had fixed the code. That being said, I still need to write a unit test for the ReftestLogLine class I wrote today. This class is particularly cool in my opinion because it has the ability to get the actual comparison images and show them on the webpage in a special way. This is critical for Reftest comparison because they don’t have any test error information other than the images and a count of pixels that are different.
I also learned the python CGI library today and have to say that like every python module I have looked at, it seemed really nice. It took about an hour to go from nothing to a cgi page with forms, and because i have been generating HTML markup since I wrote the parser, it only too a few hours to hook up my generation methods. I found that because of SELinux, on Fedora you can’t use urllib.urlopen in a CGI script because all network access is blocked from httpd. While this is a sensible default to stop people from making web-proxies, it stops my script from working. To enable this I set the SELinux boolean “httpd_can_network_connect” to true. After doing this, my script works
While writing the web ui for the parser today I figured out how I am going to hook this into the build infrastructure. I think I am going to have this script running on a computer and it is going have its database local. I will hook up the applicable buildbot steps to perform a post to an insert cgi page with the URL that the log to parse can be found at. my system will then grab this page, parse the log, insert into its local db then make it available for view using the cgi view.
For my next release I think I am going to focus on the web ui. My goal is to make the table sortable and filterable client-side. This is going to be a lot of work for me because I have never done anything with the DOM before. I am also going to tackle Mochitest output. If this turns out to be easier than I think, I am going to start looking into the database and creating an insertion page. Another thing Dave mentioned that might be a good idea is to link the name of the test to its source. While possible, this would require knowing the objdir of each build so I could lob the rest of the URI off and link it to MXR/OpenGrok. While not impossible, I am going to call this polish to look at when the rest of my system is working.
This week was really fun for me, I really learned a TON about python and it made me really excited that I am going to be working on Mozilla code full time this summer! I also hope that this system is useful to people. Oh, before I forget here is a sample system running Logfribulator here
