mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 01:02:09 +00:00
tests: Fix CI failures
This commit is contained in:
@@ -9,7 +9,7 @@ local nvim_prog = helpers.nvim_prog
|
||||
local write_file = helpers.write_file
|
||||
|
||||
local popen_w = global_helpers.popen_w
|
||||
local popen_r = global_helpers.popen_r
|
||||
local repeated_popen_r = global_helpers.repeated_popen_r
|
||||
|
||||
describe('Command-line option', function()
|
||||
describe('-s', function()
|
||||
@@ -48,13 +48,13 @@ describe('Command-line option', function()
|
||||
eq(nil, lfs.attributes(fname))
|
||||
eq(true, not not dollar_fname:find('%$%w+'))
|
||||
write_file(dollar_fname, ':call setline(1, "100500")\n:wqall!\n')
|
||||
local pipe = popen_r(
|
||||
local pipe = repeated_popen_r(
|
||||
nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '-s', dollar_fname,
|
||||
fname)
|
||||
local stdout = pipe:read('*a')
|
||||
eq('', stdout)
|
||||
local attrs = lfs.attributes(fname)
|
||||
eq(#('100500\n'), attrs.size)
|
||||
local stdout = pipe:read('*a')
|
||||
eq('', stdout)
|
||||
local attrs = lfs.attributes(fname)
|
||||
eq(#('100500\n'), attrs.size)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@@ -17,8 +17,8 @@ local function argss_to_cmd(...)
|
||||
if type(arg) == 'string' then
|
||||
cmd = cmd .. ' ' ..shell_quote(arg)
|
||||
else
|
||||
for _, arg in ipairs(arg) do
|
||||
cmd = cmd .. ' ' .. shell_quote(arg)
|
||||
for _, subarg in ipairs(arg) do
|
||||
cmd = cmd .. ' ' .. shell_quote(subarg)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -257,6 +257,19 @@ local function which(exe)
|
||||
end
|
||||
end
|
||||
|
||||
local function repeated_popen_r(...)
|
||||
for _ = 1, 10 do
|
||||
local stream = popen_r(...)
|
||||
local ret = stream:read('*a')
|
||||
stream:close()
|
||||
if ret then
|
||||
return ret
|
||||
end
|
||||
end
|
||||
print('ERROR: Failed to execute ' .. argss_to_cmd(...) .. ': nil return after 10 attempts')
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
eq = eq,
|
||||
neq = neq,
|
||||
@@ -273,4 +286,5 @@ return {
|
||||
argss_to_cmd = argss_to_cmd,
|
||||
popen_r = popen_r,
|
||||
popen_w = popen_w,
|
||||
repeated_popen_r = repeated_popen_r,
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
local ffi = require("ffi")
|
||||
local global_helpers = require('test.helpers')
|
||||
|
||||
local popen_r = global_helpers.popen_r
|
||||
local argss_to_cmd = global_helpers.argss_to_cmd
|
||||
local repeated_popen_r = global_helpers.repeated_popen_r
|
||||
|
||||
local ccs = {}
|
||||
|
||||
@@ -157,28 +157,15 @@ function Gcc:dependencies(hdr)
|
||||
end
|
||||
end
|
||||
|
||||
local function repeated_call(...)
|
||||
for _ = 1, 10 do
|
||||
local stream = popen_r(...)
|
||||
local ret = stream:read('*a')
|
||||
stream:close()
|
||||
if ret then
|
||||
return ret
|
||||
end
|
||||
end
|
||||
print('ERROR: preprocess.lua: Failed to execute ' .. cmd .. ': nil return after 10 attempts')
|
||||
return nil
|
||||
end
|
||||
|
||||
function Gcc:filter_standard_defines(defines)
|
||||
if not self.standard_defines then
|
||||
local pseudoheader_fname = 'tmp_empty_pseudoheader.h'
|
||||
local pseudoheader_file = io.open(pseudoheader_fname, 'w')
|
||||
pseudoheader_file:close()
|
||||
local standard_defines = repeated_call(self.path,
|
||||
self.preprocessor_extra_flags,
|
||||
self.get_defines_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
local standard_defines = repeated_popen_r(self.path,
|
||||
self.preprocessor_extra_flags,
|
||||
self.get_defines_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
os.remove(pseudoheader_fname)
|
||||
self.standard_defines = {}
|
||||
for line in standard_defines:gmatch('[^\n]+') do
|
||||
@@ -207,9 +194,9 @@ function Gcc:preprocess(previous_defines, ...)
|
||||
pseudoheader_file:flush()
|
||||
pseudoheader_file:close()
|
||||
|
||||
local defines = repeated_call(self.path, self.preprocessor_extra_flags,
|
||||
self.get_defines_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
local defines = repeated_popen_r(self.path, self.preprocessor_extra_flags,
|
||||
self.get_defines_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
defines = self:filter_standard_defines(defines)
|
||||
|
||||
-- lfs = require("lfs")
|
||||
@@ -218,9 +205,10 @@ function Gcc:preprocess(previous_defines, ...)
|
||||
-- io.stderr\write("CWD: #{lfs.currentdir!}\n")
|
||||
-- io.stderr\write("CMD: #{cmd}\n")
|
||||
|
||||
local declarations = repeated_call(self.path, self.preprocessor_extra_flags,
|
||||
self.get_declarations_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
local declarations = repeated_popen_r(self.path,
|
||||
self.preprocessor_extra_flags,
|
||||
self.get_declarations_extra_flags,
|
||||
{pseudoheader_fname})
|
||||
|
||||
os.remove(pseudoheader_fname)
|
||||
|
||||
|
Reference in New Issue
Block a user