diff options
author | ZyX <kp-pav@yandex.ru> | 2017-07-04 15:15:23 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-07-04 15:15:23 +0300 |
commit | 2208b64891d57a4ab79143183888149be9ee228d (patch) | |
tree | e795b58ad03cfa784d0418b184fd3d4e6c26bab3 /test/functional/helpers.lua | |
parent | 480598dcda990fd19900b9fe3a01f519cd9b50d0 (diff) | |
download | rneovim-2208b64891d57a4ab79143183888149be9ee228d.tar.gz rneovim-2208b64891d57a4ab79143183888149be9ee228d.tar.bz2 rneovim-2208b64891d57a4ab79143183888149be9ee228d.zip |
functests: Ensure different SIDs on successive source() calls
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 4a170d993b..d7858cacd5 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -337,11 +337,23 @@ local function read_file(name) return ret end +local sourced_fnames = {} local function source(code) local fname = tmpname() write_file(fname, code) nvim_command('source '..fname) - os.remove(fname) + -- DO NOT REMOVE FILE HERE. + -- do_source() has a habit of checking whether files are “same” by using inode + -- and device IDs. If you run two source() calls in quick succession there is + -- a good chance that underlying filesystem will reuse the inode, making files + -- appear as “symlinks” to do_source when it checks FileIDs. With current + -- setup linux machines (both QB, travis and mine(ZyX-I) with XFS) do reuse + -- inodes, Mac OS machines (again, both QB and travis) do not. + -- + -- Files appearing as “symlinks” mean that both the first and the second + -- source() calls will use same SID, which may fail some tests which check for + -- exact numbers after `<SNR>` in e.g. function names. + sourced_fnames[#sourced_fnames + 1] = fname return fname end @@ -673,6 +685,9 @@ local module = { return function(after_each) if after_each then after_each(function() + for _, fname in ipairs(sourced_fnames) do + os.remove(fname) + end check_logs() check_cores('build/bin/nvim') end) |