joyent/libuv — pull request #469 by AvianFlu (2012-06-18 09:44:29+00:00)
Title: fs test fixes

These are some minor test improvements that will prevent unneeded test failures moving forward.

The file watching tests in `test-fs-events.c` all use the same directory for their fixtures - `watch_dir`. If a test fails from an assertion error, it doesn't clean up, and this can cause other tests to fail, simply due to the other tests trying to rmdir("watch_dir") when there are still other files left in the directory. I've replaced the repetitive and not always accurate manual cleanups with a helper method, `cleanup_watch_dir`, that reads the directory first, and cleans up whatever is actually there.

I added a second commit to skip one of the `uv_fs_chown` test cases if the tests are being run as root. The test expects to fail - a normal user can't `chown` something to root - but if the current uid is 0, it succeeds, which makes the test fail. This seemed spurious.