mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
410d18ef5c
Works by saving all preprocessor defines and reusing them on each run. This also saves NVIM_HEADER_H defines. Saving other defines is needed for defines like `Map(foo, bar)` which are sometimes used to declare types or functions. Saving types or function declarations is not needed because they are recorded as luajit state. Fixes #5857
101 lines
2.7 KiB
Lua
101 lines
2.7 KiB
Lua
local assert = require('luassert')
|
|
local lfs = require('lfs')
|
|
|
|
local check_logs_useless_lines = {
|
|
['Warning: noted but unhandled ioctl']=1,
|
|
['could cause spurious value errors to appear']=2,
|
|
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
|
|
}
|
|
|
|
local eq = function(exp, act)
|
|
return assert.are.same(exp, act)
|
|
end
|
|
local neq = function(exp, act)
|
|
return assert.are_not.same(exp, act)
|
|
end
|
|
local ok = function(res)
|
|
return assert.is_true(res)
|
|
end
|
|
|
|
local function check_logs()
|
|
local log_dir = os.getenv('LOG_DIR')
|
|
local runtime_errors = 0
|
|
if log_dir and lfs.attributes(log_dir, 'mode') == 'directory' then
|
|
for tail in lfs.dir(log_dir) do
|
|
if tail:sub(1, 30) == 'valgrind-' or tail:find('san%.') then
|
|
local file = log_dir .. '/' .. tail
|
|
local fd = io.open(file)
|
|
local start_msg = ('='):rep(20) .. ' File ' .. file .. ' ' .. ('='):rep(20)
|
|
local lines = {}
|
|
local warning_line = 0
|
|
for line in fd:lines() do
|
|
local cur_warning_line = check_logs_useless_lines[line]
|
|
if cur_warning_line == warning_line + 1 then
|
|
warning_line = cur_warning_line
|
|
else
|
|
lines[#lines + 1] = line
|
|
end
|
|
end
|
|
fd:close()
|
|
os.remove(file)
|
|
if #lines > 0 then
|
|
-- local out = os.getenv('TRAVIS_CI_BUILD') and io.stdout or io.stderr
|
|
local out = io.stdout
|
|
out:write(start_msg .. '\n')
|
|
out:write('= ' .. table.concat(lines, '\n= ') .. '\n')
|
|
out:write(select(1, start_msg:gsub('.', '=')) .. '\n')
|
|
runtime_errors = runtime_errors + 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
assert(0 == runtime_errors)
|
|
end
|
|
|
|
-- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows".
|
|
local uname = (function()
|
|
local platform = nil
|
|
return (function()
|
|
if platform then
|
|
return platform
|
|
end
|
|
|
|
platform = os.getenv("SYSTEM_NAME")
|
|
if platform then
|
|
return platform
|
|
end
|
|
|
|
local status, f = pcall(io.popen, "uname -s")
|
|
if status then
|
|
platform = f:read("*l")
|
|
else
|
|
platform = 'Windows'
|
|
end
|
|
return platform
|
|
end)
|
|
end)()
|
|
|
|
local function tmpname()
|
|
local fname = os.tmpname()
|
|
if uname() == 'Windows' and fname:sub(1, 2) == '\\s' then
|
|
-- In Windows tmpname() returns a filename starting with
|
|
-- special sequence \s, prepend $TEMP path
|
|
local tmpdir = os.getenv('TEMP')
|
|
return tmpdir..fname
|
|
elseif fname:match('^/tmp') and uname() == 'Darwin' then
|
|
-- In OS X /tmp links to /private/tmp
|
|
return '/private'..fname
|
|
else
|
|
return fname
|
|
end
|
|
end
|
|
|
|
return {
|
|
eq = eq,
|
|
neq = neq,
|
|
ok = ok,
|
|
check_logs = check_logs,
|
|
uname = uname,
|
|
tmpname = tmpname,
|
|
}
|