Manually resolve symlinks in test helpers

Mac OS X's `readlink` command does not support the same options as GNU,
FreeBSD, and other operating systems, nor does it support canonicalizing
symlink resolutions.

In place of `readlink`, we're going to borrow [this] suggested implementation
from the community.

[this]: 
http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
same