ulimit

I had downloaded a open source tool pylint. When I got it to run, I was always given this stack trace “Too many open files”. After searching for a clue on the web, I was pretty positive too many file descriptors created by the tool since I saw a similar problem. Wanting to be sure I did:

$ watch lsof +D .

while running the tool. It looked right the output filled up the screen.

With the help of my coworkers, I discovered that there is a setting to increase the max opened files allowed bye a process. The command is

$ ulimit

It’s a bash command to limit system-wide resources. Another thing that is new to me is that there is a concept of soft limit and hard limit. Not sure why there are such things, I seem to notice that the soft limit is what preventing pylint to work on huge number of files. It seems to me that the soft limit is the real max value that a user can set.

Below are ways to find out the lower and upper extremes.

$ ulimit -a -H
$ ulimit -a -S

Let say the soft limit for open files is 1024, you cannot do $ ulimit -n 1025 because that is greater than the soft limit. That was a problem for me since I needed more so what I need to do first is to increase the soft limit and then use ulimit to increase it for my session.

After more research, I found a solution.

Basically, since I’m on Mac Leopard I need to do:

$ launchctl limit maxfiles 10240 unlimited

or set it directly in:

/etc/launchd.conf

and then:

$ ulimit -n 10000

That solves my problem. Aside from that I probably need to ask pylint developers why it needs to open so many files because it could be I am using it wrong but at least I discovered something new.

Some investigation into result logs from firefox 3.5 tests

Firefox 3.5 unit tests:

http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox3.5-Unittest

Log types: EverythingElse (reftest, crashtest, mochitest-chrome, xpcshell, mochitest-a11y, browser-chrome), Mochitests (plain)

OSes: Linux, OS X 10.5.2, WINNT 5.2

Everything else

Reftest:

Multiple test units per file

TEST-PASS numbers don’t add up (possibly number provided by tinderbox is the number of files instead of test units)

Crashtest:

TEST-PASS numbers don’t add up

Tests appear once

One test unit per file

REFTEST TEST-PASS | file:///builds/slave/mozilla-1.9.1-linux-unittest-everythingelse/build/reftest/tests/gfx/src/mac/crashtests/306902-1.xml | (LOAD ONLY)

Mochitest-chrome:

Multiple test units per file

TEST-PASS & TEST-KNOWN-FAIL numbers add up

INFO TEST-KNOWN-FAIL | chrome://mochikit/content/chrome/toolkit/content/tests/chrome/test_preferences.xul | instant pref init file

INFO TEST-PASS | chrome://mochikit/content/chrome/toolkit/content/tests/chrome/test_preferences.xul | instant element init int

Xpcshell:

Tests appear once

One test unit per file

Numbers add up

TEST-PASS | /builds/slave/mozilla-1.9.1-linux-unittest-everythingelse/build/xpcshell/tests/test_zipwriter/unit/test_bug446708.js | test passed

Mochitest-a11y:

Multiple test units per file

Test units often appear more than once

Numbers add up

INFO TEST-PASS | chrome://mochikit/content/a11y/accessible/test_actions_aria.html | No actions on the accessible for ‘clickable’

INFO TEST-KNOWN-FAIL | chrome://mochikit/content/a11y/accessible/test_nsIAccessibleTable_1.html | rowDescription should not throw

Browser-chrome:

Multiple test units per file

Test units often appear more than once

TEST-PASS | chrome://mochikit/content/browser/browser/base/content/test/browser_alltabslistener.js | Got an expected notification for the front notifications listener

TEST-PASS | chrome://mochikit/content/browser/browser/base/content/test/browser_alltabslistener.js | Got a notification for the front notifications listener

TEST-PASS | chrome://mochikit/content/browser/browser/base/content/test/browser_alltabslistener.js | onStateChange notification came from the correct browser

Mochitests

15867 INFO TEST-PASS | /tests/content/canvas/test/test_2d.line.width.transformed.html | pixel 86,25 is 0,255,0,255; expected 0,255,0,255 +/- 0

15863 INFO TEST-PASS | /tests/content/canvas/test/test_2d.line.width.transformed.html | pixel 15,25 is 0,255,0,255; expected 0,255,0,255 +/- 0

15856 INFO TEST-PASS | /tests/content/canvas/test/test_2d.line.width.transformed.html | pixel 16,25 is 0,255,0,255; expected 0,255,0,255 +/- 0

15870 INFO TEST-KNOWN-FAIL | /tests/content/canvas/test/test_2d.missingargs.html | should throw NOT_SUPPORTED_ERR

Multiple test units per file

Test units only appear once

Numbers off by a bit

Possible regexes:

Re.compile(r’REFTEST TEST-.+crashtests’) // look for “REFTEST TEST-” followed by any character any count and followed by “crashtests”

What is a mock object?

Someone recommended reading this presentation about Unit Testing at StackOverflow.

First of all I was amazed by the fact that FF has this hidden slides feature. I wondered what tool was used by the author to make the slides. Does anyone know?

Anyway, it is an interesting set of slides on unit testing. And in there, there are some slides on Mock objects. I haven’t fully understood what they are yet, but I think Mocks are objects in which expectations can be set to their interfaces. The expectations are based on known specifications. The reason is that so that tests can be written for the specifications before they are implemented. Right now, I am still not sure the benefit of doing this yet.?.?. This is probably not new to many people but this is the first time I heard about it. It sounds like a useful concept. If anyone can point me to good readings/articles/books on mock objects, I will definitely appreciate it.

Implementing the functionalities of resultserver

On one of my previous posts, one of the remaining items to do is to have server generated web pages to fetch reports from the data storage and to bring it to the user end. For this implementation, the project will be using brasstacks, couchquery, and webenv. So far web pages for simple views have successfully been implemented using brasstacks. As a result, the focus now is on the scenarios how the information will be used.

Currently focusing on:

  • given a build, finding its last previous build.
  • given two builds, finding the difference at individual test level as mentioned in my last post.

To find the previous build, my idea, which I don’t know if it will be feasible or not, is to have a view where the keys will be the necessary metadata and the value to be the build id. When querying the view, filter the rows with the metadata of the current build. The metadata that identifies a particular build will be the product, the OS, and the test type. The question is whether all these can query arguments for key= like (key=[product, os, testtype]). So far from what I have seen I can set the key to be doc.build such as emit(doc.build, doc) and set the key to be a specific build by specifiying key=”sample_build_id”.

To get the previous then, one approach is to iterate the rows and find the timestamp that matches with the timestamp of the current build and return the row after that which would then be its previous build. We’ll see how it goes once couch.io is back up.