Add some tests for fio.dirname, #491

Fix some bugs in the function (now it uses libc's (3) dirname ffi.call).