From 6580dfeddd9693b778f59ca5c333d05200d67687 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 24 Jun 2016 00:06:46 +0300 Subject: unittests: Fix kFileNoSymlink test on FreeBSD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actual value on FreeBSD is -31, UV_EMLINK was obtained from /usr/include/asm-generic/errno-base.h (there EMLINK is defined as 31 there). This may actually be something else, but I do not think so as “Too many links” description also fits in. [Man page][1] agrees with me, search for `[EMLINK]` ([linux man page][2] also specifies ELOOP explicitly in a similar section). [1]: https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2 [2]: http://man7.org/linux/man-pages/man3/open.3p.html --- test/unit/os/fileio_spec.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua index 3f0bd16e6c..59d85926d9 100644 --- a/test/unit/os/fileio_spec.lua +++ b/test/unit/os/fileio_spec.lua @@ -128,7 +128,9 @@ describe('file_open', function() it('fails to open an symlink with kFileNoSymlink', function() local err, fp = file_open(linkf, m.kFileNoSymlink, 384) - eq(m.UV_ELOOP, err) + -- err is UV_EMLINK in FreeBSD, but if I use `ok(err == m.UV_ELOOP or err == + -- m.UV_EMLINK)`, then I loose the ability to see actual `err` value. + if err ~= m.UV_ELOOP then eq(m.UV_EMLINK, err) end end) it('can open an existing file write-only with kFileCreate', function() -- cgit