mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
unittests: Disable non-C-calls
Some benchmarks: TRACE_EVERYTHING: 79.45s user 12.68s system 124% cpu 1:13.94 total (default): 30.26s user 5.30s system 89% cpu 39.663 total
This commit is contained in:
parent
9dd0d4f8b9
commit
708a55ee15
@ -107,3 +107,7 @@ used to check how testing infrastructure works.
|
||||
if tests crashed without core dump you will have no clues regarding where, but
|
||||
this makes tests run a lot faster. Combine with `NVIM_TEST_MAIN_CDEFS` for
|
||||
maximal speed.
|
||||
|
||||
`NVIM_TEST_TRACE_EVERYTHING` (U) (1): by default unit test only record C calls
|
||||
which is faster then recording everything. Set this variable to 1 if you want to
|
||||
see all traces.
|
||||
|
@ -542,19 +542,27 @@ local function child_sethook(wr)
|
||||
if os.getenv('NVIM_TEST_NO_TRACE') == '1' then
|
||||
return
|
||||
end
|
||||
local trace_only_c = (os.getenv('NVIM_TEST_TRACE_EVERYTHING') ~= '1')
|
||||
local function hook(reason, lnum)
|
||||
local msgchar = reason:sub(1, 1)
|
||||
if reason == 'count' then
|
||||
msgchar = 'C'
|
||||
end
|
||||
local info = nil
|
||||
if reason ~= 'tail return' then -- tail return
|
||||
info = debug.getinfo(2, 'nSl')
|
||||
end
|
||||
|
||||
if trace_only_c and (not info or info.what ~= 'C') then
|
||||
return
|
||||
end
|
||||
|
||||
local whatchar = ' '
|
||||
local namewhatchar = ' '
|
||||
local funcname = ''
|
||||
local source = ''
|
||||
local msgchar = reason:sub(1, 1)
|
||||
|
||||
if reason == 'count' then
|
||||
msgchar = 'C'
|
||||
end
|
||||
|
||||
if info then
|
||||
funcname = (info.name or ''):sub(1, hook_fnamelen)
|
||||
whatchar = info.what:sub(1, 1)
|
||||
@ -595,9 +603,11 @@ local function child_sethook(wr)
|
||||
-- eq(hook_msglen, #msg)
|
||||
sc.write(wr, msg)
|
||||
end
|
||||
debug.sethook(hook, 'crl')
|
||||
debug.sethook(hook, trace_only_c and 'cr' or 'crl')
|
||||
end
|
||||
|
||||
local trace_end_msg = ('E%s\n'):format((' '):rep(hook_msglen - 2))
|
||||
|
||||
local function itp_child(wr, func)
|
||||
init()
|
||||
collectgarbage('stop')
|
||||
@ -606,7 +616,7 @@ local function itp_child(wr, func)
|
||||
debug.sethook()
|
||||
collectgarbage('restart')
|
||||
emsg = tostring(emsg)
|
||||
sc.write(wr, ('E%s\n'):format((' '):rep(hook_msglen - 2)))
|
||||
sc.write(wr, trace_end_msg)
|
||||
if not err then
|
||||
if #emsg > 99999 then
|
||||
emsg = emsg:sub(1, 99999)
|
||||
@ -634,7 +644,7 @@ local function check_child_err(rd)
|
||||
trace[#trace + 1] = 'Partial read: <' .. trace .. '>\n'
|
||||
end
|
||||
end
|
||||
if traceline:sub(1, 1) == 'E' then
|
||||
if traceline == trace_end_msg then
|
||||
break
|
||||
end
|
||||
trace[#trace + 1] = traceline
|
||||
|
Loading…
Reference in New Issue
Block a user