Skip to content
Snippets Groups Projects
Commit 7a813f43 authored by Timur Safin's avatar Timur Safin Committed by Kirill Yukhin
Browse files

debugger: introduce logging facility

It's frequently needed to see interaction of a luatest script
and its chield launched via popen.
Now we display extra debugging information received from
children pipes directly to the parent screen. It's hidden
by default by luatest (if everything goes well), but could
be displayed with `luatest -c` option.

```
luatest -c -v app-luatest/console_debugger_session_test.lua
```

NO_DOC=internal
NO_CHANGELOG=internal
parent 22d7636b
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,10 @@ local function dbg_failed_range(v)
format(v, 1, 0x7fffff00)
end
local function debuglog(...)
print('--', ...)
end
local cmd_aliases = {
['b'] = 'b|break|breakpoint|add_break|add_breakpoint',
['bd'] = 'bd|bdelete|delete_break|delete_breakpoint',
......@@ -197,12 +201,14 @@ local function run_debug_session(cmdline, sequence, header)
cmd = cmd .. '\n'
end
fh:write(cmd)
debuglog('Execute command: "'..trim(cmd)..'"')
end
local result
local clean_cmd = trim(cmd)
-- there should be empty stderr - check it before stdout
local errout = fh:read({ timeout = 0.05, stderr = true})
debuglog('stderr output: ', trim(errout))
if first and errout then
-- we do not expect anything on stderr
-- with exception of initial debugger header
......@@ -213,6 +219,7 @@ local function run_debug_session(cmdline, sequence, header)
end
repeat
result = trim(unescape(fh:read({ timeout = 0.5 })))
debuglog('stdout output:', result)
until result ~= '' or result ~= clean_cmd
if expected ~= '' then
t.assert_str_contains(result, expected, false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment