unittests: Move checking cores to check_child_err

This commit is contained in:
ZyX
2017-04-06 08:23:33 +03:00
parent 654dd15bb8
commit a83511d1a1
2 changed files with 12 additions and 8 deletions

View File

@@ -162,7 +162,7 @@ end
local tests_skipped = 0 local tests_skipped = 0
local function check_cores(app) local function check_cores(app, force)
app = app or 'build/bin/nvim' app = app or 'build/bin/nvim'
local initial_path, re, exc_re local initial_path, re, exc_re
local gdb_db_cmd = 'gdb -n -batch -ex "thread apply all bt full" "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"' local gdb_db_cmd = 'gdb -n -batch -ex "thread apply all bt full" "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"'
@@ -188,7 +188,7 @@ local function check_cores(app)
random_skip = true random_skip = true
end end
-- Finding cores takes too much time on linux -- Finding cores takes too much time on linux
if random_skip and math.random() < 0.9 then if not force and random_skip and math.random() < 0.9 then
tests_skipped = tests_skipped + 1 tests_skipped = tests_skipped + 1
return return
end end

View File

@@ -655,6 +655,7 @@ end
local function check_child_err(rd) local function check_child_err(rd)
local trace = {} local trace = {}
local did_traceline = false
while true do while true do
local traceline = sc.read(rd, hook_msglen) local traceline = sc.read(rd, hook_msglen)
if #traceline ~= hook_msglen then if #traceline ~= hook_msglen then
@@ -665,6 +666,7 @@ local function check_child_err(rd)
end end
end end
if traceline == trace_end_msg then if traceline == trace_end_msg then
did_traceline = true
break break
end end
trace[#trace + 1] = traceline trace[#trace + 1] = traceline
@@ -680,6 +682,13 @@ local function check_child_err(rd)
error = error .. trace[i] error = error .. trace[i]
end end
end end
if not did_traceline then
error = error .. '\nNo end of trace occurred'
end
local cc_err, cc_emsg = pcall(check_cores, Paths.test_luajit_prg, true)
if not cc_err then
error = error .. '\ncheck_cores failed: ' .. cc_emsg
end
assert.just_fail(error) assert.just_fail(error)
end end
if res == '+\n' then if res == '+\n' then
@@ -765,11 +774,6 @@ local module = {
child_cleanup_once = child_cleanup_once, child_cleanup_once = child_cleanup_once,
sc = sc, sc = sc,
} }
return function(after_each) return function()
if after_each then
after_each(function()
check_cores(Paths.test_luajit_prg)
end)
end
return module return module
end end